michaelforney / swc

a library for making a simple Wayland compositor
MIT License
616 stars 52 forks source link

Could not become DRM master #16

Closed tjaartvdwalt closed 9 years ago

tjaartvdwalt commented 9 years ago

Hi,

I am new to swc. When I try to run the example wm I get an error: I run the command:

 swc-launch example/wm

The error is:

[swc:libswc/drm.c:186] DEBUG: /dev/dri/card0 is the primary GPU
Could not become DRM master: Invalid argument
[swc:libswc/drm.c:313] ERROR: Could not open DRM device at /dev/dri/card0
[swc:libswc/swc.c:118] ERROR: Could not initialize DRM
Server exited with status 1
Restoring VT to original state

After some digging it seems the error comes from the sendmsg() call in launch/protocol.c (line 40) returning the "Invalid argument" error code. I am not sure if I am doing something wrong here.

michaelforney commented 9 years ago

swc requires a drm driver, and it looks like you don't have that. What kind of GPU are you using? If you are in a VM, I believe there are projects to add a DRM driver (virgil3d is the latest one I think).

tjaartvdwalt commented 9 years ago

Thanks for the quick reply. I am trying to run swc directly on my laptop, not in a VM. I have a Radeon HD 7610M graphics card, and I am running the open source drivers (xf86-video-ati). I also have the ati-dri package installed.

After I configured this I tested if direct rendering is working:

glxinfo | grep rendering
direct rendering: Yes
michaelforney commented 9 years ago

Is swc-launch owned by root and setuid? Are you running swc-launch from a VT or an X session? The error is because swc-launch opened the DRM device but was unable to become master (this means that some other process did not release it).

When swc-launch starts, it allocates a new VT and switches to it. By this point, any other process that was master will have received a signal that it needs to release the display and should have dropped its master privileges. If it doesn't, there isn't much that swc can do about that.

augustoborn commented 9 years ago

Hi, thanks for your efforts to bring suckless to Wayland!

I'm also having trouble launching velox with swc-launch, and my problem seems related to this one. I get:

[swc:libswc/drm.c:169] DEBUG: /dev/dri/card0 is the primary GPU
# find_driver: Trying DRM driver `intel'
# find_driver: Trying DRM driver `nouveau'
[swc:libswc/drm.c:302] ERROR: Could not create WLD DRM context
[swc:libswc/swc.c:119] ERROR: Could not initialize DRM
Server exited with status 1
Restoring VT to original state

I'm doing swc-launch -- /usr/bin/velox from a VT, when X is not running. I'm using the nouveau driver. I've tried this both as root and as my user. swc-launch belongs to root.root and is setuid.

Any pointers?

EDIT: I just dug into the code and realized the issue is that there is no support for Tesla (NV50) in wld. I'll keep poking around and see if I can make progress in that area. Sorry for the hijack.

actionless commented 9 years ago

have the same problem.

$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation G98M [Quadro NVS 160M] (rev a1)
$ glxinfo | grep rendering
direct rendering: Yes
$ ll (which swc-launch)
-rwsr-xr-x 1 root root 19K Jan  9 01:20 /usr/sbin/swc-launch*

swc-launch weston works fine

rr- commented 9 years ago

I just asked related question on SO.

tjaartvdwalt commented 9 years ago

I am closing this issue.

I ended up writing Weston plugin instead of using swc.