drm_gem_fb_create(9)
π drm_gem_fb_create β kernel API manual, bestie edition β¨
Okay so real talk, this is drm_gem_fb_create(9) from the Kernel API Manual, and it's genuinely one of those little helper functions that just gets it. Let's go π«Ά
β¨ NAME β¨
drm_gem_fb_create β the helper function for your &drm_mode_config_funcs.fb_create callback. That's the whole vibe. She's a helper, she's a callback plug-in, she's iconic π
π SYNOPSIS π
struct drm_framebuffer * drm_gem_fb_create (struct drm_device *dev ,
struct drm_file *file , const struct drm_format_info *info , const
struct drm_mode_fb_cmd2 *mode_cmd );
Like, look at her signature. Four args, one framebuffer pointer coming back at you. Periodt β
πΈ ARGUMENTS πΈ
devβ the DRM device. Main character energy, obviously πfileβ the DRM file that holds the GEM handle(s) backing the framebuffer. She's the one holding the handles, iykyk π«Άinfoβ pixel format information. All the format deets live here πmode_cmdβ metadata straight from the userspace framebuffer creation request. Handed over by userspace, no cap π
π¦ DESCRIPTION π¦
So this function creates a brand-new framebuffer object, and that object is described by drm_mode_fb_cmd2. And that description? It includes the handles for the buffer(s) backing the framebuffer. Like, handles included, bestie, that's the whole point π
If your hardware has special alignment or pitch requirements, lowkey you have to check those before calling this function β she's not doing that for you. What she does do is buffer size validation, and she does it. Use drm_gem_fb_create_with_dirty if you need framebuffer flushing instead π₯
Drivers can totally use this as their drm_mode_config_funcs.fb_create callback. And the ADDFB2 IOCTL calls into this callback. That's the pipeline, and she ate π
π RETURN π
- A pointer to a
drm_framebufferon success xoxo β¨ - Or an error pointer on failure π (check it, don't ignore it, fr fr)
π§ SEE ALSO π§
Go read the Kernel file ./drivers/gpu/drm/drm_gem_framebuffer_helper.c overview(9) for the full lore, plus all her besties:
drm_gem_fb_get_obj(9)drm_gem_fb_destroy(9)drm_gem_fb_create_handle(9)drm_gem_fb_init_with_funcs(9)drm_gem_fb_create_with_funcs(9)drm_gem_fb_create_with_dirty(9)drm_gem_fb_vmap(9)drm_gem_fb_vunmap(9)drm_gem_fb_begin_cpu_access(9)drm_gem_fb_end_cpu_access(9)drm_gem_fb_afbc_init(9)
π one thing before you dip: everything above is from./drivers/gpu/drm, dated October 2026, and the page itself isdrm_gem_fb_create(9). Slay, bye πβ¨π
π¦ 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