drm_fb_xrgb8888_to_gray2(9)
β¨ drm_fb_xrgb8888_to_gray2 π
okay so bestie, this is a page from the Kernel API Manual and it's literally all about drm_fb_xrgb8888_to_gray2 β the glow-up function that takes your XRGB8888 pixels and turns them into gray2. no cap, that's the whole vibe. π
πΈ NAME πΈ
drm_fb_xrgb8888_to_gray2 β Convert XRGB8888 to gray2 β¨
π¦ SYNOPSIS π¦
void drm_fb_xrgb8888_to_gray2 (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 );
like, that's the whole signature, copy-pasted with love π«Ά
π ARGUMENTS π
dstβ Array of gray2 destination buffer. this is where the magic lands, bestie π«dst_pitchβ Array of numbers of bytes between the start of two consecutive scanlines withindst; it can beNULLif scanlines are stored next to each other. so like, NULL is fine here, no stress π«Άsrcβ Array of XRGB8888 source buffers. the originals, the main characters πfbβ DRM framebuffer. the whole picture, literally πΌοΈclipβ Clip rectangle area to copy. only this little window gets invited to the party πstateβ Transform and conversion state. it's giving "carry-on luggage for the conversion" β¨
π₯ DESCRIPTION π₯
So this function copies parts of a framebuffer to display memory and converts the color format during the process. Destination and framebuffer formats must match β like, they HAVE to match, that's not optional, periodt. π
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. so same index, same plane, everyone in their assigned seat, iconic behavior πͺ
β οΈ Heads up bestie: this function does not apply clipping on dst (i.e. the destination is at the top-left corner). no sneaky clipping, it just goes. π
The first pixel (upper left corner of the clip rectangle) will be converted and copied to the two first bits (LSB) in the first byte of the gray2 destination buffer. so the very first pixel gets the two LSBs of byte zero, that's the arrangement, that's the law πβ¨
And if the caller requires that the first pixel in a byte must be located at an x-coordinate that is a multiple of 8, then the caller must take care itself of supplying a suitable clip rectangle. like, that's a you problem, bestie β this function is not doing that math for you π
DRM doesn't have native gray2 support. (i know. tragic. π) Drivers can use this function for gray2 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. so you flex XR24 to userspace and quietly do the conversion on the back end β main character energy, honestly π
π SEE ALSO π
Kernel file ./drivers/gpu/drm/drm_format_helper.c
and all these besties right here, the whole group chat π«Ά:
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_swab(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)
π sign-off π
so this page lives in ./drivers/gpu/drm, and it's dated October 2026 β yes, the future, we're ahead of schedule, slay β that's the whole manpage, you ate it up, ily, go convert some pixels bestie ππΈ
π¦ 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