Anyone I know have experience with DRI/DRM/KMS graphics programming?

I'm trying to find out how to render to the display (with hardware acceleration) without a running X or Wayland session – libdrm seems to be the thing I want to use, but I'm simply not finding *any* documentation on it and I'd be really grateful for anyone who can give me a proper overview and tell me how to instantiate a surface I can render to with cairo.

Boosts welcome.

@phryk I would highly suggest using Wayland at least.

Though, if you insist, here's an example:

@phryk If you choose the Wayland route, give the Wayland book a read:

@yuki_is_bored Writing a wayland compositor (or multiple ones) is the goal. I still need to know how to do DRM rendering and If I'm not mistaken wayland itself has nothing to do with that.

Also, I was told about kmscube before, but it simply doesn't work on my system and getting it to work would require way more C know-how than I (want to) have, especially with its code being pretty much completely uncommented as well…

@yuki_is_bored I really get the feeling like this might not at all be hard to do but that low-level engineers just plain suck at documenting things… :F

@phryk Welcome to FreeDesktop!

Yeah, it's a giant turd, really. Stuff like these are just one of those things where you really have to read a bunch of source code and examples to understand the basic gist of things.

I suggest scouring through the Mesa source code for documentation (i.e.

I finally found the thing that I've been looking for:

Should be enough to get a 100 foot view.

@phryk You can build the Doxygen documentation locally:

I tried looking for an online prebuilt one but couldn't find any that's complete and up to date.

Though, all you need to do is get to the point where you get a EGL display ( from there you can initialize OpenGL.

@phryk If you want Vulkan, I'm sorry, I'm not really familiar with Vulkan.

It seems Vulkan dropped EGL entirely, not sure how you can get Vulkan running just from opening the DRI device.

@phryk On the other hand, I found a rather complete example which shows both Vulkan and OpenGL:

No idea if it still works but it's a good start.

@yuki_is_bored Wow, thanks so much for all of that. My experience with and knowledge of C is pretty limited so I would've had an extremely bad time finding this information myself. 🤗

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!