Commit Graph

2468 Commits

Author SHA1 Message Date
Quantum
87aac8cf03 [client] egl: use buffer age extension to render only damaged parts
We avoid rendering any area that has not changed since the buffer was used
and also not covered by an overlay.
2021-08-03 21:37:31 +10:00
Quantum
f9977332a6 [client] egl: convert desktop to use desktop_rects 2021-08-03 21:37:31 +10:00
Quantum
2dca056526 [client] egl: refactor damage mesh generation into desktop_rects
This mesh will later be used to render only damaged portions of the desktop.
We also moved the coordinate transformation for damage overlay into a matrix
and computed by the shader.
2021-08-03 21:37:31 +10:00
Quantum
dd31a7ef93 [client] egl: clean up splash background shader 2021-08-03 21:12:46 +10:00
Quantum
a25c93b28e [client] wayland: document wlroots viewport handling workaround
Add a comment so we don't forget and remove the "useless" code.
2021-08-03 21:12:25 +10:00
arcnmx
c0aec7d8f4 [host] nvfbc: disable pointerThread when unused
fixes log spam that would occur when decoupleCursor=false
2021-08-03 21:05:39 +10:00
Geoffrey McRae
03ed8b7304 [client] x11: added code to calibrate a delay for presentation
XPresent doesn't give us the time before presentation, but the time just
after. This code calculates and calibrates a delay to sleep for before
signaling the wait event for render when using jitRender
2021-08-03 07:51:03 +10:00
Geoffrey McRae
504bf02855 [client] x11: provide an empty rect region to XPresentPixmap
Providing None informs the comppositor that there is full screen damage,
instead we provide an empty rectangle to prevent this behaviour.
2021-08-03 07:49:59 +10:00
Geoffrey McRae
4d9ab81ef4 [client] egl: assert the update provdided is a dmabuf 2021-08-03 04:03:37 +10:00
Geoffrey McRae
f3413815a9 [client] egl: re-implement DMABUF (untested) 2021-08-03 03:59:03 +10:00
Netboy3
bae19cb130 [doc] install: Add Overlay Mode section 2021-08-03 01:12:35 +10:00
Netboy3
db501f689f [doc] install: Add $XDG_CONFIG_HOME/looking-glass/client.ini
* Add $XDG_CONFIG_HOME/looking-glass/client.ini to the list of
  config files
* Add a paragraph explaining config load and merge order
2021-08-03 01:12:35 +10:00
Netboy3
b8561cab0a [doc] install: Add win:jitRender command line option 2021-08-03 01:12:35 +10:00
Geoffrey McRae
50f9baedba [client] x11: remove junk code from evaluation 2021-08-03 01:11:46 +10:00
Quantum
5d5e4ede1a [client] egl: use new EGL damage count semantics
After the damage queue PR, EGL damage count 0 means no change, and -1 means
invalidate the entire window. However, several other places have different
semantics, and we are not handling them correctly:

1. KVMFR uses 0 to signal invalidating the entire frame, so if we receive 0
   rectangles in egl_on_frame, we should set damage count to -1.
2. The damage overlay treated 0 as full damage, which is now incorrect. This
   is fixed, and now it treats 0 as no update, and -1 as full damage.
2021-08-03 00:57:32 +10:00
Quantum
8d78a5aa95 [commit] wayland: invalidate window on scale changes
This makes it not require new frames for new scale to be properly applied.
2021-08-03 00:57:04 +10:00
Geoffrey McRae
14839dc54e [client] egl: there should only ever be a single sync object 2021-08-03 00:47:59 +10:00
Geoffrey McRae
7912d268e9 [doc] add libxpresent-dev as a new build dep for the client 2021-08-03 00:04:05 +10:00
Geoffrey McRae
8907a990a1 [github] add libxpresent-dev as a new build dep 2021-08-03 00:03:44 +10:00
Geoffrey McRae
891ee3e789 [client] x11: make use of the x11 present extension for jitRender
This implementation is a bit dodgy and needs some work but is currently
functional. Consider this feature highly experiemental under X11.
2021-08-02 23:59:26 +10:00
Geoffrey McRae
037788f562 [client] egl: do not set ops, this is done in texture.c 2021-08-02 23:42:46 +10:00
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
23c77e8508 [client] egl: use a lock for desktop damage to eliminate all races
There used to be a possible race when a bunch of rectangle is appended, but
the total count is not updated before it's read. Using a lock eliminates
all such races.
2021-08-01 19:54:56 +10:00
Quantum
f08e2ece93 [client] wayland: implement stopWaitFrame 2021-08-01 19:54:28 +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
Quantum
2e4614cbc4 [client] wayland: make waitFrame work when not rendering
Implement skipFrame and do various things to wake waitFrame.
2021-08-01 18:54:55 +10:00
Quantum
16aa04d539 [client] ds: add skipFrame method to interface
If this exists, it should be called when waitFrame returns but we don't
wish to render.
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
f8e1ab8f31 [client] renderers: add new needs_render method to the interface
With jitRender the renderer needs to tell the main application if it
needs to be rendererd, such as during the initial splash screen fade
out.
2021-08-01 18:18:08 +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
b3b71d6f02 [client] egl: fix cursor handling when invalidating
If we invalidate the window, we used to not update this->cursorLast, and
this causes us to lose track of the cursor. Now we update this->cursorLast
unconditionally, and this fixes the issue.
2021-08-01 17:28:40 +10:00
Geoffrey McRae
90b90e667a [common] event: lgResetEvent should return the last state of the event 2021-08-01 17:14:58 +10:00
Geoffrey McRae
a094fb8104 [common] events/linux: fix failure to call pthread_cond_broadcast 2021-08-01 17:13:31 +10:00
Quantum
96bcfff28b [client] wayland: use zxdg_output_manager_v1 version 3 if possible
Version 3 does not send xdg_output.done events, instead guaranteeing that
all xdg_output.* events are sent before wl_output.done. This saves us from
doing the work twice.
2021-08-01 13:05:41 +10:00
Quantum
0ad469178a [client] wayland: make it possible to disable fractional scaling
The method used is not guaranteed to work on all Wayland compositors,
so offer a way out. We need to support it anyways in case xdg_output
or wp_viewporter protocols are not available.
2021-08-01 13:05:41 +10:00
Quantum
b3ca872cef [client] wayland: improve fractional scale handling
Currently, we scale the desktop up to the next largest integer, and rely on
the wayland compositor to scale it back down to the correct size.
This is obviously undesirable.

In this commit, we attempt to detect the actual fractional scaling by finding
the current active mode in wl_output, and dividing it by the logical screen
size reported by xdg_output, taking into consideration screen rotation.

We then use wp_viewporter to set the exact buffer and viewport sizes if
fractional scaling is needed.
2021-08-01 13:05:41 +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
Quantum
b9a7ce17fe [client] egl: use queue of damages
This prevents damage from being overwritten when frames are received
faster than could be rendered.

This implementation cycles between two queues, removing all need for
memory allocation.
2021-08-01 12:11:54 +10:00
Netboy3
2e0f765190 [doc] install: Update overlay mode keybinding 2021-08-01 12:11:02 +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
Quantum
3369536cb8 [common] paths: add library to manage platform-specific paths
This abstracts away stuff like XDG base directory specification.
Currently, this is implemented for Linux only.
2021-07-31 21:11:09 +10:00