FEX-Emu: Graphics library thunking support
When FEX-Emu is determined to be the interpreter of pressure-vessel then some additional steps should be taken to ensure AArch64 graphics libraries can be loaded.
These need some special work over FEX's other thunks due to environment variable overriding which changes some details.
Since /usr/lib/aarch64-linux-gnu/
is already mounted inside of pressure-vessel when running under FEX-Emu this becomes a bit of an easier job.
This can be broken up to a few independent items. Vulkan support, GL support, EGL support.
Vulkan
Vulkan support is the main one to get DXVK titles up and running with thunks.
- Scan
<AArch64 root>/usr/share/vulkan/icd.d/
for AArch64 Vulkan ICDs- Also
explicit_layer.d
andimplicit_layer.d
? Whatever matches the x86 default behaviour I presume.
- Also
- Create the json files in the pressure-vessel chroot environment just like the x86 json files
- Append these to
VK_DRIVER_FILES
andVK_ICD_FILENAMES
- Regular architecture selection rules will apply to select AArch64 or x86-64 depending on what the loader wants
OpenGL support
DXVK titles seem to open libGL as well? But OpenGL thunking will be desired for OpenGL games anyway.
DRI/Mesa drivers
- Needs to append
<AArch64 root>/lib/aarch64-linux-gnu/dri
toLIBGL_DRIVERS_PATH
- or needs to append
<AArch64 root>/lib/dri
toLIBGL_DRIVERS_PATH
Nvidia proprietary stack
- While desired, I have no idea how this works under pressure-vessel currently.
EGL support
- GLVND needs to append
/usr/share/glvnd/egl_vendor.d/*.json
files to__EGL_VENDOR_LIBRARY_FILENAMES
? - Not quite sure what the glvnd loader looks for here
Multiarch specific libraries?
Slightly alluded to in the previous statements. I'm currently running my AArch64 devices on Ubuntu which since it is Debian based means it supports multiarch paths.
If the host environment ends up being a non-multiarch support distro then this might get funky.
This would mean that /usr/lib/aarch64-linux-gnu/
doesn't exist and all AArch64 libraries are in /usr/lib/
.
This ends up being the case for Arch Linux ARM for example.
I'm not sure of a solution for this at the moment, but will likely be a problem at some point in the future.
Current Testing I've done
While inside of a pressure-vessel environment I have tested thunks by doing a couple of things.
- Unset VK_ICD_FILENAMES, VK_DRIVER_FILES, and LIBGL_DRIVERS_PATH
- Enabled thunking on vkcube, vulkaninfo, and glxgears, glxinfo
- Ran these four applications and ensured that thunking was working
This verifies to some extent that thunking can work inside the pressure vessel environment, just needs to be setup.
Additionally since I deleted these environment variables I also confirmed that glxgears and glxinfo failed to find the x86 drivers, which caused it to fall back to llvmpipe.
Additionally in this situation it looks like vkcube/vulkaninfo still managed to find the x86 drivers through the magic of the overlayfs behaviour. But in this case it managed to also find lavapipe from my FEX rootfs now.
EGL thunking with es2_info resulted in failure, but this is likely due to EGL thunks currently being broken in FEX.