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
Open

Add Zink Override #8373

wants to merge 14 commits into from

Conversation

klylabs
Copy link

@klylabs klylabs commented Feb 11, 2025

Description

Implements #8372

solves
#8361
#8337
#8145
#8050
#8030
#7937
#4935
and probably many more

Screenshots/Recordings/Graphs

NA

Tests

Tested on Latest Ubuntu under a VM with GPU passthrough using nvidia-dkms-560 drivers
and Latest arch using nvidia-open-dkms 570.86.16-2

Add Zink Override
@klylabs klylabs marked this pull request as ready for review February 11, 2025 09:38
@klylabs
Copy link
Author

klylabs commented Feb 11, 2025

I made a silly mistake while half asleep, but this change should target only those using nvidia proprietary drivers since nvidia-smi doesnt exist in nouveau/nvk

@SoftFever
Copy link
Owner

@klylabs Thank you very much!

I have a quick question, will this change affect non Nvidia users? Or Linux distributions are not using Wayland ?

@klylabs
Copy link
Author

klylabs commented Feb 16, 2025

@klylabs Thank you very much!

I have a quick question, will this change affect non Nvidia users? Or Linux distributions are not using Wayland ?

Really good point!

In most cases, i imagine that this won’t really affect Intel or AMD users since nvidia-smi doesn’t exist for those drivers, but there could be edge cases on systems that have both an Intel/AMD iGPU and an NVIDIA dGPU (a smaller subset of existing nvidia users currently affected by the bug) , especially laptops or older PCs (since newer pcs with parts made after 2012/2013 properly support vulkan so even if Zink somehow gets triggered, it shouldn't really affect them that negatively, if at all, it could even boost performance)

For example, someone with a Sandy Bridge CPU (2nd Gen Intel) plus a modern NVIDIA card could run into issues if the Intel iGPU is used for rendering (since the iGPU doesn’t really support Vulkan)

to fix that, we can take advantage of the fact that those people use DRI_PRIME to select the GPU renderer, so we are able to do something like:

#If DRI_PRIME is not used OR DRI_PRIME is set to the dGPU
if [ -z "$DRI_PRIME" ] || [ "$DRI_PRIME" != "0" ]; then
  #Normal Logic Goes here
fi

This way, if DRI_PRIME is not set or is set to a non zero value, we can probably be sure that the original test would work as intended

although i could see that there can be issues if they have a TRIPLE gpu setup, but then again, we could probably treat it as out of scope since just using a Dual GPU on linux from different manufacturers can be really flakey and it's something that those people who would run a Triple gpu setup probably already expect and know how to fix, some people sometimes even just fully bypass the issue altogether by disabling the iGPU on the bios itself

and to check for wayland, we can just do something like:

if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
    #Normal Logic Goes here
fi

And while we're at it, we can add an environment variable (e.g. ZINK_DISABLE_OVERRIDE) to let users disable Zink if they suspect it causes issues, and maybe even a ZINK_FORCE_OVERRIDE if they want to test the vulkan performance on their system

export WEBKIT_DISABLE_DMABUF_RENDERER=1
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants