wlr_scene: fix fullscreen app stuttering when screensharing

Problem: The wlroots implementation of wlr_screencopy applys a lock for
a brief duration every time a frame is captured. If an output is
eligible for direct scanout then this will result in direct scanout
being rapidly toggled on and off since the lock count constantly flips
between 0 and 1. On some hardware this causes stuttering every time
direct scanout is enabled then disabled.

Solution: To mitigate this we wait for there to be 0 locks for 120
frames so that we can be relatively confident that screen recording has
stopped before we re-enable direct scanout.
This commit is contained in:
Gabriel Ford 2025-10-12 14:47:23 -04:00
parent 19c5d22beb
commit 06d3d48aa2
3 changed files with 20 additions and 1 deletions

View file

@ -248,6 +248,8 @@ struct wlr_output {
int attach_render_locks; // number of locks forcing rendering
int frames_since_locked;
struct wl_list cursors; // wlr_output_cursor.link
struct wlr_output_cursor *hardware_cursor;
struct wlr_swapchain *cursor_swapchain;