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:
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
+#include <xf86drm.h>
#include <wlr/config.h>
@@ -268,6 +269,23 @@ static int query_dri3_drm_fd(struct wlr_x11_backend *x11) {
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;
}
