Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zink Override #8373

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
23 changes: 23 additions & 0 deletions src/platform/unix/BuildLinuxImage.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,30 @@ export LD_LIBRARY_PATH="\$DIR/bin:\$LD_LIBRARY_PATH"
# FIXME: OrcaSlicer segfault workarounds
# 1) OrcaSlicer will segfault on systems where locale info is not as expected (i.e. Holo-ISO arch-based distro)
export LC_ALL=C
if [ "\$XDG_SESSION_TYPE" = "wayland" ] && [ "\$ZINK_DISABLE_OVERRIDE" != "1" ]; then
if command -v glxinfo >/dev/null 2>&1; then
RENDERER=\$(glxinfo | grep "OpenGL renderer string:" | sed 's/.*: //')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hesitant in using glxinfo at first since i wasn't sure if it's installed everywhere, so i thought at first to just check for prime, but in the end i just decided to use glxinfo since according to freedesktop.org "glxinfo should be installed by default by all (desktop) distributions." which, for those that don't know is one of the big boys in the linux world that sets everything that makes desktops and apps mesh together

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still very much open to check other ways of achieving the same thing though

if echo "\$RENDERER" | grep -qi "NVIDIA"; then
if [ "\$ZINK_FORCE_OVERRIDE" = "1" ]; then
APPLY_OVERRIDE=1
else
if command -v nvidia-smi >/dev/null 2>&1; then
DRIVER_VERSION=\$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n1)
DRIVER_MAJOR=\$(echo "\$DRIVER_VERSION" | cut -d. -f1)
[ "\$DRIVER_MAJOR" -gt 555 ] && APPLY_OVERRIDE=1
fi
fi

if [ "\$APPLY_OVERRIDE" = "1" ]; then
export __GLX_VENDOR_LIBRARY_NAME=mesa
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
export MESA_LOADER_DRIVER_OVERRIDE=zink
export GALLIUM_DRIVER=zink
export WEBKIT_DISABLE_DMABUF_RENDERER=1
fi
fi
fi
fi
exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@"
EOF

Expand Down