aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
Diffstat (limited to 'backend/x11')
-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;
}