about summary refs log tree commit diff
path: root/overlays/patches/wlroots-displaylink
diff options
context:
space:
mode:
Diffstat (limited to 'overlays/patches/wlroots-displaylink')
-rw-r--r--overlays/patches/wlroots-displaylink/DisplayLink_v2.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/overlays/patches/wlroots-displaylink/DisplayLink_v2.patch b/overlays/patches/wlroots-displaylink/DisplayLink_v2.patch
new file mode 100644
index 0000000..dcdef7a
--- /dev/null
+++ b/overlays/patches/wlroots-displaylink/DisplayLink_v2.patch
@@ -0,0 +1,48 @@
+diff --git a/render/egl.c b/render/egl.c
+index 8a1e6dae..d0e6adb6 100644
+--- a/render/egl.c
++++ b/render/egl.c
+@@ -508,8 +508,43 @@ static int open_render_node(int drm_fd) {
+ 		}
+ 		wlr_log(WLR_DEBUG, "DRM device '%s' has no render node, "
+ 			"falling back to primary node", render_name);
++
++		drmVersion *render_version = drmGetVersion(drm_fd);
++		if (render_version != NULL && render_version->name != NULL) {
++			wlr_log(WLR_DEBUG, "DRM device version.name '%s'", render_version->name);
++			if (strcmp(render_version->name, "evdi") == 0) {
++				free(render_name);
++
++				uint32_t flags = 0;
++				const int devices_len = drmGetDevices2(flags, NULL, 0);
++				if (devices_len < 0) {
++					wlr_log(WLR_ERROR, "drmGetDevices2 failed: %s", strerror(-devices_len));
++					return -1;
++				}
++
++				const char *render_devices[] = {
++					"/dev/dri/card0",
++					"/dev/dri/card1",
++					"/dev/dri/card2",
++					"/dev/dri/card3",
++					"/dev/dri/card4",
++					"/dev/dri/card5",
++					"/dev/dri/card6",
++					"/dev/dri/card7",
++					"/dev/dri/card8",
++					"/dev/dri/card9",
++					NULL
++				};
++
++				render_name = malloc(sizeof(char)*15);
++				render_name = strcpy(render_name, render_devices[env_parse_switch("WLR_EVDI_RENDER_DEVICE", render_devices)]);
++			}
++			drmFreeVersion(render_version);
++		}
+ 	}
+
++	wlr_log(WLR_DEBUG, "open_render_node() DRM device '%s'", render_name);
++
+ 	int render_fd = open(render_name, O_RDWR | O_CLOEXEC);
+ 	if (render_fd < 0) {
+ 		wlr_log_errno(WLR_ERROR, "Failed to open DRM node '%s'", render_name);