drm_fb_swab(9)
π 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 withindst; this one can beNULLif 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.
drm_format_conv_state_init(9)drm_format_conv_state_copy(9)drm_format_conv_state_reserve(9)drm_format_conv_state_release(9)drm_fb_clip_offset(9)drm_fb_memcpy(9)drm_fb_xrgb8888_to_rgb332(9)drm_fb_xrgb8888_to_rgb565(9)drm_fb_xrgb8888_to_rgb565be(9)drm_fb_xrgb8888_to_xrgb1555(9)drm_fb_xrgb8888_to_argb1555(9)drm_fb_xrgb8888_to_rgba5551(9)drm_fb_xrgb8888_to_rgb888(9)drm_fb_xrgb8888_to_bgr888(9)drm_fb_xrgb8888_to_argb8888(9)drm_fb_xrgb8888_to_abgr8888(9)drm_fb_xrgb8888_to_xbgr8888(9)drm_fb_xrgb8888_to_bgrx8888(9)drm_fb_xrgb8888_to_xrgb2101010(9)drm_fb_xrgb8888_to_argb2101010(9)drm_fb_xrgb8888_to_gray8(9)drm_fb_argb8888_to_argb4444(9)drm_fb_xrgb8888_to_mono(9)drm_fb_xrgb8888_to_gray2(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms