STRUCT DRM_PLANE_FUNCS(9)
β¨ struct drm_plane_funcs β¨
okay so bestie, we're in the Kernel API Manual today and the star of the show is struct drm_plane_funcs β literally the whole personality of your DRM plane driver lives in this one struct π
πΈ NAME πΈ
struct drm_plane_funcs β driver plane control functions (yes it's giving "the entire job description of a plane driver", no cap)
π SYNOPSIS π
struct drm_plane_funcs {
int (*update_plane)(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w,
unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w,
uint32_t src_h, struct drm_modeset_acquire_ctx *ctx);
int (*disable_plane)(struct drm_plane *plane, struct
drm_modeset_acquire_ctx *ctx);
void (*destroy)(struct drm_plane *plane);
void (*reset)(struct drm_plane *plane);
int (*set_property)(struct drm_plane *plane, struct drm_property
*property, uint64_t val);
struct drm_plane_state *(*atomic_create_state)(struct drm_plane
*plane);
struct drm_plane_state *(*atomic_duplicate_state)(struct drm_plane
*plane);
void (*atomic_destroy_state)(struct drm_plane *plane, struct
drm_plane_state *state);
int (*atomic_set_property)(struct drm_plane *plane, struct
drm_plane_state *state, struct drm_property *property, uint64_t val);
int (*atomic_get_property)(struct drm_plane *plane, const struct
drm_plane_state *state, struct drm_property *property, uint64_t *val);
int (*late_register)(struct drm_plane *plane);
void (*early_unregister)(struct drm_plane *plane);
void (*atomic_print_state)(struct drm_printer *p, const struct
drm_plane_state *state);
bool (*format_mod_supported)(struct drm_plane *plane, uint32_t
format, uint64_t modifier);
bool (*format_mod_supported_async)(struct drm_plane *plane, u32
format, u64 modifier);
};
π Members π
π update_plane
This is the legacy entry point to enable and configure the plane for the given CRTC and framebuffer. Warning bestie: it is never called to disable the plane, i.e. the passed-in crtc and fb paramters are never NULL.
The source rectangle in frame buffer memory coordinates is given by the src_x, src_y, src_w and src_h parameters (as 16.16 fixed point values). Devices that don't support subpixel plane coordinates can ignore the fractional part β lucky them π
The destination rectangle in CRTC coordinates is given by the crtc_x, crtc_y, crtc_w and crtc_h parameters (as integer values). Devices scale the source rectangle to the destination rectangle. If scaling is not supported, and the source rectangle size doesn't match the destination rectangle size, the driver must return a -EINVAL error β no improvised stretching, periodt π
Drivers implementing atomic modeset should use drm_atomic_helper_update_plane to implement this hook.
RETURNS:
0 on success or a negative error code on failure.
π disable_plane
This is the legacy entry point to disable the plane. The DRM core calls this method in response to a DRM_IOCTL_MODE_SETPLANE IOCTL call with the frame buffer ID set to 0. Disabled planes must not be processed by the CRTC.
Drivers implementing atomic modeset should use drm_atomic_helper_disable_plane to implement this hook.
RETURNS:
0 on success or a negative error code on failure.
π destroy
Clean up plane resources. This is only called at driver unload time through drm_mode_config_cleanup since a plane cannot be hotplugged in DRM. (so likeβ¦ you get exactly one goodbye, make it count π₯²)
π reset
Reset plane hardware and software state to off. This function isn't called by the core directly, only through drm_mode_config_reset. It's not a helper hook only for historical reasons β iconic lore honestly.
Atomic drivers can use drm_atomic_helper_plane_reset to reset atomic state using this hook.
π set_property
This is the legacy entry point to update a property attached to the plane.
This callback is optional if the driver does not support any legacy driver-private properties. For atomic drivers it is not used because property handling is done entirely in the DRM core.
RETURNS:
0 on success or a negative error code on failure.
π atomic_create_state
Allocate a pristine, initialized, state for the plane object and return it. This callback must have no side effects: in particular, the returned state must not be assigned to the object's state pointer and it must not affect the hardware state. Pristine means pristine bestie, don't get cute with it π
RETURNS:
A new, pristine, plane state instance or an error pointer on failure.
π atomic_duplicate_state
Duplicate the current atomic state for this plane and return it. The core and helpers guarantee that any atomic state duplicated with this hook and still owned by the caller (i.e. not transferred to the driver by calling drm_mode_config_funcs.atomic_commit) will be cleaned up by calling the atomic_destroy_state hook in this structure.
This callback is mandatory for atomic drivers.
Atomic drivers which don't subclass struct drm_plane_state should use drm_atomic_helper_plane_duplicate_state. Drivers that subclass the state structure to extend it with driver-private state should use __drm_atomic_helper_plane_duplicate_state to make sure shared state is duplicated in a consistent fashion across drivers.
It is an error to call this hook before drm_plane.state has been initialized correctly.
NOTE: If the duplicate state references refcounted resources this hook must acquire a reference for each of them. The driver must release these references again in atomic_destroy_state. Refcount hygiene is not optional, it's a lifestyle π«Ά
RETURNS:
Duplicated atomic state or NULL when the allocation failed.
π atomic_destroy_state
Destroy a state duplicated with atomic_duplicate_state and release or unreference all resources it references. Cleanup queen behaviour only β¨
This callback is mandatory for atomic drivers.
π atomic_set_property
Decode a driver-private property value and store the decoded value into the passed-in state structure. Since the atomic core decodes all standardized properties (even for extensions beyond the core set of properties which might not be implemented by all drivers) this requires drivers to subclass the state structure.
Such driver-private properties should really only be implemented for truly hardware/vendor specific state. Instead it is preferred to standardize atomic extension and decode the properties used to expose such an extension in the core.
Do not call this function directly, use drm_atomic_plane_set_property instead.
This callback is optional if the driver does not support any driver-private atomic properties.
NOTE: This function is called in the state assembly phase of atomic modesets, which can be aborted for any reason (including on userspace's request to just check whether a configuration would be possible). Drivers MUST NOT touch any persistent state (hardware or software) or data structures except the passed in state parameter. Like, hands off literally everything else π€ Also since userspace controls in which order properties are set this function must not do any input validation (since the state update is incomplete and hence likely inconsistent). Instead any such input validation must be done in the various atomic_check callbacks.
RETURNS:
0 if the property has been found, -EINVAL if the property isn't implemented by the driver (which shouldn't ever happen, the core only asks for properties attached to this plane). No other validation is allowed by the driver. The core already checks that the property value is within the range (integer, valid enum value, ...) the driver set when registering the property.
π atomic_get_property
Reads out the decoded driver-private property. This is used to implement the GETPLANE IOCTL.
Do not call this function directly, use drm_atomic_plane_get_property instead.
This callback is optional if the driver does not support any driver-private atomic properties.
RETURNS:
0 on success, -EINVAL if the property isn't implemented by the driver (which should never happen, the core only asks for properties attached to this plane).
π late_register
This optional hook can be used to register additional userspace interfaces attached to the plane like debugfs interfaces. It is called late in the driver load sequence from drm_dev_register. Everything added from this callback should be unregistered in the early_unregister callback. What goes up must come down, that's the vibe π
Returns:
0 on success, or a negative error code on failure.
π early_unregister
This optional hook should be used to unregister the additional userspace interfaces attached to the plane from late_register. It is called from drm_dev_unregister, early in the driver unload sequence to disable userspace access before data structures are torndown.
π atomic_print_state
If driver subclasses struct drm_plane_state, it should implement this optional hook for printing additional driver specific state.
Do not call this directly, use drm_atomic_plane_print_state instead.
π format_mod_supported
This optional hook is used for the DRM to determine if the given format/modifier combination is valid for the plane. This allows the DRM to generate the correct format bitmask (which formats apply to which modifier), and to validate modifiers at atomic_check time.
If not present, then any modifier in the plane's modifier list is allowed with any of the plane's formats.
Returns:
True if the given modifier is valid for that format on the plane. False otherwise.
π format_mod_supported_async
This optional hook is used for the DRM to determine if for asynchronous flip the given format/modifier combination is valid for the plane. This allows the DRM to generate the correct format bitmask (which formats apply to which modifier), and to validate modifiers at atomic_check time.
Returns:
True if the given modifier is valid for that format on the plane. False otherwise.
π¦ SEE ALSO π¦
Kernel file ./include/drm/drm_plane.h plus the whole squad: struct drm_plane_state(9), enum drm_plane_type(9), struct drm_plane(9), drmm_universal_plane_alloc(9), drm_universal_plane_alloc(9), drm_plane_index(9), drm_plane_mask(9), drm_plane_find(9), drm_for_each_plane_mask(9), drm_for_each_legacy_plane(9), drm_for_each_plane(9) β go read them, they're all lowkey essential iykyk π
that's the whole page bestie, 10/10 no notes π
this came to you straight out of ./include/drm, dated October 2026, same struct drm_plane_funcs(9) energy as always β go make some pixels move, you got this π₯π
π¦ 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