I'm using a Raspberry Pi 4 on the latest version Debian Bookworm 64-bits, and need to use vulkan in a VNC session. It works when wired to a screen: vkcube opens a window with a 3D rotating cube. However, it fails when the same command is used in a VNC session: vkcube returns "vulkan: no DRI3 support detected...".
The VNC session is started with TightVNC.
I checked the output of vulkaninfo in both cases, and the only difference is that, when wired to a screen, two GPUs appear in the Presentable Surfaces section, instead of one when the command is used in the VNC session. The additional gpu is defined as follows:
GPU id : 0 (V3D 4.2.14):
Surface types: count = 2
VK_KHR_xcb_surface
VK_KHR_xlib_surface
Formats: count = 2
SurfaceFormat[0]:
format = FORMAT_B8G8R8A8_SRGB
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
SurfaceFormat[1]:
format = FORMAT_B8G8R8A8_UNORM
colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
Present Modes: count = 4
PRESENT_MODE_IMMEDIATE_KHR
PRESENT_MODE_MAILBOX_KHR
PRESENT_MODE_FIFO_KHR
PRESENT_MODE_FIFO_RELAXED_KHR
VkSurfaceCapabilitiesKHR:
-------------------------
minImageCount = 3
maxImageCount = 0
currentExtent:
width = 256
height = 256
minImageExtent:
width = 256
height = 256
maxImageExtent:
width = 256
height = 256
maxImageArrayLayers = 1
supportedTransforms: count = 1
SURFACE_TRANSFORM_IDENTITY_BIT_KHR
currentTransform = SURFACE_TRANSFORM_IDENTITY_BIT_KHR
supportedCompositeAlpha: count = 2
COMPOSITE_ALPHA_OPAQUE_BIT_KHR
COMPOSITE_ALPHA_INHERIT_BIT_KHR
supportedUsageFlags: count = 6
IMAGE_USAGE_TRANSFER_SRC_BIT
IMAGE_USAGE_TRANSFER_DST_BIT
IMAGE_USAGE_STORAGE_BIT
IMAGE_USAGE_COLOR_ATTACHMENT_BIT
IMAGE_USAGE_INPUT_ATTACHMENT_BIT
IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT
VkSurfaceCapabilities2EXT:
--------------------------
supportedSurfaceCounters:
None
VkSurfacePresentModeCompatibilityEXT:
-------------------------------------
presentModeCount = 1
pPresentModes: count = 1
VkSurfacePresentScalingCapabilitiesEXT:
---------------------------------------
supportedPresentScaling:
None
supportedPresentGravityX:
None
supportedPresentGravityY:
None
minScaledImageExtent:
width = 256
height = 256
maxScaledImageExtent:
width = 256
height = 256
VkSurfaceProtectedCapabilitiesKHR:
----------------------------------
supportsProtected = false
I guess I have to point to this additional GPU when opening the VNC server but did not find how to do it.
Currently, the VNC server is started with systemctl and the following .service file:
[Unit]
Description=Open a virtual session on boot with user "capteur"
After=multi-user.target
[Service]
Type=forking
User=capteur
ExecStartPre=sleep 20
ExecStart=vncserver
[Install]
WantedBy=multi-user.target
The xstartup script is the default one:
#!/bin/sh
xrdb "$HOME/.Xresources"
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
Finally, I saw on this post that the issue might come from /etc/X11/xorg.conf.d, but couldn't find a way to fix it myself. So here is the only file in my /etc/X11/xorg.conf.d directory (again the default one):
Section "OutputClass"
Identifier "vc4"
MatchDriver "vc4"
Driver "modesetting"
Option "PrimaryGPU" "true"
EndSection
I also noticed two files vncserver-virtual-vnc.conf and vncserver-virtual-dummy.conf sitting in /etc/X11/ so maybe they should be edited too.
Is there a way to enable DRI3 inside a VNC session, and if yes, what am I missing ?
I hope someone can help me with this, Bye !
NB: Since I don't know if it's more a Raspberry Pi or a Linux question, I made the exact same post on forum.Raspberrypi. I'll update this post if the issue is solved there and vice versa