Skip to content

runemu: set VK_ICD_FILENAMES to match active GPU driver#2378

Open
aenertia wants to merge 1 commit intoROCKNIX:nextfrom
aenertia:vulkan-icd-fix
Open

runemu: set VK_ICD_FILENAMES to match active GPU driver#2378
aenertia wants to merge 1 commit intoROCKNIX:nextfrom
aenertia:vulkan-icd-fix

Conversation

@aenertia
Copy link
Contributor

@aenertia aenertia commented Mar 4, 2026

On devices with both Mali and Panfrost Vulkan ICDs installed (RK3566, RK3326), the Vulkan loader enumerates both but only one has a working kernel driver at any time. Emulators attempting Vulkan initialization fail silently and fall back to OpenGL.

Set VK_ICD_FILENAMES in runemu.sh based on the active GPU driver reported by gpudriver. This is inherited by all emulator subprocesses and fixes Vulkan for PPSSPP, Dolphin, AetherSX2, Duckstation, Flycast, RetroArch Vulkan cores, and all other Vulkan-capable emulators without requiring per-emulator launch script changes.

On devices with both Mali and Panfrost Vulkan ICDs installed (RK3566,
RK3326), the Vulkan loader enumerates both but only one has a working
kernel driver at any time. Emulators attempting Vulkan initialization
fail silently and fall back to OpenGL.

Set VK_ICD_FILENAMES in runemu.sh based on the active GPU driver
reported by gpudriver. This is inherited by all emulator subprocesses
and fixes Vulkan for PPSSPP, Dolphin, AetherSX2, Duckstation, Flycast,
RetroArch Vulkan cores, and all other Vulkan-capable emulators without
requiring per-emulator launch script changes.
@amigagamesplus
Copy link

I understand this doesn't affect systems like H700, or are they affected in any way?

@aenertia
Copy link
Contributor Author

aenertia commented Mar 4, 2026

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

@porschemad911
Copy link
Contributor

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

S922X too, if we installed the panvk lib and ICD:

rm -f ${INSTALL}/usr/lib/libvulkan_panfrost.so ${INSTALL}/usr/share/vulkan/icd.d/panfrost_icd.*.json

@aenertia
Copy link
Contributor Author

aenertia commented Mar 5, 2026

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

S922X too, if we installed the panvk lib and ICD:

rm -f ${INSTALL}/usr/lib/libvulkan_panfrost.so ${INSTALL}/usr/share/vulkan/icd.d/panfrost_icd.*.json

Oh cool is that something that you are looking into ?

@porschemad911
Copy link
Contributor

porschemad911 commented Mar 5, 2026

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

I understand this doesn't affect systems like H700, or are they affected in any way?

No ICD's so not affected. If at some point a working implementation of mali_kbase appears for them with a working vulkan icd. And therefore a gpudriver bin likewise; then this would 'just work' for them likewise. Currently this is only really rk3566 useful ; although rk3588 may benefit eventually too.

S922X too, if we installed the panvk lib and ICD:

rm -f ${INSTALL}/usr/lib/libvulkan_panfrost.so ${INSTALL}/usr/share/vulkan/icd.d/panfrost_icd.*.json

Oh cool is that something that you are looking into ?

I've played with it a little, but panvk doesn't really run anything much G52.

Edit: not a surprise, given low version compatibility and non-conformance: https://docs.mesa3d.org/drivers/panfrost.html

@sydarn
Copy link
Contributor

sydarn commented Mar 5, 2026

Do you mean that PanVK is broken in the current setup? Libmali vulkan seems to work fine for me
I would want to have this solved in the gpudriver script, so we have all gpu driver hacks in one place.

@aenertia
Copy link
Contributor Author

aenertia commented Mar 5, 2026

It depends on the emu/core - some find the ICD just fine by themselves this is really just setting an environment hint. The same issue exists on desktop OS's with multiple ICD profiles which is why I've hit it before. It's best to set the ICD environment on a per-run basis IME as there are time where you might want to point it elsewhere for a specific app. This seems like the right place for handling that.

@sydarn
Copy link
Contributor

sydarn commented Mar 5, 2026

We shouldn't pollute runemu, it seems to me that this might as well can be in gpudriver, app related hacks can be put in their respected start scripts

@aenertia
Copy link
Contributor Author

aenertia commented Mar 5, 2026

Ok; I guess the consideration is really about standardizing how VK_ICD_FILENAMES get's set in the environment more generally. Putting some logic to gpudriver to check/set it in the general environment makes sense for systems with it. But I wonder for the more general/future proofing case where you might have multiple ICD's for a system without gpudriver this is the right approach?

@sydarn
Copy link
Contributor

sydarn commented Mar 5, 2026

Does any non-gpudriver platform have to set this at moment? Is it no being set causing any issues?

@aenertia
Copy link
Contributor Author

aenertia commented Mar 5, 2026

Not on rocknix but in general yes ; not having this set basically means you have non-deterministic behavior per emu/core/app into how they decide what to use. I'd have to look through the sm8250 tree to check if it gets explicit set by the build somewhere. Generally if there is just one ICD it's fine; but some processes will just flat up decide if there isn't an ICD then it's opengl time.

@porschemad911
Copy link
Contributor

porschemad911 commented Mar 5, 2026

No issues with vulkan on non-gpudriver platforms IME and any changes there are unnecessary at this point, especially since we dropped x86 support. We can cross that bridge when we come to it.

Agree that the VK_ICD_FILENAMES env var set should be done as part of gpudriver logic rather than in runemu.sh.

@porschemad911
Copy link
Contributor

porschemad911 commented Mar 5, 2026

Maybe add a file to projects/ROCKNIX/packages/graphics/gpudriver/profile.d to set VK_ICD_FILENAMES and add VK_ICD_FILENAMES to projects/ROCKNIX/packages/hardware/quirks/profile.d/999-export

That is consistent with the way we set other env vars.

@aenertia
Copy link
Contributor Author

aenertia commented Mar 5, 2026

No issues with vulkan on non-gpudriver platforms IME and any changes there are unnecessary at this point, especially since we dropped x86 support. We can cross that bridge when we come to it.

Agree that the VK_ICD_FILENAMES env var set should be done as part of gpudriver logic rather than in runemu.sh.

Until someone tries to EGPU their handheld ... considering the prevalence of this in the x86_64 handheld space i'm surprised at the lack of community attempts at this so far. ;)

@aenertia
Copy link
Contributor Author

aenertia commented Mar 5, 2026

Ok I think this is enough to revise this - will do a push on this shortly.

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.

4 participants