[PATCH 11/13] drm/i915/display: Workaround cursor glitches with PSR2 selective fetch enabled

José Roberto de Souza jose.souza at intel.com
Wed Sep 1 22:58:01 UTC 2021


Not sure why but when moving the cursor fast it causes some artifacts
of the cursor to be left in the cursor path, adding some pixels below
and above cursor fixes the issue.
So leaving this a workaround until proper fix is found.

This is reproducile in TGL and Alderlake-p.

Cc: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 34 ++++++++++++++++++------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 0cc688325436e..1dcc7e0c27797 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1589,14 +1589,32 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 
 		num_clips = drm_plane_get_damage_clips_count(&new_plane_state->uapi);
 
-		/*
-		 * If visibility or plane moved, mark the whole plane area as
-		 * damaged as it needs to be complete redraw in the new and old
-		 * position.
-		 */
-		if (new_plane_state->uapi.visible != old_plane_state->uapi.visible ||
-		    !drm_rect_equals(&new_plane_state->uapi.dst,
-				     &old_plane_state->uapi.dst)) {
+		if (plane->id == PLANE_CURSOR) {
+			const int cursor_h = drm_rect_height(&new_plane_state->uapi.dst);
+			/*
+			 * FIXME: Not sure why but when moving the cursor fast
+			 * it causes some artifacts of the cursor to be left in
+			 * the cursor path, adding some pixels below and above
+			 * cursor fixes the issue.
+			 */
+			damaged_area.y1 = new_plane_state->uapi.dst.y1 - cursor_h / 2;
+			if (damaged_area.y1 < 0)
+				damaged_area.y1 = 0;
+
+			damaged_area.y2 = new_plane_state->uapi.dst.y2 + cursor_h / 2;
+			if (damaged_area.y2 > crtc_state->pipe_src_h)
+				damaged_area.y2 = crtc_state->pipe_src_h;
+
+			clip_area_update(&pipe_clip, &damaged_area);
+			continue;
+		} else if (new_plane_state->uapi.visible != old_plane_state->uapi.visible ||
+			   !drm_rect_equals(&new_plane_state->uapi.dst,
+					    &old_plane_state->uapi.dst)) {
+			/*
+			 * If visibility or plane moved, mark the whole plane area as
+			 * damaged as it needs to be complete redraw in the new and old
+			 * position.
+			 */
 			if (old_plane_state->uapi.visible) {
 				damaged_area.y1 = old_plane_state->uapi.dst.y1;
 				damaged_area.y2 = old_plane_state->uapi.dst.y2;
-- 
2.33.0



More information about the Intel-gfx-trybot mailing list