michaelforney / swc

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

DRM device minor node number assumption is incorrect on intel systems? #46

Closed jnjackins closed 5 years ago

jnjackins commented 6 years ago

Hi,

I'm hitting this error when I run swc-launch velox: https://github.com/michaelforney/swc/blob/master/libswc/drm.c#L286

if (master.st_mode != render.st_mode || minor(master.st_rdev) + 0x80 != minor(render.st_rdev)) {
        ERROR("Render node does not have expected mode or minor number\n");
        goto error1;
    }

On my system, /dev/dri/renderD128 has major/minor numbers 226, 128, but /dev/dri/card0 is 226, 0,

If I remove the check, velox seems to start up just fine. I also found this mail, which seems to describe the issue better: https://lists.freedesktop.org/archives/intel-gfx/2015-October/078894.html

Unlike the poster above, I'm not running on ARM or anything exotic at all, just a run-of-the-mill Dell laptop.

Not sure what the right thing to do here, but wanted to at least log an issue in case others are running into the same problem.

michaelforney commented 6 years ago

Thanks for the report. The mail you linked to suggests a libdrm interface: drmGetRenderDeviceNameFromFd.

I think swc be updated to use that instead of guessing based on the master major and minor numbers.

However, I'm a bit confused that the check doesn't work for you since 226 == 226, and 0 + 0x80 == 128. Though regardless of this, if there is an API in libdrm, we should use it.