Commit Graph

97 Commits

Author SHA1 Message Date
Quantum
d9cdc8d26c [client] egl: rotate damage rectangles according to client side rotation 2021-07-25 16:56:48 +10:00
Geoffrey McRae
60a58d4d8d [client] all: make it possible to signal full window invalidation
Now that we are drawing with damage rects, when the window is hidden and
then exposed the window may not get fully redrawn. This provides
`app_invalidateWindow` for the display server backend to call when the
screen needs a full redraw.
2021-07-25 15:29:29 +10:00
Quantum
cb9774bbd2 [client] egl: remove font management 2021-07-23 20:18:12 +10:00
Quantum
dd0edc1394 [client] renderers: remove alert handling 2021-07-23 20:18:12 +10:00
Quantum
5153d35bb5 [client] renderer: remove on_help from renderer interface 2021-07-23 18:04:05 +10:00
Quantum
5d053128ac [client] imgui: use improved high DPI rendering
This actually makes imgui render at a higher resolution, avoiding scaling
and resulting blurriness.
2021-07-23 16:07:42 +10:00
Quantum
df0397b10b [client] imgui: track last rectangles for overlays
This is necessary in case overlays change size. When this happens, we must
damage the larger of the overlays' rectangles this frame and last frame.
This erases the overlay from where it is no longer appears.

In order to do this, we must keep track of the rectangles for every overlay
with no exception. We cannot short-circuit the generation of rectangles if
we run out of buffer space, and we must allocate space for MAX_OVERLAY_RECTS
rectangles for every frame. Otherwise, we will not know where to erase the
overlay if it disappears.
2021-07-23 15:54:18 +10:00
Quantum
334bfeecea [client] egl: correctly handle mixing imgui and non-imgui overlays
This allows the full frame to be damaged when both types are visible.
2021-07-23 15:53:59 +10:00
Quantum
947eac52f6 [client] renderers: treat -1 as full damage and 0 as no overlay
This makes everything consistent.
2021-07-22 18:57:34 +10:00
Quantum
515f08d2da [client] egl: transform overlay damage coordinates
EGL uses bottom-up y-coordinate while we use top-down.
2021-07-22 18:32:18 +10:00
Quantum
58ab77d237 [client] egl: avoid overflowing damage buffer
We allocate 10 rectangles for overlay damage as agreed on Discord.
2021-07-22 18:32:18 +10:00
Geoffrey McRae
fdbdf6f167 [client] app: implement new overlay rendering framework
This change set implements a framework for overlays to be registered
that make use of ImGui. See `overlay/fps` for a simple implementation
example.
2021-07-22 17:27:30 +10:00
Quantum
27e3be3778 [client] egl: free desktop damage after rendering 2021-07-22 13:12:07 +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
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
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
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
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
2b3f31700b [client] egl: implement frame damage display 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
Geoffrey McRae
f08163fd72 [client] imgui: added imgui to the client and OpenGL/EGL renderers 2021-07-17 21:09:51 +10:00
Quantum
24d0aa0c18 [all] normalize copyright on all source files 2021-06-06 11:53:05 +10:00
Quantum
e70cfd84fb [client] egl: use eglSwapBuffersWithDamageKHR for cursor-only updates
Instead of damaging the entire surface when rendering a cursor move,
we can use the EGL_KHR_swap_buffers_with_damage extension to only
damage the part of the window covered by the cursor. This should
reduce the cursor movement latency on Wayland.
2021-05-19 18:56:36 +10:00
Quantum
f9a9953071 [client] egl: use new util_hasGLExt helper to check extensions
We previously used strstr, which can be prone to false positives when
the name of one extension is a substring of another extension.

This commit creates the helper function util_hasGLExt, which asserts
that the substring found in extension list is bounded by either spaces
or the beginning/end of the string.
2021-05-19 15:58:54 +10:00
Geoffrey McRae
8771103abb [client] all: fix more maybe-uninitialized when -O3 is in use
Closes #475
2021-02-23 20:25:30 +11:00
Quantum
30b5287c38 [client] egl: add option to set initial scale algorithm
The option is egl:scale. The scale algorithm number is displayed on the
alert to make it easier to specify the number for the option.
2021-02-22 17:25:06 +11:00
Geoffrey McRae
28024de314 [client] egl: fix gcc false maybe-uninitialized positives 2021-02-22 01:38:26 +11:00
Quantum
fd50426dda [client] egl: scale UI elements on high DPI displays
This is done by actually rendering the text at high DPI.
2021-02-21 19:06:53 +11:00
Quantum
3ec73e2444 [client] egl: support scaled UI for high DPI displays 2021-02-21 19:06:53 +11:00
Quantum
b35e19fc27 [client] renderer: add interface for high DPI rendering 2021-02-21 19:06:53 +11:00
Quantum
ba6f26393f [client] egl: add framework for multiple scaling algorithms
This commit fixes the issues with the meaning of useNearest being flipped
by removing the variable and use enumerations.

We define an enumeration EGL_DesktopScaleType to express the type of scaling
needed to be performed: no scaling, upscaling, or downscaling. This is
updated when either the frame size or the viewport size changes.
Previously, we only updated the useNearest when the frame size changes.

The desktop shader can now support an enumeration of scaling algorithms,
although only nearest and linear are currently implemented.

Like before, nearest is used when not scaling or upscaling, and linear is
used when downscaling.
2021-02-21 14:20:41 +11:00
Quantum
39a09ca565 [client] egl: remove dependency on SDL
After this PR, EGL functions are now accessed through <EGL/egl.h>
instead of through <SDL2/SDL_egl.h>, removing a pointless dependency
on SDL.
2021-02-21 10:31:49 +11:00
Quantum
89b73512ad [client] renderer: add ability to toggle the FPS display
Before, if you want to see the FPS, you need to close the client and
restart it with the -k switch to see the FPS. This is annoying.

This PR introduces a new keybind, ScrollLock+D, which, when pressed,
toggles the display of the FPS.

This is implemented for both EGL and OpenGL backends.
2021-02-21 10:31:48 +11:00
Geoffrey McRae
1d99c821eb [client] egl: decrease the font size for the help text 2021-02-21 10:31:48 +11:00
Quantum
2993f7ae7d [client] egl: create 24-bit colour context
This should prevent the looking-glass-client window from having an alpha
channel. On Wayland, the alpha channel is used to compose the window onto
the desktop, so the wallpaper would bleed through unless set to complete
opaque.

We worked around this by using constant alpha for rendering, but it was
not sustainable. Instead, we should just ask for 24-bit context.
2021-02-21 10:31:48 +11:00
Quantum
5ac53362a3 [client] renderer/egl: implement support for rendering help text
The help text is rendered in the bottom left corner on a semi-transparent
background, very similar to how the FPS text is rendered.
2021-02-21 10:31:48 +11:00
Quantum
5dce97264b [client] renderers: add on_help to renderer interface
This will be used to tell a render to display a help message.
2021-02-21 10:31:48 +11:00
Geoffrey McRae
4dfe4b8e2b [client] allow renderers to pass back if they need an OpenGL context 2021-02-21 10:31:48 +11:00
Quantum
9f0b99dac0 [client] wayland: implement window creation for egl
This commit implements window creation and resize logic, allowing the desktop
to be drawn.
2021-02-21 10:31:48 +11:00
Geoffrey McRae
ca5c3938e4 [client] all: move all SDL specific code into displayservers/sdl 2021-02-21 10:31:48 +11:00
Geoffrey McRae
bf583290a4 [client/common] restructure project in prep for full SDL removal 2021-02-21 10:31:46 +11:00
Tudor Brindus
637a7625d2 [client] wayland: allow EGL/OpenGL vsync to be set to on
This effectively reverts 4bceaf5.

Upstream ticket: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4180

Commit 941c651 makes working around the hang in LG itself not as
annoying as before.

In the future, we can bypass this entire issue by implementing our own
swapchain and listening to frame callbacks ourselves.
2021-02-09 09:12:57 +11:00
Geoffrey McRae
9e96156912 [client] egl: use eglGetPlatformDisplay(EXT) if possible 2021-01-25 16:04:33 +11:00
Geoffrey McRae
4c1893fe20 [all] fix numerous memory leaks at application shutdown 2021-01-24 21:47:53 +11:00