Sample Header Ad - 728x90

Vulkan, DRI, X11, and KMS: how do they relate?

1 vote
0 answers
925 views
I think I have a decent understanding of the chain of software that gets graphics code from a program to your hardware, but I would like someone to correct me on any mistakes. When I write a program (in C, let's say) that uses Vulkan to render and present a 3D scene, I have to link to libvulkan. libvulkan actually just dispatches my commands to the Vulkan library for my platform. This library makes calls into libdrm which talks to the kernel driver using the /dev/dri/renderX interface. This driver then interacts with my hardware. To recap:
program -> libvulkan -> libvulkan_platform -> libdrm -> /dev/dri/renderX -> kernel drm driver -> hardware
Is this correct? In addition, once the GPU has rendered my frames, they need to be presented on the screen. This is done by sending them to the platform's window library (X11, wayland, etc) using the Vulkan window system integration (WSI) layer. However, when I write programs in Vulkan, I also use glfw. where does it come in? The window server then has to display the composited frames on the display, also using libdrm. it interacts with the kernel KMS driver through the /dev/dri/cardX interface, which then interacts with the hardware. To recap:
program -> libvulkan (wsi) -> glfw??? -> libX11, libwayland-client -> X server (Xorg) + modesetting_drv, Wayland compositor -> libdrm -> /dev/dri/cardX -> platform KMS driver -> hardware
Is this correct?
Asked by Lennon McLean (326 rep)
Jan 18, 2023, 03:00 AM