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 770020 - wayland mutter hw mouse cursor invisible
wayland mutter hw mouse cursor invisible
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
3.20.x
Other Linux
: Normal major
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-08-17 04:34 UTC by memeka
Modified: 2017-03-29 03:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cursor-renderer-native: fallback to texture cursor (1.53 KB, patch)
2017-03-24 21:18 UTC, Jente Hidskes
none Details | Review
cursor-renderer-native: fallback to texture cursor (3.03 KB, patch)
2017-03-27 17:03 UTC, Jente Hidskes
none Details | Review
cursor-renderer-native: fallback to texture cursor (3.10 KB, patch)
2017-03-27 17:10 UTC, Jente Hidskes
committed Details | Review

Description memeka 2016-08-17 04:34:08 UTC
When starting mutter (from tty1 as wayland display manager) hardware cursor is invisible.
Issue seems to be in set_crtc_cursor function, where drmModeSetCursor2 fails with the error:

drmModeSetCursor2 failed: No such device or address

IRC log:
jadahl> memeka: good to know. I guess it would be good to trigger the texture based falback if that happens
Comment 1 Jente Hidskes 2017-03-24 21:18:49 UTC
Created attachment 348676 [details] [review]
cursor-renderer-native: fallback to texture cursor

As discussed with Carlos over IRC, this patch triggers the fallback texture cursor in case drmModeSetCursor2 fails.
Comment 2 Jonas Ådahl 2017-03-27 09:23:59 UTC
Review of attachment 348676 [details] [review]:

::: src/backends/native/meta-cursor-renderer-native.c
@@ +189,3 @@
+                             priv->cursor_width, priv->cursor_height, hot_x, hot_y) < 0)
+        {
+          priv->has_hw_cursor = FALSE;

As we can (probably, I'd say) assume that drmModeSetCursor2() will not work at all, we should also make sure we don't try to memcpy every cursor into a gbm buffer then fail to syscall-set it each time after this.

Because, with this, we'd still try every single time, then fail every single time. So, to avoid the future known failed syscalls, and wasted allocs and memcpys, you can add a "broken" state to the priv, and check that state in should_have_hw_cursor() and ..._realize().
Comment 3 Jente Hidskes 2017-03-27 17:03:38 UTC
Created attachment 348815 [details] [review]
cursor-renderer-native: fallback to texture cursor

As discussed with Carlos over IRC, this patch triggers the fallback texture cursor in case drmModeSetCursor2 fails.

As suggested by Jonas, it adds a `broken` state, that is checked in should_have_hw_cursor() and meta_cursor_renderer_native_realize_cursor_from_*() to avoid copying every cursor into a gbm buffer when we know it will fail every single time.
Comment 4 Jente Hidskes 2017-03-27 17:10:43 UTC
Created attachment 348816 [details] [review]
cursor-renderer-native: fallback to texture cursor

Previous patch doesn't build; it doesn't contain my last change.

As discussed with Carlos over IRC, this patch triggers the fallback texture cursor in case drmModeSetCursor2 fails.

As suggested by Jonas, it adds a `broken` state, that is checked in should_have_hw_cursor() and meta_cursor_renderer_native_realize_cursor_from_*() to avoid copying every cursor into a gbm buffer when we know it will fail every single time.
Comment 5 Jonas Ådahl 2017-03-28 02:18:00 UTC
Review of attachment 348816 [details] [review]:

Looks good. A bonus follow up would be to clean up the gbm buffers now already, but this will AFAICS fix the issue. Could also consider adding a g_warning() there, to make the user potentially aware that their cursor is not drawn with the cursor plane.
Comment 6 Jente Hidskes 2017-03-28 08:55:23 UTC
Since you marked the patch as accepted-commit_now, can I / am I expected to make these changes?
Comment 7 Jonas Ådahl 2017-03-28 09:23:28 UTC
I suspect you don't have commit access to mutter at this stage, so I'll land them for you.
Comment 8 Jente Hidskes 2017-03-28 09:25:21 UTC
Indeed I don't, thanks for merging them for me!
Comment 9 Jonas Ådahl 2017-03-29 03:17:45 UTC
Attachment 348816 [details] pushed (with a minor whitespace change) as 0d5274b - cursor-renderer-native: fallback to texture cursor