In __drm_atomic_helper_plane_state_init(), pixel_blend_mode is always
reset to DRM_MODE_BLEND_PREMULTI. That was consistent while
drm_plane_create_blend_mode_property() required PREMULTI in the
supported modes, but it now falls back to COVERAGE or PIXEL_NONE when
the driver doesn't support PREMULTI. The hardcoded default may therefore
not be a blend mode the hardware can do, nor one the property
advertises.

Initialize pixel_blend_mode from the blend mode property default
instead, keeping DRM_MODE_BLEND_PREMULTI for planes without the
property.

Fixes: 9813e158d13d ("drm/drm_blend: allow blend mode property without 
PREMULTI")
Reviewed-by: Leandro Ribeiro <[email protected]>
Signed-off-by: Melissa Wen <[email protected]>
---
 drivers/gpu/drm/drm_atomic_state_helper.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
b/drivers/gpu/drm/drm_atomic_state_helper.c
index d90d1d7c9cf9..a2ef272e9f27 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -278,7 +278,14 @@ void __drm_atomic_helper_plane_state_init(struct 
drm_plane_state *plane_state,
        plane_state->rotation = DRM_MODE_ROTATE_0;
 
        plane_state->alpha = DRM_BLEND_ALPHA_OPAQUE;
+
        plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+       if (plane->blend_mode_property) {
+               if (!drm_object_property_get_default_value(&plane->base,
+                                                          
plane->blend_mode_property,
+                                                          &val))
+                       plane_state->pixel_blend_mode = val;
+       }
 
        if (plane->color_encoding_property) {
                if (!drm_object_property_get_default_value(&plane->base,
-- 
2.53.0

Reply via email to