get_block_step_bytes(9)
β¨ get_block_step_bytes(9) β¨
okay so bestie, this one lives in the Kernel API Manual and it's literally the little helper that figures out the correct step value between each pixel block when you're reading in a certain direction π no cap, it's giving "glue code that saves your whole render" energy.
πΈ SYNOPSIS πΈ
int get_block_step_bytes (struct drm_framebuffer *fb , enum pixel_read_direction direction , int plane_index );
like, three args, one int back, we love a low-drama signature π«Ά
π ARGUMENTS π
fbβ the framebuffer you're iterating on, bestie. that's the thing you're walking through πdirectionβ the direction of the reading. which way are we going, queen? πplane_indexβ the plane you want the step from β¨
π DESCRIPTION π
so here's the vibe check: the number that comes back is the number of bytes between two consecutive blocks in a direction. that's it, that's the whole thing π¦
but bestie, listen β because of that, the caller may have to read multiple pixels before using the next one. like, the step isn't a per-pixel thing, it's a per-block thing, and those are not the same iykyk π
the example the page gives is iconic: to read from left to right in a DRM_FORMAT_R1 plane, each block contains 8 pixels, so the step must be used only every 8 pixels. the way that math math-ing π§ periodt.
fr fr do not just add the step after every single pixel or it's gonna be a whole mess π
π₯ SEE ALSO π₯
- Kernel file
./drivers/gpu/drm/vkms/vkms_formats.c packed_pixels_offset(9)packed_pixels_addr(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)
like, the whole squad is here, go read them too π
π sign-off π
this gem comes to you from ./drivers/gpu/drm/vkms, dated October 2026 β and yeah, the page header is get_block_step_bytes(9) and the footer says the same thing, so we're full circle, main character energy only βπ
π
go forth and step correctly, 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