Commit Graph
487 Commits
Author SHA1 Message Date
Geoffrey McRae 13d9c84dc9 [client] egl: replace monolithic EGLTexture with modular version
The way things were handled in EGLTexture is not only very hard to
follow, but broken. This change set breaks up EGLTexture into a modular
design making it easier to implement the various versions.

Note that DMABUF is currently broken and needs to be re-implemented.
2021-08-02 23:37:33 +10:00
Geoffrey McRae e23144aecd [client] overlay: add new needs_render for realtime overlays 2021-08-01 21:13:59 +10:00
Quantum f64310320a [client] ds: add stopWaitFrame to terminate waitFrame early
This is used on exit to unblock the render thread.
2021-08-01 19:54:28 +10:00
Geoffrey McRae 695b7b793c [client] main: allow 'catchup' when using jitRender 2021-08-01 19:32:01 +10:00
Quantum 986f92d0db [client] main: use skipFrame and signal frameEvent
We need to signal frameEvent to render the first frame. Otherwise, wayland
fails to configure the window, as configuration happens in EGL swap.
2021-08-01 18:54:55 +10:00
Geoffrey McRae 9d95154b85 [client] main: make use of new needs_render call 2021-08-01 18:44:35 +10:00
Geoffrey McRae 2d74c93232 [client] main: alerts and overlay toggles should invalidate the window 2021-08-01 18:04:43 +10:00
Geoffrey McRae 17687fdea3 [client] main: only render if there is actually something to render 2021-08-01 17:39:52 +10:00
Quantum 77b3d45e0e [client] ds: change signalNextFrame to waitFrame 2021-08-01 17:29:15 +10:00
Quantum 37196f1f0e [client] config: disable JIT rendering by default
Without configuring Wayland compositors to send frame callbacks as late as
possible, JIT rendering can increase latency by more than one frame.

For example, by default, sway asks applications to render right after a
vblank, and does its own composition right after a vblank, resulting in
~2 frame's worth of latency. If max_render_time is set on the output,
it composes that many milliseconds before the vblank, losing ~1 frame's
worth of latency. If max_render_time is set on the window also, the frame
callback is sent that many milliseconds before composition, and we achieve
perfectly low latency.

Therefore, out of the box, JIT rendering should not be enabled, as manual
compositor configuration is required for optimal results.

For reference, the following sway settings results in the best latency:

    output <insert output name> max_render_time 1
    for_window [app_id="looking-glass-client"] max_render_time 1

This reverts commit 3baed05728.
2021-08-01 17:29:00 +10:00
Quantum 3baed05728 [client] config: enable JIT rendering by default 2021-08-01 12:38:17 +10:00
Quantum aed370c7ce [client] main: implement just-in-time render mode
When requested, JIT render mode will be used if the display server supports it.
Otherwise, a warning is generated instead.

This essentially uses the signalNextFrame logic for imgui, but for everything.
We automatically enable this mode when overlay is on.

Currently, this exposes some damage tracking bugs in the EGL renderer.
2021-08-01 12:24:19 +10:00
Geoffrey McRae 66df99f5fd [client] imgui: don't free the IniFilename until imgui destruction 2021-08-01 00:55:36 +10:00
Quantum 7c3c68b84b [client] imgui: put imgui.ini in $XDG_CONFIG_DIR/looking-glass 2021-07-31 21:19:26 +10:00
Quantum 6109067275 [client] config: load config file based on new lgConfigDir() 2021-07-31 21:11:09 +10:00
Geoffrey McRae fcbd255e99 [client] app: allow overlay exit with KEY_ESC 2021-07-31 20:51:38 +10:00
Geoffrey McRae f49948506b [client] move imgui input state reset to it's own core function 2021-07-31 20:51:08 +10:00
Geoffrey McRae a11a20411b [client] overlay: disable the imgui demo window 2021-07-31 20:32:06 +10:00
Geoffrey McRae 5e2f1b3fac [client] overlay/help: do not always show when in overlay mode 2021-07-31 20:30:52 +10:00
Geoffrey McRae 75a14b8b45 [client] overlay/graphs: allow the window position and size to be saved
This change allows the window position and size to be changed, and
saved/loaded by imgui. Additionally the plots will now scale to the
window size.
2021-07-31 20:21:34 +10:00
Geoffrey McRae b0c1714777 [client] overlay/fps: allow the window posisiton to be saved 2021-07-31 20:21:17 +10:00
Geoffrey McRae 361ead59d3 [client] overlay/help: use the interactive argument 2021-07-31 19:14:58 +10:00
Geoffrey McRae 41c5688fca [client] overlay: let the overlay know if it's in interactive mode
This also removes the need for the flags member as the overlay can just
opt to not render if it's not in interactive mode.
2021-07-31 19:11:40 +10:00
Quantum c8dc037e94 [client] imgui: use signalNextFrame if possible
This allows imgui to be rendered at screen refresh rate for supported display
server backends.
2021-07-31 19:05:21 +10:00
Geoffrey McRae 9959578cbe [client] app: prevent buttons/keys from being held when focus is lost 2021-07-31 16:40:14 +10:00
Geoffrey McRae 971e91238a [client] main: bump the minimum fps to 60fps when showing the overlay 2021-07-31 16:19:55 +10:00
Geoffrey McRae 8898496eba [client] imgui: respect WantCaptureKeyboard
If the overlay is active and imgui has set WantCaptureKeyboard we should
ignore the escape key sequences.
2021-07-31 15:55:58 +10:00
Geoffrey McRae 7eb00bd24c [client] app: update imgui key release when guest input is disabled 2021-07-31 15:41:21 +10:00
Geoffrey McRae a098bab114 [client] overlay: allow the fps and graph windows to be moved 2021-07-31 15:35:53 +10:00
Quantum 75e57baf6c [client] config: optionally load config from XDG_CONFIG_HOME
We look for the client config in $XDG_CONFIG_HOME/looking-glass/client.ini.
This is done because it's more conventional, and also allows us to add
additional configuration files, e.g. for the host.

We fallback to $HOME/.config as is standard, and then as a last resort use
getpwuid(getuid())->pw_dir. This is also recommended by the getpwuid manpage:

> An application that wants to determine its user's home directory should
> inspect the value of HOME (rather than the value getpwuid(getuid())->pw_dir)
> since this allows the user to modify their notion of "the home directory"
> during a login session.
2021-07-31 15:06:59 +10:00
Quantum 68d8d95266 [client] config: do not attempt to load non-files as config
Currently, we load /etc/looking-glass-client.ini and/or
~/.config/looking-glass-client.ini as long as they exist, even if they are
not files. We should only load them if they are files.
2021-07-31 15:06:37 +10:00
Quantum 7d78cba38c [client] client: release escape key on focus loss
This prevents the escape key from being treated as held down indefinitely when
losing focus while holding the escape key.
2021-07-31 15:02:57 +10:00
Quantum b8b70e772e [client] config: print error when app:configFile is not a valid file
This makes it clear to the user that app:configFile is at fault.
2021-07-31 14:59:00 +10:00
Quantum 64c906b801 [client] main: prevent the user from launching looking glass as setuid
We don't want to encourage craziness of people making the client suid to
bypass permission issues on the shm file.

Note: I see no evidence of this happening in the wild, but let's be
proactive.
2021-07-31 14:58:48 +10:00
Quantum 7ca5e14938 [client] imgui: implement mouse wheel motion support
The display server should call app_handleWheelMotion as necessary.
2021-07-31 14:58:35 +10:00
Quantum 86b50cc8ab [client] imgui: initialize keymap
This allows ImGui to understand some of the basic key presses.

Also moved the include guard from kb.c to kb.h where it actually makes sense.
2021-07-31 14:57:41 +10:00
Quantum 10a27e7a27 [client] config: automatically update embedded copyright string
The refresh-copyright script now automatically updates the copyright string
embedded in config.c. In order to achieve this, refresh-copyright gained the
ability to reflow text as the situation needs.
2021-07-31 14:57:24 +10:00
Quantum edabd1bae7 [client] imgui: remove no longer used overlay_utils.cpp 2021-07-31 14:56:49 +10:00
Quantum f1b1da60ea [client] imgui: improve method for high DPI
We now give ImGui the true logical size of the window and tell it to scale
the framebuffer. To fix the blurry fonts, we continue to load fonts at the
scale necessary for the DPI and use FontGlobalScale to shrink the fonts back
to the logical size. The font rectangle is then expanded by the framebuffer
scaling, resulting in good text rendering.

This method has the advantage of not messing up the sizes of resizable
overlays when moving across monitors.
2021-07-31 14:56:49 +10:00
Quantum 0402dd521a [client] imgui: ask display server to display cursors 2021-07-31 14:56:04 +10:00
Quantum da28db2ca4 [client] ds: change showPointer to setPointer for more cursors
Currently everything only supports LG_POINTER_NONE and LG_POINTER_SQUARE.
2021-07-31 14:56:04 +10:00
Quantum c991de7ccd [client] imgui: improved overlay input handling
1. Overlay always releases confines.
2. Overlay turns off mouse sync with guest.
2021-07-31 14:54:53 +10:00
Quantum ea2651e39b [client] imgui: darken background when rendering overlays
This replaces the alert that says whether the overlay is enabled or not.

Also, we now always display the help menu in overlay mode.
2021-07-29 19:10:15 +10:00
Quantum 1c58b3a087 [client] imgui: implement keyboard input forwarding and capture 2021-07-29 17:02:59 +10:00
Quantum 065d90c3f7 [client] imgui: add mode to forward mouse input to imgui 2021-07-29 17:02:59 +10:00
Quantum 134829cbf2 [client] imgui: make graph y-axis configurable
The default of [0, 50] makes sense for FPS/UPS graphs, but does not for
things like the import graph. The latter should not take more than 5 ms
for sure.

This commit allows the min/max y-axis value to be specified when registering
the graph.
2021-07-29 15:54:15 +10:00
Quantum 6ed1f4662d [client] imgui: report failed font atlas building
Also removed the inefficient code to build the default atlas.
2021-07-26 17:08:02 +10:00
Geoffrey McRae 2ef80a5d34 [client] overlay: cosmetic changes to the overlay display 2021-07-25 16:49:25 +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
Geoffrey McRae 8c2a77e84e [client] don't skip the first frame if we do not yet have a frame
A frame serial of `0` is valid and will happen if either the host app
has just started, or the serial has overflowed.
2021-07-25 15:10:40 +10:00