STRUCT DRM_MODE_CREATE_DUMB(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay so bestie, welcome to struct drm_mode_create_dumb(9) from the Kernel API Manual β€” this is the struct for creating a KMS dumb buffer for scanout. It's giving "simple buffer, but make it display-ready," no cap. πŸ’…βœ¨


🌸 SYNOPSIS 🌸

struct drm_mode_create_dumb {
    __u32 height;
    __u32 width;
    __u32 bpp;
    __u32 flags;
    __u32 handle;
    __u32 pitch;
    __u64 size;
};

🫢 Members 🫢

  • height β€” buffer height in pixels.
  • width β€” buffer width in pixels.
  • bpp β€” color mode.
  • flags β€” must be zero. Literally zero, bestie. 🚨
  • handle β€” buffer object handle.
  • pitch β€” number of bytes between two consecutive lines.
  • size β€” size of the whole buffer in bytes.

πŸ’– DESCRIPTION πŸ’–

User-space fills height, width, bpp and flags. If the IOCTL succeeds, the kernel fills handle, pitch and size. That's the whole trade, iykyk. 🫢

The value of bpp is a color-mode number describing a specific format or a variant thereof. The value often corresponds to the number of bits per pixel for most modes β€” although, yes, there are exceptions. Each color mode maps to a DRM format plus a number of modes with similar pixel layout. Framebuffer layout is always linear. 🌈

Support for all modes and formats is optional. Even if dumb-buffer creation with a certain color mode succeeds, it is not guaranteed that the DRM driver supports any of the related formats. Most drivers support a color mode of 32 with a format of DRM_FORMAT_XRGB8888 on their primary plane. ✨

Here's the color-mode tea, fr fr: πŸ“

  • Color mode 32 β€” framebuffer format: DRM_FORMAT_XRGB8888; compatible formats: DRM_FORMAT_BGRX8888, DRM_FORMAT_RGBX8888, DRM_FORMAT_XBGR8888.
  • Color mode 24 β€” framebuffer format: DRM_FORMAT_RGB888; compatible formats: DRM_FORMAT_BGR888.
  • Color mode 16 β€” framebuffer format: DRM_FORMAT_RGB565; compatible formats: DRM_FORMAT_BGR565.
  • Color mode 15 β€” framebuffer format: DRM_FORMAT_XRGB1555; compatible formats: DRM_FORMAT_BGRX1555, DRM_FORMAT_RGBX1555, DRM_FORMAT_XBGR1555.
  • Color mode 8 β€” framebuffer format: DRM_FORMAT_C8; compatible formats: DRM_FORMAT_D8, DRM_FORMAT_R8.
  • Color mode 4 β€” framebuffer format: DRM_FORMAT_C4; compatible formats: DRM_FORMAT_D4, DRM_FORMAT_R4.
  • Color mode 2 β€” framebuffer format: DRM_FORMAT_C2; compatible formats: DRM_FORMAT_D2, DRM_FORMAT_R2.
  • Color mode 1 β€” framebuffer format: DRM_FORMAT_C1; compatible formats: DRM_FORMAT_D1, DRM_FORMAT_R1.
⚠️ Color modes of 10, 12, 15, 30 and 64 are only supported for use by legacy user space. Please don't use them in new code. Other modes are not support. 😭
🚨 Do not attempt to allocate anything but linear framebuffer memory with single-plane RGB data. Allocation of other framebuffer layouts requires dedicated ioctls in the respective DRM driver. That part is not a vibe-check situation, it's a hard boundary. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


Sign-off tea β˜•: this page comes from ./include/uapi/drm, dated October 2026, and its manual identity is struct drm_mode_create_dumb(9). Slay, go make that dumb buffer. πŸ’…πŸŽ€

πŸ“¦ where this page comes from