Commit Graph

2144 Commits

Author SHA1 Message Date
Geoffrey McRae
b877bab48f [client] main: increase the ups/fps update rate to once per 100ms
This is so that we can use the ups information in the following commit.
2021-07-20 15:40:57 +10:00
Geoffrey McRae
e6e07e8f3f [client] main: use the monotonic clock to calculate the ups/fps
The accumulated time is not the best way to do this as the timer
function callback may not be exactly every 1000ms, by using the
monotonic clock we will get more accurate results.
2021-07-20 15:40:51 +10:00
Quantum
3f7261d7d9 [client] wayland: do not crash when presentation time is unavailable
We don't need the presentation time protocol, so fail gracefully when
it's unavailable.
2021-07-20 14:23:08 +10:00
Quantum
26f16a3734 [common] windows: declare WINVER and _WIN32_WINNT
This is done for consistency with the Windows-specific portions of the host.
2021-07-20 12:45:29 +10:00
Quantum
88fc1a6d24 [host] windows: directly invoke ChangeWindowMessageFilterEx
This requires bumping the minimum Windows version to Windows 7, but I
don't think we care about Vista anyways.
2021-07-20 12:16:49 +10:00
Quantum
2fc1d3cae6 [host] windows: fix resource compilation dependencies
It used to be the case that when updating app.manifest, the resource file
it not automatically rebuilt. This made it a headache to update the manifest.
We set OBJECT_DEPENDS so that cmake knows to make the res file depend on
app.manifest and icon.ico.

This commit is based on PR #579 and should be rebased on it after it's merged.
2021-07-20 12:14:39 +10:00
Quantum
28a67cad0d [host] windows: avoid compiling .rc file twice
a4f5ce08b9 has a regression that caused
the .rc file to be compiled twice. We do not want the version that's
added into the .a file.
2021-07-20 12:14:04 +10:00
Quantum
2bb0602ebb [common] windebug: remove custom-rolled Windows 8 detector
Just use <versionhelpers.h> from Windows SDK.
2021-07-20 11:34:57 +10:00
Quantum
d82333519c [host] dxgi: use SDK versionhelpers.h to test for Windows version
Also, changed logic so that Windows versions before 8 is not treated as 10.
2021-07-20 11:34:57 +10:00
Quantum
5421bd8b1d [host] windows: declare Windows 10 support in manifest
This allows IsWindows10OrGreater from <versionhelpers.h> to work.
2021-07-20 11:34:57 +10:00
Quantum
f0c7e9bdfa [host] windows: declare high DPI support in manifest
This is the normal way of doing things, and it's easier and less sketchy
than GetProcAddress.
2021-07-20 11:34:45 +10:00
Quantum
0525515bee [host] cmake: use -march=x86-64-v2 when it becomes available
GCC 11 will support x86_64 micro-architecture feature levels.
What we really want to support is nehalem or newer, which is x86-64-v2,
and specifying this instead of nehalem means that we are not tuning for
nehalem specifically.
2021-07-20 11:33:23 +10:00
Quantum
f5ad14b109 [host] windows: directly link D3DKMTSetProcessSchedulingPriorityClass
This function is available since Windows Vista and can therefore be used
directly without going through GetProcAddress. Unfortunately, MinGW does
not have d3dkmthk.h, but we can declare the prototype ourselves and link
against gdi32.dll.
2021-07-20 11:32:41 +10:00
Quantum
323d321a77 [host] windows: correctly declare WINVER and _WIN32_WINNT
We wanted to target Windows Vista, which is 0x0600 not 0x6000.
0x6000 is in fact larger than Windows 10 which is 0x0a00.
2021-07-20 11:32:15 +10:00
Quantum
56833edae7 [host] delay: directly link against ntdll.dll
There is no need to LoadLibrary and GetProcAddress to get pointers to
NtDelayExecution or NtSetTimerResolution. These functions don't have
prototypes in any SDK header, but they are exported in ntdll.dll and
we can simply declare the prototype and link ntdll.

There is also no chance that the functions do not exist: I checked an
old install of Windows NT 4.0 and both of these functions exist.

Also used NtSetTimerResolution instead of ZeSetTimerResolution for
consistency (they are the same).

Also changed system timer resolution log message units to μs with
one decimal digit for readability. This is the actual amount of
precision available to us.
2021-07-20 11:30:12 +10:00
Quantum
d57b5a320e [host] service: fix adjustPriv return value
When OpenProcessToken fails, the function returned -1, which would be true
when converted to bool. This is wrong, and it should be returning false.
2021-07-20 11:29:32 +10:00
Quantum
563ad18f4e [client] egl: improve cursor damage logic
1. Use atomics and return exact cursor positions from egl_cursor_render
   to avoid race conditions between cursor render and update.
2. Instead of messing with lastCursorValid in various overlays, simply use
   the hasOverlay/hadOverlay logic for cursor damage. This simplifies the
   logic greatly.

As a result, I believe all cursor-related artifacts are fixed.

Note to reviewer: as atomic_init and atomic_store are implemented as macros,
it is currently not possible to pass structs as compound literals due to the
comma being interpreted as an argument separator by the preprocessor.
2021-07-20 11:29:13 +10:00
Quantum
b4dc021381 [host] service: pass CREATE_UNICODE_ENVIRONMENT unconditionally
According to MSDN documentation for CreateEnvironmentBlock, "[i]f the
environment block is passed to CreateProcessAsUser, you must also
specify the CREATE_UNICODE_ENVIRONMENT flag."

Also pass DETACHED_PROCESS because the host is a GUI application and
doesn't use the console.
2021-07-20 11:27:16 +10:00
Quantum
ebda52b18b [host] service: use SYSTEM token attached to the current process
Since with the service, we are already running as SYSTEM, we don't need
to use dupeSystemProcessToken to get the token for SYSTEM. This removes
the need for having SeDebugPrivilege, SeTcbPrivilege, and
SeAssignPrimaryTokenPrivilege, or otherwise doing sketchy things.

Furthermore, we now only open the token with the privileges we actually
need.
2021-07-20 11:27:03 +10:00
Quantum
16ee1a825c [host] windows: use event to gracefully signal exit
This allows the process to be terminated without resorting to
TerminateProcess. With some fixes, this allows the notification icon to be
removed when the service is restarted.

Furthermore, instead of sending WM_DESTROY to fool the window into believing
it's being destroyed, we actually call DestroyWindow now.
2021-07-20 11:26:49 +10:00
arcnmx
a4f5ce08b9 [host] link resource directly to exe 2021-07-20 11:25:55 +10:00
arcnmx
aa41e4d2ce Revert "Revert "[host] avoid manual windres command""
This reverts commit cd10e02862.
2021-07-20 11:25:55 +10:00
Quantum
b8effaf42c [client] egl: use glGetError and codes for errors in gl* functions
We used to use DEBUG_EGL_ERROR for gl* functions, which just yields
EGL_SUCCESS even when there are errors.
2021-07-19 19:36:46 +10:00
Quantum
0cbc529640 [client] ds: refactor common EGL swap with damage logic
This commit creates a new utility library, eglutil.h, which contains code
to detect and use EGL_KHR_swap_buffers_with_damage or its EXT equivalent.

This logic used to be duplicated between the X11 and Wayland display servers,
which is not ideal.
2021-07-19 19:35:52 +10:00
Quantum
a8d4668c4d [client] ci: do not install libglew-dev
We removed the GLEW dependency, so we shouldn't be installing it.
2021-07-19 19:34:04 +10:00
Geoffrey McRae
2de9912ac0 [client] egl: EGL_KHR_swap_buffers_with_damage returns EGLBoolean 2021-07-19 13:32:56 +10:00
Geoffrey McRae
2038517861 [common] linux: review and fix event logic, events should not be counted 2021-07-19 13:19:59 +10:00
Geoffrey McRae
33bf668697 [client] app: correct FPS to use an actual per second value 2021-07-19 10:58:40 +10:00
Geoffrey McRae
2736e37e4a [common] timer: fix timespec parameters when interval >= 1000 2021-07-19 10:58:10 +10:00
Geoffrey McRae
e4e1451eaa [client] app: give some transparency to the new FPS window 2021-07-18 21:22:16 +10:00
Quantum
7c872d2d9e [client] egl: properly use OpenGL ES
Instead of using the desktop <GL/gl.h>, we properly use the OpenGL ES 3.x
headers. Also, we now use GL_EXT_buffer_storage for MAP_PERSISTENT_BIT_EXT
and MAP_COHERENT_BIT_EXT as the core versions are only available in desktop
OpenGL 4.4. Similarly, we need GL_EXT_texture_format_BGRA8888 for GL_BGRA_EXT
as GL_BGRA is desktop-only.
2021-07-18 20:44:32 +10:00
Geoffrey McRae
ab31040d5f [client] all: use imgui for FPS/UPS display 2021-07-18 20:43:17 +10:00
Geoffrey McRae
45e1b5bce0 [common] ringbuffer: add pre value overwrite callback
This allows us to set a callback to read a value out before it's about
to be overwritten which can be useful for things like calculating a
running average.
2021-07-18 20:42:29 +10:00
Quantum
42d8f31eba [client] imgui: use ES 3.0 and remove glew dependency
If we specifically tell ImGui's OpenGL 3.x backend to target OpenGL ES 3.0,
then no extension loader is necessary.
2021-07-18 18:50:12 +10:00
Quantum
c6a6230a56 [client] egl: revert "only copy damaged areas when using dmabuf"
This reverts commit a14de25661.
Frame is sometimes incorrect.
2021-07-18 18:48:35 +10:00
Quantum
a14de25661 [client] egl: only copy damaged areas when using dmabuf
This speeds up the copy significantly when the frame only has small
amount of damage.
2021-07-18 17:41:29 +10:00
Quantum
09893fd728 [client] wayland: display swap to photon latency graph 2021-07-18 16:15:10 +10:00
Quantum
e87bc3a83e [client] wayland: measure presentation time 2021-07-18 16:15:10 +10:00
Quantum
6da9428d85 [client] imgui: use struct for graph metrics instead of array
This allows the members to be named, making the code much easier to read.
2021-07-18 16:15:10 +10:00
Quantum
15bc6a1509 [client] imgui: support registering new graphs
Currently, our struct ll doesn't support removing elements from the middle,
so we will not be removing anything for now.
2021-07-18 16:15:10 +10:00
Quantum
a4bf3c8088 [client] egl: use debug context and make it configurable
The boolean option egl:debug is used to control whether we want debug
output or not. This defaults to true to aid in debugging.
2021-07-18 15:55:50 +10:00
Quantum
6472c28473 [client] egl: upload damage vertices with glBufferSubData
This avoids the issues surrounding glMapBuffer and glMapBufferRange in
OpenGL ES.
2021-07-18 15:55:27 +10:00
Quantum
f49f2af6cd [client] egl: implement error reporting callback
This reports useful information from OpenGL on supported platforms.
2021-07-18 13:54:16 +10:00
Quantum
061b9ba6c2 [client] egl: use vertex array objects in model.c
This eliminates the need to bind the buffers and set up the vertices on
every frame.
2021-07-18 11:58:47 +10:00
Quantum
d4f8426ae4 [client] egl: correctly clean up vertex buffer objects
The code used to use hasBuffer, which was never set to true, so buffer
objects were always leaked instead.
2021-07-18 11:58:47 +10:00
Quantum
ad974cfa0a [common] dpi: remove no longer used library 2021-07-18 10:50:57 +10:00
Quantum
e1fae8927f [common] kvmfr: remove mouseScalingPercent which is no longer used
This used to contain DPI information, but is no longer used.
2021-07-18 10:50:57 +10:00
Quantum
9ab85fd0b8 [host] capture: stop sending DPI information
The client doesn't need DPI information anymore, so there is no point
fetching it.
2021-07-18 10:50:57 +10:00
Quantum
e0c9a71cd8 [client] spice: remove dpi which is no longer used
DPI was originally added to workaround cursor movement scaling, but since
due to changes with mouse handling, it's no longer required.
2021-07-18 10:50:57 +10:00
Geoffrey McRae
d44d87ee7f [client] spice: update to use the new epoll version of PureSpice 2021-07-18 10:48:56 +10:00