drm_mode_size_dumb(9)
๐ 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 bufferhw_pitch_alignโ Hardware scanline alignment in byteshw_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 ๐
- Kernel file
./drivers/gpu/drm/drm_dumb_buffers.coverview(9) drm_mode_mmap_dumb_ioctl(9)
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
- 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