aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-12-30 10:19:50 +0100
committerSimon Ser <contact@emersion.fr>2020-12-30 19:37:19 +0100
commit1491ec42daf942350727fe6e158ac6ead669f643 (patch)
treee9d69b6d47da803e93a6f2b54f7943f044209703 /backend
parent4b03bdc3ab0cb1a0296c4d48b125f15a07ca99bd (diff)
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
Diffstat (limited to 'backend')
-rw-r--r--backend/x11/backend.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 11cc4fa9..cd607e16 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -7,6 +7,7 @@
#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;
}