drm_fb_swab(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_fb_swab β€” the Kernel API Manual, bestie edition πŸŽ€

okay so you found drm_fb_swab, a kernel API page from the Kernel API Manual. Sit down, hydrate, and let me tell you about the little byte-swapping icon that lives in ./drivers/gpu/drm/drm_format_helper.c.


✨ NAME ✨

drm_fb_swab β€” literally swaps bytes into the clip buffer. that's the whole vibe. swab supremacy πŸ’–


🌸 SYNOPSIS 🌸

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

look at that signature. seven (7) parameters. she's committed. πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dst β€” array of destination buffers. plural, babes, it's an array. 🫢
  • dst_pitch β€” array of numbers of bytes between the start of two consecutive scanlines within dst; this one can be NULL if the scanlines are stored next to each other (besties who sit together stay together fr fr).
  • src β€” array of source buffers. yes, also an array. πŸ’œ
  • fb β€” the DRM framebuffer.
  • clip β€” the clip rectangle area to copy.
  • cached β€” source buffer is mapped cached (eg. not write-combined). important distinction, don't sleep on it. πŸ™ˆ
  • state β€” transform and conversion state.

⭐ DESCRIPTION ⭐

So what does she do? This function copies parts of a framebuffer to display memory and swaps per-pixel bytes during the process. Destination and framebuffer formats must match β€” no cap, they gotta match, that's non-negotiable. 🚨

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 β€” index-aligned, iconic, the way that everything just lines up. ✨

If cached is false, a temporary buffer is used to cache one pixel line at a time to speed up slow uncached reads. honestly? thoughtful queen behavior. πŸ’…

lowkey important caveat: this function does not apply clipping on dst (i.e. the destination is at the top-left corner). so don't come for her about clipping, she simply does not do that. 😭

πŸŽ€ SEE ALSO πŸŽ€

Kernel file ./drivers/gpu/drm/drm_format_helper.c β€” go read the source, it's giving main character energy.

that's the whole friend group. 24 of them. a whole group chat. 🫢πŸ”₯


okay that's the page!! mwah πŸ’‹

this lil doc came from ./drivers/gpu/drm and it's dated October 2026 β€” so like, future girlie energy. go swap some bytes, bestie, you're gonna slay πŸŒˆπŸ’–βœ¨

πŸ“¦ where this page comes from