drm_format_...tate_reserve(9)
π drm_format_conv_state_reserve(9) β from the Kernel API Manual, bestie
okay so you're reading the drm_format_...tate_reserve(9) page (yes the title gets truncated in the header, that's just how it lives, we don't ask questions π«Ά). It's a kernel API manual situation and honestly? It's giving "small function, big responsibility." Let's get into it β¨
β¨ NAME β¨
drm_format_conv_state_reserve β literally just allocates storage for format conversion. That's the whole gig. Iconic, honestly π
πΈ SYNOPSIS πΈ
void * drm_format_conv_state_reserve (struct drm_format_conv_state
*state , size_t new_size , gfp_t flags );
like. look at her. returns a void *, takes three things. no cap, that's it π
π¦ ARGUMENTS π¦
stateβ the format-conversion state itself. the main character of this whole operation fr.new_sizeβ the minimum allocation size. minimum!! you can get more, you will never get less, iykyk.flagsβ the flags forkmalloc. yes those flags. thekmallocones. π§
π DESCRIPTION π
So what she actually does: she allocates at least new_size bytes and hands you back a pointer to that memory range. Slay.
But now the important part, and I need you to hear me on this one because it's lowkey a big deal π β after you call this function, previously returned memory blocks are invalid. Like, gone. don't touch them. They are not your little meow meow anymore.
Because of that whole situation, the actual recommended vibe is: collect all the memory requirements of a format conversion first, and then call this function once to allocate the whole range. One call, one clean allocation, no drama. Periodt π
β RETURN β
A pointer to the allocated memory rangeβ¦ or NULL otherwise. That's it, that's the return value. If you get NULL, that's your vibe check failing, bestie π
π SEE ALSO π
Kernel file ./drivers/gpu/drm/drm_format_helper.c β that's where she lives π
and then the whole friend group, in this exact order, no skipping:
drm_format_conv_state_init(9)drm_format_conv_state_copy(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)drm_fb_xrgb8888_to_gray2(9)
like that is a LOT of conversions and I am obsessed with every single one of them π
quick reminder bestie: new_size is a minimum, and anything you got from a previous call is invalid the second you call this again. write that on your hand. π
and that's the page!! this one came out of ./drivers/gpu/drm, dated October 2026, in the Kernel API Manual β mwah, go forth and allocate responsibly, love u π«Άπβ¨
π¦ 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