From 8218f368d771fb763bb53a5c91add4d278a67dae Mon Sep 17 00:00:00 2001 From: sefidel Date: Wed, 15 Nov 2023 23:26:23 +0900 Subject: feat(home/gui): sway: use displaylink patch on laptop --- .../wlroots-displaylink/DisplayLink_v2.patch | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 overlays/patches/wlroots-displaylink/DisplayLink_v2.patch (limited to 'overlays/patches/wlroots-displaylink') 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); -- cgit 1.4.1