forge
Explore
Log in

Don't you dare go Hollow

Add debug option to skip cursor-only updates while VRR is active (#1616)

Browse files at this commit

a7186a0441fe866784a601c6192850267802dca5UnverifiedGwen and Ivan MolodetskikhParent: 1911cf3
* Add debug option to skip cursor-only updates while VRR is active

* Update niri-config/src/lib.rs

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>

* Update src/backend/tty.rs

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>

* Update wiki/Configuration:-Debug-Options.md

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>

* Update Configuration:-Debug-Options.md

* Update tty.rs

* Update lib.rs

* Update Configuration:-Debug-Options.md

---------
niri-config/src/lib.rsmodified+3 -0
@@ -2329,6 +2329,8 @@ pub struct DebugConfig {
2329 pub strict_new_window_focus_policy: bool,2329 pub strict_new_window_focus_policy: bool,
2330 #[knuffel(child)]2330 #[knuffel(child)]
2331 pub honor_xdg_activation_with_invalid_serial: bool,2331 pub honor_xdg_activation_with_invalid_serial: bool,
2332+ #[knuffel(child)]
2333+ pub skip_cursor_only_updates_during_vrr: bool,
2332 }2334 }
2333 2335
2334 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)]2336 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)]
@@ -5286,6 +5288,7 @@ mod tests {
5286 disable_monitor_names: false,5288 disable_monitor_names: false,
5287 strict_new_window_focus_policy: false,5289 strict_new_window_focus_policy: false,
5288 honor_xdg_activation_with_invalid_serial: false,5290 honor_xdg_activation_with_invalid_serial: false,
5291+ skip_cursor_only_updates_during_vrr: false,
5289 },5292 },
5290 workspaces: [5293 workspaces: [
5291 Workspace {5294 Workspace {
src/backend/tty.rsmodified+6 -0
@@ -1422,6 +1422,12 @@ impl Tty {
1422 if debug.disable_cursor_plane {1422 if debug.disable_cursor_plane {
1423 flags.remove(FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT);1423 flags.remove(FrameFlags::ALLOW_CURSOR_PLANE_SCANOUT);
1424 }1424 }
1425+ if debug.skip_cursor_only_updates_during_vrr {
1426+ let output_state = niri.output_state.get(output).unwrap();
1427+ if output_state.frame_clock.vrr() {
1428+ flags.insert(FrameFlags::SKIP_CURSOR_ONLY_UPDATES);
1429+ }
1430+ }
1425 1431
1426 flags1432 flags
1427 };1433 };
wiki/Configuration:-Debug-Options.mdmodified+17 -0
@@ -29,6 +29,7 @@ debug {
29 disable-monitor-names29 disable-monitor-names
30 strict-new-window-focus-policy30 strict-new-window-focus-policy
31 honor-xdg-activation-with-invalid-serial 31 honor-xdg-activation-with-invalid-serial
32+ skip-cursor-only-updates-during-vrr
32 }33 }
33 34
34 binds {35 binds {
@@ -275,6 +276,22 @@ debug {
275 }276 }
276 ```277 ```
277 278
279+### `skip-cursor-only-updates-during-vrr`
280+
281+<sup>Since: next release</sup>
282+
283+Skips redrawing the screen from cursor input while variable refresh rate is active.
284+
285+Useful for games where the cursor isn't drawn internally to prevent erratic VRR shifts in response to cursor movement.
286+
287+Note that the current implementation has some issues, for example when there's nothing redrawing the screen (like a game), the rendering will appear to completely freeze (since cursor movements won't cause redraws).
288+
289+```kdl
290+debug {
291+ skip-cursor-only-updates-during-vrr
292+}
293+```
294+
278 ### Key Bindings295 ### Key Bindings
279 296
280 These are not debug options, but rather key bindings.297 These are not debug options, but rather key bindings.