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 792643 - Threaded swap wait + nVidia prop driver + CLUTTER_VBLANK=none freezes screen
Threaded swap wait + nVidia prop driver + CLUTTER_VBLANK=none freezes screen
Status: RESOLVED OBSOLETE
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2018-01-18 14:09 UTC by Maik Freudenberg
Modified: 2018-08-09 10:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to disable threaded swap wait (524 bytes, patch)
2018-01-18 14:09 UTC, Maik Freudenberg
rejected Details | Review
conditionally disable threaded swap wait (739 bytes, patch)
2018-08-08 17:38 UTC, Maik Freudenberg
none Details | Review

Description Maik Freudenberg 2018-01-18 14:09:12 UTC
Created attachment 367017 [details] [review]
patch to disable threaded swap wait

Having
- Nvidia proprietary driver installed
- nvidia-drm.modeset=1 set
- VBLANK_CLUTTER=none set
- mutter-3.24.0 up to 3.26.2 tested
leads to frozen screen, i.e. no further screen updates occur. No crashes, mutter reacts to ctrl+c, running fine.
I suspect the threaded swap wait introduction:
https://bugzilla.gnome.org/show_bug.cgi?id=779039

Setting
cogl_xlib_renderer_set_threaded_swap_wait_enabled (cogl_renderer, FALSE);
in src/backends/x11/meta-renderer-x11.c reverts to normal operation.
Comment 1 Florian Müllner 2018-01-18 15:42:57 UTC
Comment on attachment 367017 [details] [review]
patch to disable threaded swap wait

That API was added specifically for the proprietary Nvidia driver, so if we wanted to disable it, the patch should remove the feature altogether rather than leaving an unused API around.

But rather than working around a bug by disabling the fallback implementation, actually fixing the issue would be much better.
Comment 2 Florian Müllner 2018-01-18 15:43:12 UTC

*** This bug has been marked as a duplicate of bug 781835 ***
Comment 3 Maik Freudenberg 2018-01-20 17:00:25 UTC
The patch wasn't meant as fix/workaround but to show that there are more problems with the vsync code than the threaded swap wait changes.
Simply put,IIRC, CLUTTER_VBLANK=none sets hasTimer to false. The wait changes are only in parts where
if hasTimer==true
So the threaded swap wait code should never be reached if the code that has previously been there was correct. Yet turning it off has the effect of making it work again instead of doing a threaded wait for Godot.
Fixing this is of course preferred but this is seriously getting harder as more code (-paths) getting added.
Comment 4 Maik Freudenberg 2018-08-08 17:37:12 UTC
I would kindly ask to undupe this bug report as I looked into this and found the logic error that leads to this specific issue.
The threaded swap wait emulates glx_intel_swap_event on Nvidia hardware using an extra thread (threaded_swap_wait) using glXWaitVideoSync to wait for vsync and then emit a swap_event.
Thus the implementation sets COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT to true. While this works when sync to vblank thus framebuffer->config.swap_throttled is true, in the case of CLUTTER_VBLANK=none framebuffer->config.swap_throttled is set to false which disables threaded_swap_wait so no events are ever emitted. Yet, COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT is still set so waits for events that never happen.
So the swap_event emulation only works in the sync'd case and while in theory it would be a cleaner approach to extend that to the unsync'd case in practice that would be just a waste of cycles, emitting continuously swap_events (I don't think that's possible anyway btw.).
So attaching a patch taking a more rational approach to disable it conditionally in the unsync'd case.
Comment 5 Maik Freudenberg 2018-08-08 17:38:08 UTC
Created attachment 373289 [details] [review]
conditionally disable threaded swap wait
Comment 6 Jonas Ådahl 2018-08-09 09:55:23 UTC
Note that the ability to disable sync-to-vblank is being removed (it was mostly a clutter application feature not really relevant to compositors). See https://gitlab.gnome.org/GNOME/mutter/merge_requests/191/ .
Comment 7 Maik Freudenberg 2018-08-09 10:25:11 UTC
Ok, your decision.
This finally makes mutter using the proprietary nvidia driver completely unusable.
- The threaded swap wait makes gnome-shell use 30% cpu just moving the mouse
- sync to vblank makes window movement like moving in honey.
Known problems for up to years.
Grrrreat experience.
Closing this.