Skip to content

feat: add support for pi5 V3D split gpu#2079

Open
Ericky14 wants to merge 1 commit intoValveSoftware:masterfrom
Ericky14:pi5
Open

feat: add support for pi5 V3D split gpu#2079
Ericky14 wants to merge 1 commit intoValveSoftware:masterfrom
Ericky14:pi5

Conversation

@Ericky14
Copy link

@Ericky14 Ericky14 commented Feb 8, 2026

This PR adds support for PI5 to use the GPU for rendering

@KayJay7
Copy link

KayJay7 commented Feb 14, 2026

I'm testing this (and failing) on a Raspberry PI 5 4GB. I'm running Ubuntu desktop 25.10 and latest mesa (26.0.0), kernel 6.17.0 and latest firmware.

I have applied this PR to the source package of gamescope 3.16.19 for ubuntu unstable, it should be close to master, it mostly fixes broken upstream building on ubuntu.

I'm testing this from a tty with VK_LOADER_DEBUG=error,driver gamescope --backend drm -- vkcube and it fails with this output: drm-gamescope.log

Last lines:

...
[gamescope] [Info]  vulkan: selecting physical device 'V3D 7.1.7.0': queue family 0 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[gamescope] [Info]  vulkan: VK_EXT_robustness2 not supported, skipping
[Vulkan Loader] DRIVER:         vkCreateDevice layer callstack setup to:
[Vulkan Loader] DRIVER:            <Application>
[Vulkan Loader] DRIVER:              ||
[Vulkan Loader] DRIVER:            <Loader>
[Vulkan Loader] DRIVER:              ||
[Vulkan Loader] DRIVER:            <Device>
[Vulkan Loader] DRIVER:                Using "V3D 7.1.7.0" with driver: "/usr/lib/aarch64-linux-gnu/libvulkan_broadcom.so"
[gamescope] [Info]  vulkan: NV12 format: optimalTilingFeatures=0xc2c001, nv12Supported=1, cosited=1
[gamescope] [Info]  vulkan: Created dummy image views for null descriptor slots
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Info]  wlserver: [libseat] [libseat/backend/seatd.c:64] Could not connect to socket /run/seatd.sock: No such file or directory
[gamescope] [Info]  wlserver: [libseat] [libseat/libseat.c:76] Backend 'seatd' failed to open seat, skipping
[gamescope] [Info]  wlserver: [libseat] [libseat/libseat.c:73] Seat opened with backend 'logind'
[gamescope] [Info]  wlserver: [backend/session/session.c:108] Successfully loaded libseat session
[gamescope] [Info]  drm: opening DRM node '/dev/dri/card0'
[gamescope] [Error] wlserver: [libseat] [libseat/backend/logind.c:124] Could not take device: Device or resource busy
[gamescope] [Error] wlserver: [backend/session/session.c:318] Failed to open device: '/dev/dri/card0': Resource temporarily unavailable
[gamescope] [Error] drm: Could not open KMS device
Failed to create backend.

I see from the output that it's skipping VK_KHR_robustness2 as expected, but it fails to open the rendering device.

For completeness, I've also tested running nested in gnome with VK_LOADER_DEBUG=error,driver gamescope --backend sdl -- vkcube, though this is known not to work due to this issue in mutter. Of course, running nested with backend drm instead of sdl doesn't work because mutter holds the device. Here's the log: gnome-gamescope.log

@Ericky14
Copy link
Author

Ericky14 commented Feb 14, 2026

Replying to #2079 (comment)

I have only tested this on Fedora on a Pi5 8gb
I was able to run GameOS and launch Stardew Valley running at 50-60fps

IMG_5985

I'll give Ubuntu a try

For reference here is the branch where I made a build from for GameOS: https://github.com/playtron-os/gameos/tree/pi5, it's just something I put together to prove it was possible to run on PI5. You can build an arm image and run the customize script on it to inject the right kernel and modules for the pi5.

V3D has several hardware limitations that require workarounds:

1. Split render/display architecture: Pi5 has separate V3D GPU (card0)
   and VC4 display controller (card1). Added detection and fallback to
   find KMS-capable display device when render device lacks KMS.

2. Swapchain format: V3D only supports B8G8R8A8 formats. Added V3D
   detection and format preference in SDL/DRM backends.

3. Channel swap: Shaders declare rgba8 but V3D swapchain is BGR. Added
   c_swapChannels specialization constant to swap R/B in output.

4. Tiled/LINEAR mismatch: V3D compute shaders can only write to tiled
   (UIF) images, but VC4 display needs LINEAR for scanout. Created
   separate tiled storage images and linear scanout images with copy.

5. LINEAR sampling: V3D cannot sample LINEAR textures. Added tiled
   shadow textures that get copied from LINEAR dmabufs before sampling.

6. Optional extensions: Made VK_KHR_present_id/wait optional as V3D
   only has present_id2/wait2 variants.

7. Null descriptors: V3D lacks VK_EXT_robustness2. Added dummy image
   views for null descriptor slots.

Tested on Raspberry Pi 5 with DRM and SDL backends.
@Ericky14
Copy link
Author

I made some changes on this to better support the pi5
Also did testing on ubuntu 25 with both SDL and DRM, also Wayland
Both glxgears and vkcube work

If running with DRM, you might need to setup seatd and add your user to video and seat groups for it to work

Example running against local installed mesa 26.1 from gamescope dir

export PATH="$PATH:$(dirname "$0")/build/src"
export LD_LIBRARY_PATH="/usr/local/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH"
export LIBGL_DRIVERS_PATH="/usr/local/lib/aarch64-linux-gnu/dri"
export DRIVERS_PATH="/usr/local/lib/aarch64-linux-gnu/dri"
export VK_ICD_FILENAMES="/usr/local/share/vulkan/icd.d/broadcom_icd.aarch64.json"
./build/src/gamescope --backend sdl -W 1920 -H 1080 -w 1280 -h 720 -- vkcube 
Screenshot From 2026-02-14 21-18-38

@KayJay7
Copy link

KayJay7 commented Feb 19, 2026

I have tested the new changes. On sdl it is working (mutter), but I can't get it to work on drm!
Performance are (extremely) degraded, the application runs at very low fps and with high latency.

A color-shifted screen buffer seems to be used as the mouse cursor (and it cannot reach the entire screen)

I've set up seatd and CAP_SYS_NICE. I have tried various cli options (including forcing composition, grabbing the cursor, and selecting the preferred vulkan device) but to no avail.

I'm attaching a short video of the issue and the corresponding logs of testing with supertuxkart, but it behaves the same with other programs:

gamescope.log

video_2026-02-19_19-25-19.mp4

Thank you for your work!

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