SDL_gpu on RPi5 and KMSDRM

Hi,

I successfully ran SDL_gpu on my mac, and try to port my stuff onto rpi5 with no X11, only kmsdrm. However, SDL fails to open vulkan, and it seems it’s related to rpi5 supposedly not supporting VK_KHR_SURFACE_EXTENSION_NAME.

Have anyone succeeded in using SDL_gpu in this context?

Best,

Stéphane

so I installed libdrm, mesa, SDL fresh from github.
Now I get an SDL error Vulkan can't find any displays., presumably because vkGetPhysicalDeviceDisplayPropertiesKHRreturns 0.

Still investigating.

This is what SDL says with SDL_LOGGING set to verbose:

App name: SDL Application
App version: <unspecified>
App ID: <unspecified>
SDL revision: SDL3-3.3.0-113eb6f
/dev/dri/card1 connector, encoder and CRTC counts are: 2 4 4
/dev/dri/card1 connector, encoder and CRTC counts are: 2 4 4
KMSDRM_VideoInit()
Opening device /dev/dri/card1
Opened DRM FD (5)
WARNING: Validation layers not found, continuing without validation
SDL_GPU Driver: Vulkan
Vulkan Device: V3D 7.1.7.0
Vulkan Driver: V3DV Mesa Mesa 25.1.0-devel (git-b6b8193534)
Vulkan Conformance: 1.3.3

still no luck at this time… Now with V3DV 7.1.7.0, MESA 26.1.6. Even though

vkcube --wsi display

works.

According to Gemini:

The Raspberry Pi 5’s Broadcom driver does not implement the window-less VK_KHR_display extension inside its native layer. While vkcube has custom fallback code to draw pixels directly to a Linux console, SDL3’s SDL_GPU subsystem enforces strict Vulkan compliance. It refuses to construct a valid pipeline layout if a windowing structure is missing from the physical device query.

The only way I found so far is using cage:

sudo apt update
sudo apt install cage

Then switch to a text terminal with Atl+F1, then:

sudo systemctl stop lightdm  # if running rpios desktop 
cage -s -- /path/to/your/binary   # -s allows for switching to another text terminal to kill cage and stop the app, -- to pass options to your binary

I still cannot figure out how to run an rpi5 vulkan SDL_gpu app on kmsdrm without any other layer (such as cage)…