[PATCH v3 2/4] amd/display: add cursor alpha and blend mode checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't want a semi-transparent overlay to make the cursor plane
semi-transparent as well. Same for the pixel blend mode.

Signed-off-by: Simon Ser <contact@xxxxxxxxxxx>
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Cc: Harry Wentland <hwentlan@xxxxxxx>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@xxxxxxx>
Cc: Michel Dänzer <michel@xxxxxxxxxxx>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f60858112d3d..df40f74f5a15 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9853,6 +9853,20 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
 			return -EINVAL;
 		}
 
+		if (new_underlying_state->alpha != DRM_BLEND_ALPHA_OPAQUE) {
+			drm_dbg_atomic(crtc->dev,
+				       "Cursor [PLANE:%d:%s] can't be used with non-opaque underlying [PLANE:%d:%s]\n",
+				       cursor->base.id, cursor->name, underlying->base.id, underlying->name);
+			return -EINVAL;
+		}
+
+		if (new_underlying_state->pixel_blend_mode != DRM_MODE_BLEND_PREMULTI) {
+			drm_dbg_atomic(crtc->dev,
+				       "Cursor [PLANE:%d:%s] can't be used with non-premultiplied underlying [PLANE:%d:%s]\n",
+				       cursor->base.id, cursor->name, underlying->base.id, underlying->name);
+			return -EINVAL;
+		}
+
 		/* If this plane covers the whole CRTC, no need to check planes underneath */
 		if (new_underlying_state->crtc_x <= 0 &&
 		    new_underlying_state->crtc_y <= 0 &&
-- 
2.41.0






[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux