drm_gem_fb_c...e_with_dirty(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_gem_fb_c...e_with_dirty(9) β€” Kernel API Manual ✨

okay bestie, sit down, because this one is from the Kernel API Manual and it's genuinely so useful 🫢


🌸 NAME 🌸

drm_gem_fb_create_with_dirty β€” the helper function for the &drm_mode_config_funcs.fb_create callback πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

struct drm_framebuffer * drm_gem_fb_create_with_dirty (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 that signature. main character energy fr fr πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the DRM device, obvs πŸ–₯️
  • file β€” the DRM file that's holding the GEM handle(s) backing the framebuffer, iykyk
  • info β€” pixel format information ✨
  • mode_cmd β€” the metadata straight from the userspace framebuffer creation request πŸ“¨

πŸ”₯ DESCRIPTION πŸ”₯

so this function creates a brand-new framebuffer object, described by drm_mode_fb_cmd2. and that description? it includes handles for the buffer(s) backing the framebuffer, no cap πŸ’―

drm_atomic_helper_dirtyfb gets used as the dirty callback, which gives you framebuffer flushing through the atomic machinery βš™οΈ. lowkey if you don't need the dirty callback, just use drm_gem_fb_create instead β€” periodt.

also the function does buffer size validation, so it's looking out for you 🫢

drivers should also call drm_plane_enable_fb_damage_clips on all planes so userspace can use damage clips with the ATOMIC IOCTL too πŸ‘€ don't skip this one bestie.

drivers can use this as their drm_mode_config_funcs.fb_create callback β€” and the ADDFB2 IOCTL is what calls into this callback 🌈


⭐ RETURN ⭐

a pointer to a drm_framebuffer on success πŸŽ‰ or an error pointer on failure 😭 (the classic duality of man)


🧚 SEE ALSO 🧚

kernel file ./drivers/gpu/drm/drm_gem_framebuffer_helper.c plus the whole friend group:


and that's the page, bestie πŸ’œ this little icon lives in ./drivers/gpu/drm and the version's dated October 2026 β€” go slay some framebuffers, ily πŸŽ€βœ¨

πŸ“¦ where this page comes from