diff options
author | sefidel <contact@sefidel.net> | 2023-11-15 23:26:23 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2023-11-15 23:57:07 +0900 |
commit | 8218f368d771fb763bb53a5c91add4d278a67dae (patch) | |
tree | f9cafde75ddcd802682244f294eedd3512695e5a /overlays | |
parent | 1f1737591360a3dbbdfb66a1ce8296258e124c9e (diff) | |
download | nixrc-8218f368d771fb763bb53a5c91add4d278a67dae.tar.gz nixrc-8218f368d771fb763bb53a5c91add4d278a67dae.zip |
feat(home/gui): sway: use displaylink patch on laptop
Diffstat (limited to 'overlays')
-rw-r--r-- | overlays/patches/wlroots-displaylink/DisplayLink_v2.patch | 48 |
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); |