Commit Graph

1141 Commits

Author SHA1 Message Date
Quantum
27e3be3778 [client] egl: free desktop damage after rendering 2021-07-22 13:12:07 +10:00
Quantum
bb60107a3b [client] wayland: dispatch events through libdecor when using it
Currently, we dispatch the events on the wayland display server ourselves.
This is fine when using the cairo backend of libdecor, as it does the same
thign we do, but other backends may require other things to be dispatched.

This commit lets libdecor dispatch events instead through libdecor_get_fd
and libdecor_dispatch, which should hopefully makes things less sketchy.
2021-07-22 12:03:55 +10:00
Geoffrey McRae
08293c8721 [egl] damage: only update the damage vbo if there was a new frame 2021-07-21 17:29:46 +10:00
Geoffrey McRae
6389a06903 [client] main: let the renderer know if it's rendering a whole new frame
While the renderer can internally track this it would be better to
simply provide this information to the renderer directly so it can make
better decisions on how best to update the screen.
2021-07-21 17:26:48 +10:00
Geoffrey McRae
8cf444ef31 [client] main: sync to the ups if the ups exceeds minFrameTime 2021-07-21 16:56:49 +10:00
Geoffrey McRae
1c8af28f26 Revert "[client] main: increase the ups/fps update rate to once per 100ms"
This reverts commit b877bab48f.
There is no need for this anymore after the prior commit which removed
this faulty implementation
2021-07-21 16:50:49 +10:00
Geoffrey McRae
9b472d62a9 [client] main: remove/fix faulty upsTime code
The implementation was flawed, instead we just update the presentation
time if there was not an early wakeup.
2021-07-21 16:47:37 +10:00
Quantum
1a88996c47 [client] opengl: don't include <GL/glx.h>
The OpenGL renderer backend should not depend on any particular
implementation of OpenGL, as it's used by both X11 and Wayland.
2021-07-21 12:33:01 +10:00
Geoffrey McRae
3c0ebd54ec [client] main: improve frame rate sync lock with the guest
If the guest is not sending frames at a constant rate, the minimum FPS
timeout may expire drawing an additional frame. This change calculates
the average ups frame time over the past 100ms and adds this to the
timeout value allowing this value to be dynamic.
2021-07-20 15:41:56 +10:00
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
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
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
Geoffrey McRae
2de9912ac0 [client] egl: EGL_KHR_swap_buffers_with_damage returns EGLBoolean 2021-07-19 13:32:56 +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
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
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
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
Quantum
2b3f31700b [client] egl: implement frame damage display 2021-07-18 10:41:50 +10:00
Quantum
12cb3e512f [client] util: add function for merging overlapping rectangles
This will be used to merge overlapping rectangles in order to avoid copying
the same rectangles multiple times.
2021-07-18 10:41:50 +10:00
Quantum
00eb26a34f [client] egl: do not use damage when overlays are visible
This allows the overlays to show up correctly.
2021-07-18 10:41:50 +10:00
Quantum
442ab318fd [client] egl: use desktop frame damage information 2021-07-18 10:41:50 +10:00
Quantum
6695ca3f34 [client] ds: remove SDL display server 2021-07-18 10:34:41 +10:00
Quantum
eb357fa58a [client] egl: use glCopyTexSubImage2D to copy when using DMA
This removes the need for the driver to allocate texture storage and deleting
the previous allocation on every frame update.
2021-07-18 10:34:21 +10:00
Quantum
39ec32b2ef [client] cimgui: build as static library 2021-07-18 10:31:45 +10:00
Geoffrey McRae
df2f623599 [client] app: add keybind to toggle frame timing information display 2021-07-18 09:59:37 +10:00
Geoffrey McRae
73357988e6 [client] main: don't trigger redraws if the video feed is disabled
If the video feed is disabled we are not drawing the cursor, so don't
cause needless redraws
2021-07-17 21:09:51 +10:00
Geoffrey McRae
03c247a9ff [client] x11: make use of eglSwapBuffersWithDamage if it's available 2021-07-17 21:09:51 +10:00
Geoffrey McRae
092ce61908 [client] main: copy & release KVMFR messages sooner
The renderer may take time to process the cursor update due to various
internal factors, as such it's best we copy the data and mark the
message as done ASAP. This prevents the host from filling up the queue
as easily when a high dpi mouse is in use.
2021-07-17 21:09:51 +10:00
Geoffrey McRae
b9d7674b20 [client] imgui: calculate min/max/avg/fps and add them to the plots 2021-07-17 21:09:51 +10:00
Geoffrey McRae
8e3df5a38f [client] main: dont push an invalid value into the timings buffers 2021-07-17 21:09:51 +10:00
Geoffrey McRae
2e76c874cc [client] app: initial imgui frame timings 2021-07-17 21:09:51 +10:00
Geoffrey McRae
c3bc5fb0ff [client] app: collect render and frame timing information 2021-07-17 21:09:51 +10:00
Geoffrey McRae
bcffd70270 [client] app: init/destroy imgui context on run/shutdown 2021-07-17 21:09:51 +10:00