GNOME Bugzilla – Bug 751835
backends/native: cursor flicker on some hardware
Last modified: 2021-07-05 13:50:20 UTC
On Wayland, the hardware cursor flickers when updated on some (but not) all intel hardware (I can reproduce on my x61 with a 8086:2a02 Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller). Switching to GL to draw the cursor makes the problem go away so suspected an issue with drm/dri but Weston with hardware cursor enabled [1] does not show any flickering. The issue occurs when the cursor is changed, and for some reason that I have not investigated yet, the cursor is updated constantly even if noit chnaged on gtk+ apps (try the resize edges or even the titlebar), thus causing the flickering. Additional info: I tried the patch from bug 749913 but these make no difference here. Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1235362 [1] Note that Weston has disabled hardware cursor by default http://cgit.freedesktop.org/wayland/weston/commit/?id=685838
(In reply to Olivier Fourdan from comment #0) > The issue occurs when the cursor is changed, and for some reason that I have > not investigated yet, the cursor is updated constantly even if not changed > on gtk+ apps (try the resize edges or even the titlebar), thus causing the > flickering. A new cursor is created at every single pointer event: meta_wayland_pointer_update () +> repick_for_event() +> meta_wayland_pointer_update_cursor_surface() +> meta_cursor_reference_from_buffer() <- new cursor alloc'ed +> meta_cursor_tracker_set_window_cursor() +> sync_cursor() +> meta_cursor_renderer_set_cursor() +> update_cursor() +> meta_cursor_renderer_native_update_cursor() +> update_hw_cursor() So even though meta_cursor_renderer_set_cursor() checks first if displayed_cursor == cursor, as a new cursor is alloc'ed at each pointer event, this test is always defeated and the hardware cursor always updated for every single pointer event.
(In reply to Olivier Fourdan from comment #1) > (In reply to Olivier Fourdan from comment #0) > > The issue occurs when the cursor is changed, and for some reason that I have > > not investigated yet, the cursor is updated constantly even if not changed > > on gtk+ apps (try the resize edges or even the titlebar), thus causing the > > flickering. > > A new cursor is created at every single pointer event: > > meta_wayland_pointer_update () > +> repick_for_event() > +> meta_wayland_pointer_update_cursor_surface() > +> meta_cursor_reference_from_buffer() <- new cursor alloc'ed > +> meta_cursor_tracker_set_window_cursor() > +> sync_cursor() > +> meta_cursor_renderer_set_cursor() > +> update_cursor() > +> meta_cursor_renderer_native_update_cursor() > +> update_hw_cursor() > > So even though meta_cursor_renderer_set_cursor() checks first if > displayed_cursor == cursor, as a new cursor is alloc'ed at each pointer > event, this test is always defeated and the hardware cursor always updated > for every single pointer event. Yea, I have seen that is how it works. My plan was to couple wl_surface and the cursor spite more tightly, and then only update when new buffers are committed. I had plans of looking into that after the first part was done. See https://bugzilla.gnome.org/show_bug.cgi?id=744932 .
Created attachment 308213 [details] [review] hack to show vsync issues Another thing worth pointing out here is that we call drmModeSetCursor2() immediately after receiving the surface, so the cursor is changed out of sync. This causes visible artifacts with animated cursors (eg. the clock cursors on the "cursors" gtk3-demo), and is a lot more visible if we paint whole cursor area (like in the hack patch attached). Seeing the weston code, the cursor is changed right after the compositor requests a page flip, something AFAICS we can't easily do through clutter/cogl :(
(In reply to Carlos Garnacho from comment #3) > Seeing the weston code, the cursor is changed right after the compositor > requests a page flip, something AFAICS we can't easily do through > clutter/cogl :( We need to switch to atomic modesetting, obviously. I believe Ray had a WIP branch to get Cogl out of modesetting which he started for render node support.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.