drm_fb_xrgb8888_to_gray8(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_fb_xrgb8888_to_gray8 β€” a Kernel API Manual moment

okay bestie, so this is a page from the Kernel API Manual and it's literally about drm_fb_xrgb8888_to_gray8. Yes that's a mouthful, no we're not renaming it, it's iconic as is πŸ’–

✨ NAME ✨

drm_fb_xrgb8888_to_gray8 β€” convert XRGB8888 to grayscale, no cap πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

void drm_fb_xrgb8888_to_gray8 (struct iosys_map *dst , const unsigned
int *dst_pitch , const struct iosys_map *src , const struct
drm_framebuffer *fb , const struct drm_rect *clip , struct
drm_format_conv_state *state );

🌸 ARGUMENTS 🌸

  • dst β€” array of 8-bit grayscale destination buffers, one per plane, slay πŸ’…
  • dst_pitch β€” array of numbers of bytes between the start of two consecutive scanlines within dst; this one's allowed to be NULL if the scanlines are just stored next to each other (like they're holding hands 🫢)
  • src β€” array of XRGB8888 source buffers
  • fb β€” the DRM framebuffer, the main character honestly πŸ‘‘
  • clip β€” clip rectangle area to copy
  • state β€” transform and conversion state

πŸ’œ DESCRIPTION πŸ’œ

so this function copies parts of a framebuffer to display memory AND converts the color format while it's at it β€” multitasking queen behavior fr fr. Just know that destination and framebuffer formats must match, that's not optional, that's the vibe check βœ…

The parameters dst, dst_pitch and src refer to arrays. Each array must have at least as many entries as there are planes in fb's format. Each entry stores the value for the format's respective color plane at the same index. iykyk 🧚

Heads up bestie: this function does not apply clipping on dst β€” the destination is at the top-left corner. So like, no fancy positioning, it just goes πŸ“

Here's the lore: DRM doesn't have native monochrome or grayscale support. So drivers can use this function for grayscale devices that don't support XRGB8888 natively. Such drivers can announce the commonly supported XR24 format to userspace and use this function to convert to the native format β€” a whole glow-up pipeline ✨

Monochrome drivers will use the most significant bit, where 1 means foreground color and 0 background color. And for the RGB -> luma (brightness) conversion, ITU BT.601 is being used. Not 709, not vibes, BT.601 periodt πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/gpu/drm/drm_format_helper.c β€” go read the source, it's giving lore drop πŸ“–


okay that's the whole page bestie, go convert some pixels πŸ’–βœ¨

this one came from ./drivers/gpu/drm, dated October 2026 β€” that's the version and the date, we stan a documented timeline 🌈⭐ mwah πŸ’…

πŸ“¦ where this page comes from