packed_pixels_offset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 offset will point to the byte 5*pitches + 13/8 β€” that's the second byte of the 5th line 🧚
  • and the rem_x/rem_y coordinates 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:


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