STRUCT DRM_FRAMEBUFFER_FUNCS(9)
β¨ NAME β¨
struct drm_framebuffer_funcs β framebuffer hooks π
okay so this page is straight out of the Kernel API Manual, and it's literally the lil' bundle of hook functions that the DRM core calls into when it needs your driver to do framebuffer stuff. bestie. it's giving "callback central" and we're obsessed π
πΈ SYNOPSIS πΈ
struct drm_framebuffer_funcs {
void (*destroy)(struct drm_framebuffer *framebuffer);
int (*create_handle)(struct drm_framebuffer *fb, struct drm_file *file_priv, unsigned int *handle);
int (*dirty)(struct drm_framebuffer *framebuffer, struct drm_file *file_priv, unsigned flags, unsigned color, struct drm_clip_rect *clips, unsigned num_clips);
};
like, that's the whole struct. three little function pointers carrying the entire vibe π₯
π§ Members π§
destroyβ the cleanup girlie π she frees your framebuffer resources, and specifically also unreferences the backing storage. The core guarantees it'll call this for every framebuffer that was successfully created by callingdrm_mode_config_funcs.fb_create. And heads up: drivers must also calldrm_framebuffer_cleanupto release the DRM core resources for this framebuffer. two steps, no skipping π«Άcreate_handleβ makes a buffer handle in the driver-specific buffer manager (either GEM or TTM), valid for the passed-instruct drm_file. The core uses this to implement theGETFBIOCTL, which returns β for sufficiently privileged user β also a native buffer handle. why do we care? because it lets modesetting clients transition seamlessly: copy the current screen contents to a private buffer and blend between that and the new contents. iconic behavior fr fr β¨- GEM based drivers should call
drm_gem_handle_createto create the handle. that's the move, no cap. - RETURNS:
0on success or a negative error code on failure. π
- GEM based drivers should call
dirtyβ optional callback for the dirty fb IOCTL. π Userspace can ping the driver through this callback to say "hey, an area of the framebuffer changed, please flush it to the display hardware." It can also be used internally, e.g. by the fbdev emulation β though that's not the case currently. π- See the documentation in
drm_mode.hfor thestruct drm_mode_fb_dirty_cmdfor more info, because all the semantics and arguments have a one to one mapping on this function. like, one to one, literally π - Atomic drivers should use
drm_atomic_helper_dirtyfbto implement this hook. periodt. - RETURNS:
0on success or a negative error code on failure. same energy, no surprises π
- See the documentation in
π¦ SEE ALSO π¦
Kernel file ./include/drm/drm_framebuffer.h β go read it, iykyk:
struct drm_framebuffer(9)drm_framebuffer_get(9)drm_framebuffer_put(9)drm_framebuffer_read_refcount(9)drm_framebuffer_assign(9)struct drm_afbc_framebuffer(9)
ok that's the whole page bestie, go forth and implement your hooks responsibly πβ¨
and that's a wrap, mwah π β this one lives in ./include/drm, dated October 2026, and yes she's still signing off as struct drm_f...buffer_funcs(9) because the terminal column width said so π
π¦ 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