Cloudef / wlc

High-level Wayland compositor library
MIT License
330 stars 58 forks source link

x11 crashes when switching from the wlc vt back to x11 vt #217

Open raboof opened 7 years ago

raboof commented 7 years ago

When running a wlc-based session on vt1 and x11 on vt7, using nouveau as the display driver, switching from vt1 to vt7 crashes x11. The Xorg.log reveals:

modeset(0): drmSetMaster failed: Invalid argument
modeset(0): failed to set mode: Permission denied

It seems only one program can be DRM master at a time, and the wlc-based session hasn't given up its control before nouveau tried to get it. Indeed, when I switch from vt1 to vt2 (giving it time to release DRM master) and then to vt7, x11 does not crash.

In the wlc sources I do see some drmDropMaster in sensible places, but looking with gdb it doesn't seem to be ever called - not even in the 'successful' case where I go via vt2.

(I originally encountered this issue with way-cooler (https://github.com/Immington-Industries/way-cooler/issues/190) but can also reproduce it with orbment, leading to think this is a wlc issue)

Cloudef commented 7 years ago

In the wlc sources I do see some drmDropMaster in sensible places, but looking with gdb it doesn't seem to be ever called - not even in the 'successful' case where I go via vt2.

This sounds interesting. AFAIK the calls should always be before TTY switch signal is sent to kernel.

raboof commented 7 years ago

I did some more digging but don't have final conclusions yet.

I'm using logind, wlc correctly sees that and goes into the logind code instead of the tty code.

Looking at the logind code (and learning about VT switching :) ) I see some code that looks like it should do the right thing, but poking around with gdb/printf statements reveals in my case this code doesn't seem to be called at all.

I'm still kind of confused what's going on, I wrote up my observations and asked for help at https://plus.google.com/110534994903711886928/posts/GgVKKtU5d1u