packed_pixels_offset(9)
π
packed_pixels_offset β a.k.a. the packed_pixels_offset(9) glow-up π
okay so welcome to the Kernel API Manual, bestie β this page is packed_pixels_offset(9) and it's lowkey the most useful little helper in the VKMS format department. let's get into it β¨
β¨ NAME β¨
packed_pixels_offset β get the offset of the block containing the pixel at coordinates x/y. that's it, that's the whole vibe π«Ά
πΈ SYNOPSIS πΈ
void packed_pixels_offset (const struct vkms_frame_info *frame_info ,
int x , int y , int plane_index , int *offset , int *rem_x , int *rem_y
);
like, six args, one void return, zero drama. she's an in-place queen π
π¦ ARGUMENTS π¦
frame_infoβ the buffer metadata. the whole context, the backstory, the lore πxβ the x coordinate of the wanted pixel in the buffer πyβ the y coordinate of the wanted pixel in the buffer πplane_indexβ which plane we're using, index-style ποΈoffsetβ out-param: the returned offset inside the buffer of the block π€rem_xβ out-param: the returned X coordinate of the requested pixel inside the block π―rem_yβ out-param: the returned Y coordinate of the requested pixel inside the block π―
π DESCRIPTION π
so here's the tea β some pixel formats straight up store multiple pixels in one block β DRM_FORMAT_R* is the classic example β which means those pixels are not individually addressable. you can't just scoot up to one of them and say hi. π
this function hands you back 3 values: the offset of the whole block, plus the coordinate of the requested pixel inside that block. the way that works is honestly iconic.
for example (and this is the actual example, not me making things up π₯): if the format is DRM_FORMAT_R1 and the requested coordinate is 13,5, then:
- the
offsetwill point to the byte5*pitches + 13/8β that's the second byte of the 5th line π§ - and the
rem_x/rem_ycoordinates will be(13 % 8, 5 % 1)=(5, 0)β
so with this function, the caller literally just has to extract the correct pixel from the block. that's the whole job. no cap. π
π₯ SEE ALSO π₯
kernel file ./drivers/gpu/drm/vkms/vkms_formats.c, plus the whole friend group:
packed_pixels_addr(9)get_block_step_bytes(9)packed_pixels_addr_1x1(9)get_subsampling(9)get_subsampling_offset(9)READ_LINE(9)READ_LINE_ARGB8888(9)READ_LINE_le16161616(9)READ_LINE_YUV_SEMIPLANAR(9)vkms_writeback_row(9)get_pixel_read_line_function(9)swap_uv_columns(9)get_conversion_matrix_to_argb_u16(9)get_pixel_write_function(9)
ngl if you're dealing with packed formats and you skip this one, you're gonna have a bad time. go read the whole crew above. iykyk π
okay bye bestie!! this page lives in ./drivers/gpu/drm/vkms and it was dated October 2026 β so yeah, she's fresh, she's documented, she's slaying. mwah πππ
π¦ 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