backend/x11: always open render node
If we get an authenticated primary node from the X11 server, don't use it because we can't authenticate our Wayland clients with it. Instead, open a render node. Closes: https://github.com/swaywm/wlroots/issues/2576
This commit is contained in:
parent
4b03bdc3ab
commit
1491ec42da
|
@ -7,6 +7,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <xf86drm.h>
|
||||||
|
|
||||||
#include <wlr/config.h>
|
#include <wlr/config.h>
|
||||||
|
|
||||||
|
@ -268,6 +269,23 @@ static int query_dri3_drm_fd(struct wlr_x11_backend *x11) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (drmGetNodeTypeFromFd(drm_fd) != DRM_NODE_RENDER) {
|
||||||
|
char *render_name = drmGetRenderDeviceNameFromFd(drm_fd);
|
||||||
|
if (render_name == NULL) {
|
||||||
|
close(drm_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(drm_fd);
|
||||||
|
drm_fd = open(render_name, O_RDWR | O_CLOEXEC);
|
||||||
|
if (drm_fd < 0) {
|
||||||
|
free(render_name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(render_name);
|
||||||
|
}
|
||||||
|
|
||||||
return drm_fd;
|
return drm_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue