Displaying Something

May 8, 2026

Today is a "hang some artwork up on the fridge" kind of day! ...though the artwork is just a solid color, and you can only see it for about 1 second, but hey, it's your fridge and you can hang up whatever you want. In this devlog, we set up our rendering stack, taking over our monitor's output from a virtual terminal (VT), and displaying an incredibly exciting shade of dark blue. If that doesn't put you on the edge of your seat, I don't know what will.

DRM

The main Linux subsystem responsible for doing anything related to your graphics card is called the "DRM" (Direct Rendering Manager). There's a fancy library we use to interact with it called libdrm, and we use that to query and configure a bunch of DRM resources (CRTCs, connectors, encoders, modes, ...). Once all that's configured, and once we've claimed the role of "DRM Master" through libseat, we've got a pipeline in place that will let us send beautiful display buffers out to the monitor. ...but before we can do that, we need to create those buffers and actually draw things on them.

Display Buffers

Display buffers are literally just arrays of 32-bit integers where each integer represents the color of one pixel. (If you cut 32-bits into 4 channels (RGBA), then each channel gets 8 bits, which gives it a range of 0-255.) If we allocate these buffers in our RAM, it'll be slow as potatoes to render and display, so we need to allocate them on our GPU instead. Since every GPU and driver is different, there's a fancy library called GBM (Generic Buffer Management) that provides a generalized API for creating buffers in the GPU's memory.

Once we have a buffer, we draw on it using a combination of OpenGL and EGL, then commit that buffer to the DRM using its atomic modesetting API for scanout.

Related Links

Here's the PR for these changes: Github PR #2

There's also a note page on "Linux Rendering" that talks a bit more about this stuff.