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

Use NVD_GPU to control which DRM node to open in direct backend mode #137

Merged
merged 1 commit into from
Dec 11, 2022

Conversation

philipl
Copy link
Contributor

@philipl philipl commented Dec 9, 2022

When running in direct backend mode, we need to open the DRM node ourselves, and the first node may not be the right one.

This change uses NVD_GPU to identify which one to use. It might be desirable to use a different env var because it will count non-nvidia GPUs so it could be confusing. That's easy to change.

@elFarto
Copy link
Owner

elFarto commented Dec 10, 2022

Hmm, I swear I wrote a comment on this yesterday, Github seems to have eaten it.

I think I'd prefer a NVD_DRM_DEVICE=/dev/dri/renderD129 rather than repurpose NVD_GPU, which is currently used to refer to which CUDA GPU to use.

With that said, I'd ideally like some way to detect the DRM device from the X11 handle that's passed in (we should have a DRM device if using Wayland), but the only ways I currently know of doing that are using the DRI3 Open method, which wasn't supported the last time I looked, or some wacky NV-GLX calls.

I guess we could just scan for the first NVIDIA DRM device, and leave more complicated setups to the NVD_DRM_DEVICE variable.

@philipl
Copy link
Contributor Author

philipl commented Dec 11, 2022

How about using NVD_GPU to mean the nth nvidia device, and we iterate over the render nodes and look for nvidia devices specifically. Then we can keep using the same variable with it meaning the same thing.

@philipl
Copy link
Contributor Author

philipl commented Dec 11, 2022

Updated diff to use NVD_GPU to specifically pick the nth nvidia gpu and ignore others.

When running in direct backend mode, we need to open the DRM node
ourselves, and the first node may not be the right one.

We will iterate through the DRM nodes looking for NVIDIA GPUs and will
use the first one found or the one identified by NVD_GPU if set.
@philipl
Copy link
Contributor Author

philipl commented Dec 11, 2022

Updated to use drv->cudaGpuId

@elFarto
Copy link
Owner

elFarto commented Dec 11, 2022

Ok, that looks good. Thanks for that!

@elFarto elFarto merged commit e2d256e into elFarto:master Dec 11, 2022
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