Last active
April 23, 2024 09:50
-
-
Save clementpoiret/992d7b4c8cd3707b21461366c817db4d to your computer and use it in GitHub Desktop.
hyprland-displaylink-git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Clément POIRET <poiret dot clement at outlook dot fr> | |
_pkgname="hyprland" | |
pkgname="${_pkgname}-displaylink-git" | |
pkgver="0.38.1" | |
pkgrel=1 | |
pkgdesc="A dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks. (DisplayLink patch)" | |
arch=(any) | |
url="https://github.com/hyprwm/Hyprland" | |
license=('BSD') | |
depends=( | |
cairo | |
gcc-libs | |
glib2 | |
glibc | |
glslang | |
hyprlang | |
hyprcursor | |
libdisplay-info | |
libdrm | |
libglvnd | |
libinput | |
libliftoff | |
libx11 | |
libxcb | |
libxcomposite | |
libxfixes | |
libxkbcommon | |
libxrender | |
opengl-driver | |
pango | |
pixman | |
polkit | |
seatd | |
systemd-libs | |
tomlplusplus | |
wayland | |
wayland-protocols | |
xcb-proto | |
xcb-util | |
xcb-util-errors | |
xcb-util-keysyms | |
xcb-util-renderutil | |
xcb-util-wm | |
xorg-xinput | |
xorg-xwayland | |
) | |
depends+=(libdisplay-info.so) | |
makedepends=( | |
cmake | |
gdb | |
git | |
jq | |
meson | |
ninja | |
pkgconf | |
xorgproto | |
) | |
source=( | |
"${pkgname}-${pkgver}.tar.gz::https://github.com/hyprwm/Hyprland/releases/download/v${pkgver}/source-v${pkgver}.tar.gz" | |
"displaylink.patch" | |
) | |
conflicts=("${_pkgname}") | |
provides=(hyprland) | |
sha256sums=('1a86365cc006fca4bc96c6c41347d0bde048b6463c516e09b9c54cff58fb73ab' | |
'70c8f6af41ed252c2cee7b1fc0b29ff29c7f81932a9dd3014716571b0728e5ab') | |
options=(!makeflags !buildflags !strip) | |
prepare() { | |
cd "$srcdir/hyprland-source" | |
patch -d subprojects/wlroots -Np1 < ../displaylink.patch | |
} | |
build() { | |
cd "$srcdir/hyprland-source" | |
meson setup build \ | |
--prefix /usr \ | |
--libexecdir lib \ | |
--sbindir bin \ | |
--buildtype release \ | |
--wrap-mode nodownload \ | |
-D b_lto=true \ | |
-D b_pie=true \ | |
-D default_library=shared \ | |
-D xwayland=enabled \ | |
-D systemd=enabled | |
meson compile -C build | |
} | |
package() { | |
cd "$srcdir/hyprland-source" | |
meson install -C build \ | |
--destdir "$pkgdir" \ | |
--skip-subprojects hyprland-protocols | |
mkdir "$pkgdir/usr/include/hyprland/wlroots" | |
mv "$pkgdir/usr/include/wlr" "$pkgdir/usr/include/hyprland/wlroots" | |
# resolve conflicts with system wlr | |
rm -f "$pkgdir/usr/lib/libwlroots.so" | |
rm -rf "$pkgdir/usr/lib/pkgconfig" | |
# FIXME: remove after xdg-desktop-portal-hyprland disowns hyprland-portals.conf | |
rm -rf "$pkgdir/usr/share/xdg-desktop-portal" | |
# license | |
install -Dm0644 -t "$pkgdir/usr/share/licenses/${pkgname}" LICENSE | |
} |
Hopefully one day this patch will be merged into wlroots, let's cross our fingers :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Already tried using evdi-git and using lts kernel , unfortunately my workflow relies heavily on CUDA so I cannot really live without it, I'm just gonna stick with x11 in the meanwhile, thanks for your work