summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>2026-05-26 15:17:00 -0300
committerDaniel Stone <daniels@collabora.com>2026-07-14 19:24:39 +0100
commit860e748bddcc9291cbdd23e801640aeeba30cc44 (patch)
treead8063184ced6c5bb57f1c9d16a497533f9e9be7 /drivers/gpu
parent9813e158d13d51d20d9257879bf79da7abcc9107 (diff)
drm: ensure blend mode supported if pixel format with alpha exposed
Before "drm/drm_blend: allow blend mode property without PREMULTI", userspace would have to assume that only PREMULTI was supported by drivers that didn't expose the blend mode property. But now userspace shouldn't rely on that, as they can't count with drivers always supporting PREMULTI. Warn if a driver exposes pixel formats with alpha but doesn't expose the blend mode property. This way userspace doesn't have to guess. Drivers triggering this warning must be fixed. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Link: https://patch.msgid.link/20260526181700.25310-3-leandro.ribeiro@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_mode_config.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index f432f485a914..3bcc7bf0900c 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -857,6 +857,25 @@ static void validate_encoder_possible_crtcs(struct drm_encoder *encoder)
encoder->possible_crtcs, crtc_mask);
}
+static void validate_blend_mode_for_alpha_formats(struct drm_plane *plane)
+{
+ const struct drm_format_info *fmt;
+ u32 i;
+
+ /* blend mode property supported, no need to check anything */
+ if (plane->blend_mode_property)
+ return;
+
+ for (i = 0; i < plane->format_count; i++) {
+ fmt = drm_format_info(plane->format_types[i]);
+ if (fmt->has_alpha) {
+ WARN(1, "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
+ plane->base.id, plane->name);
+ break;
+ }
+ }
+}
+
void drm_mode_config_validate(struct drm_device *dev)
{
struct drm_encoder *encoder;
@@ -915,6 +934,8 @@ void drm_mode_config_validate(struct drm_device *dev)
drm_for_each_plane(plane, dev) {
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
num_primary++;
+
+ validate_blend_mode_for_alpha_formats(plane);
}
WARN(num_primary != dev->mode_config.num_crtc,