After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751835 - backends/native: cursor flicker on some hardware
backends/native: cursor flicker on some hardware
Status: RESOLVED OBSOLETE
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-07-02 13:08 UTC by Olivier Fourdan
Modified: 2021-07-05 13:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
hack to show vsync issues (619 bytes, patch)
2015-07-27 13:13 UTC, Carlos Garnacho
none Details | Review

Description Olivier Fourdan 2015-07-02 13:08:15 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
Comment 1 Olivier Fourdan 2015-07-03 13:32:34 UTC
(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.
Comment 2 Jonas Ådahl 2015-07-03 13:46:44 UTC
(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 .
Comment 3 Carlos Garnacho 2015-07-27 13:13:19 UTC
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 :(
Comment 4 Jasper St. Pierre (not reading bugmail) 2015-09-24 16:12:42 UTC
(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.
Comment 5 GNOME Infrastructure Team 2021-07-05 13:50:20 UTC
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.