[PATCH v3 16/23] rust: drm: kms: add the plane blend-mode property
From: Mike Lothian
Date: Wed Aug 26 2026 - 12:45:46 EST
Expose drm_plane_create_blend_mode_property() so Rust KMS drivers
advertising alpha formats can declare how userspace should interpret
the alpha channel.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Mike Lothian <mike@xxxxxxxxxxxxxx>
---
rust/kernel/drm/kms/plane.rs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/rust/kernel/drm/kms/plane.rs b/rust/kernel/drm/kms/plane.rs
index 62de8a1dad19..f148aed812f2 100644
--- a/rust/kernel/drm/kms/plane.rs
+++ b/rust/kernel/drm/kms/plane.rs
@@ -459,6 +459,22 @@ pub fn enable_fb_damage_clips(&self) {
// registration is exactly what this helper is for.
unsafe { bindings::drm_plane_enable_fb_damage_clips(self.as_raw()) }
}
+
+ /// Attaches the `pixel blend mode` property to this plane.
+ ///
+ /// `supported_modes` is a bitmask of `BIT(DRM_MODE_BLEND_*)`; `DRM_MODE_BLEND_PREMULTI` must
+ /// always be included. Any plane that advertises a pixel format with an alpha channel is
+ /// required to have this property -- `drm_mode_config_validate()` `WARN`s at registration
+ /// otherwise, because userspace has no way to know how the alpha will be interpreted.
+ ///
+ /// Call this during [`KmsDriver::create_objects`](crate::drm::kms::KmsDriver::create_objects),
+ /// before the device is registered.
+ pub fn create_blend_mode_property(&self, supported_modes: BlendModes) -> Result {
+ // SAFETY: `as_raw()` is a valid, not-yet-registered plane.
+ to_result(unsafe {
+ bindings::drm_plane_create_blend_mode_property(self.as_raw(), supported_modes.bits())
+ })
+ }
}
/// A trait implemented by any type that acts as a [`struct drm_plane`] interface.