4 ms·
I've been wondering how Wayland actually works underneath. Seeing how Wayland window managers usually have a drawing layer that among others have a specific bac
by cm3 10y ago
I've been wondering how Wayland actually works underneath. Seeing how Wayland window managers usually have a drawing layer that among others have a specific backend for Intel, I scratched my head wondering if people have to reinvent/reimplement parts of what xf86-video-intel provides in Xorg. Any insight?
- ZenoArrow 10y agoI'm not an expert, but here's how I see it... There are different ways to create GPU drivers for Linux. In order to make use of DRI, the GPU has to have a DRM driver. This DRM driver is specific to the GPU hardware. The DRM is the interface that software can work with to make calls to the GPU. You could think of DRM as a way to have a standard interface for GPU calls, so other software will speak to this DRM layer, but the DRM driver will speak to the hardware, which is why the DRM driver needs to be device specific. The DRM driver is the part of the GPU driver that sits in the kernel, there will also be a userland part of the GPU driver. I believe the part of the driver that gets used will depend on what the software is targetting. Wayland will target the kernel side, but games would work with the userland side. These images from Wikipedia may help visualise what DRM is doing. Without DRM: https://en.wikipedia.org/wiki/Direct_Rendering_Manager#/media/File:Access_to_video_card_without_DRM.svg https://en.wikipedia.org/wiki/Direct_Rendering_Manager#/medi... With DRM: https://en.wikipedia.org/wiki/Direct_Rendering_Manager#/media/File:High_level_Overview_of_DRM.svg https://en.wikipedia.org/wiki/Direct_Rendering_Manager#/medi... As a side note, it's possible for GPU vendors to create more generic GPU drivers by using Gallium3D. This also creates drivers that work with DRI, but GPU drivers don't need to use Gallium3D to use DRI. I would suggest thinking of Gallium3D as a set of reusable GPU driver components, you could code a driver using these reusable components, or you could code something bespoke. https://en.wikipedia.org/wiki/Gallium3D https://en.wikipedia.org/wiki/Gallium3D In terms of Wayland in particular, you may be interested in this: https://wayland.freedesktop.org/architecture.html https://wayland.freedesktop.org/architecture.html Does this help?
- cm3 10y agoYes, the picture kinda confirms my suspicion. Looking at this https://github.com/michaelforney/wld/blob/master/intel/i965_pci_ids.h https://github.com/michaelforney/wld/blob/master/intel/i965_... you have to wonder how much device-specific stuff one has to implement now when targeting Wayland and if that's avoidable or why libwayland doesn't have libwayland-intel etc?
- ZenoArrow 10y agoBy the looks of that header file, the i965 driver covers multiple different devices, I'm guessing it's using those values to enumerate a list of the Intel CPUs that the driver works with. In terms of Wayland, I would suspect that it isn't necessary to have anything vendor specific, the whole point of targeting an abstraction layer like the DRI is to eliminate the need to cater for differences in devices.
- pritambaral 10y agoFWIU, drivers don't have to specifically support Wayland. As long as they support Khronos's EGL spec, wayland will run on those drivers. EGL is sort of a cross-platform spec for window managers to work with graphics cards.
- cm3 10y agoSo is it just that the APIs are not there yet which motivated wld to talk directly to Intel's DRM?
- pritambaral 10y agoI doubt that. libdrm should have been enough, but this was about two years ago, when Wayland wasn't ready. I don't know much about how wld is using libdrm_intel, and I don't think I'll be much the wiser even if I read the code. Maybe ask the author.