drm_mode_size_dumb(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… drm_mode_size_dumb(9)

okay so bestie, welcome to the kernel API manual โ€” this one's all about drm_mode_size_dumb, and it's literally the glow-up your dumb buffers deserve โœจ


๐ŸŒธ NAME ๐ŸŒธ

drm_mode_size_dumb โ€” Calculates the scanline and buffer sizes for dumb buffers

like, it does the math so you don't have to, no cap ๐Ÿงฎ๐Ÿ’–


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

int drm_mode_size_dumb (struct drm_device *dev , struct
drm_mode_create_dumb *args , unsigned long hw_pitch_align , unsigned
long hw_size_align );

๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • dev โ€” the DRM device, your main character ๐Ÿซถ
  • args โ€” Parameters for the dumb buffer
  • hw_pitch_align โ€” Hardware scanline alignment in bytes
  • hw_size_align โ€” Hardware buffer-size alignment in bytes

โœจ DESCRIPTION โœจ

The helper drm_mode_size_dumb calculates the size of the buffer allocation and the scanline size for a dumb buffer. Callers have to set the buffers width, height and color mode in the argument arg. The helper validates the correctness of the input and tests for possible overflows. If successful, it returns the dumb buffer's required scanline pitch and size in args. it's giving "trust but verify" and honestly? iconic ๐Ÿ’…

The parameter hw_pitch_align allows the driver to specifies an alignment for the scanline pitch, if the hardware requires any. The calculated pitch will be a multiple of the alignment. The parameter hw_size_align allows to specify an alignment for buffer sizes. The provided alignment should represent requirements of the graphics hardware. drm_mode_size_dumb handles GEM-related constraints automatically across all drivers and hardware. For example, the returned buffer size is always a multiple of PAGE_SIZE, which is required by mmap. periodt โ€” that page-size thing is non-negotiable, bestie, mmap said so ๐ŸŒˆ


๐Ÿ”ฅ RETURN ๐Ÿ”ฅ

Zero on success, or a negative error code otherwise.

(so if you get a negative number back, that's the universe telling you something went sideways ๐Ÿ˜ญ)


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

go read those too, iykyk ๐Ÿ“š๐Ÿ’œ


and that's the whole vibe check, bestie ๐Ÿ“ this page lives under ./drivers/gpu/drm, dated October 2026 โ€” slay, go make some correctly-sized dumb buffers ๐ŸŽ€๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from