Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jouni Högander" <jouni.hogander@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/7] drm/i915/psr: Extend SU area to cover cursor fully if needed
Date: Mon, 18 Dec 2023 19:49:59 +0200	[thread overview]
Message-ID: <20231218175004.52875-3-jouni.hogander@intel.com> (raw)
In-Reply-To: <20231218175004.52875-1-jouni.hogander@intel.com>

In case early transport is enabled SU area needs to be extended
to cover cursor area fully when cursor is in SU area.

Bspec: 68927

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 38 +++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index b6e2e70e1290..8a350b9e33cd 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -2011,6 +2011,29 @@ static void intel_psr2_sel_fetch_pipe_alignment(const struct intel_crtc_state *c
 		pipe_clip->y2 = ((pipe_clip->y2 / y_alignment) + 1) * y_alignment;
 }
 
+/*
+ * When early transport is in use we need to extend SU area to cover
+ * cursor fully when cursor is in SU area.
+ */
+static void
+intel_psr2_sel_fetch_et_alignment(struct intel_crtc_state *crtc_state,
+				  struct intel_plane_state *cursor_state,
+				  struct drm_rect *pipe_clip)
+{
+	struct drm_rect inter;
+
+	if (!crtc_state->enable_psr2_su_region_et ||
+	    !cursor_state->uapi.visible)
+		return;
+
+	inter = *pipe_clip;
+	if (!drm_rect_intersect(&inter, &cursor_state->uapi.dst))
+		return;
+
+	clip_area_update(pipe_clip, &cursor_state->uapi.dst,
+			 &crtc_state->pipe_src);
+}
+
 /*
  * TODO: Not clear how to handle planes with negative position,
  * also planes are not updated if they have a negative X
@@ -2052,7 +2075,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
 	struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
 	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = -1 };
-	struct intel_plane_state *new_plane_state, *old_plane_state;
+	struct intel_plane_state *new_plane_state, *old_plane_state,
+		*cursor_plane_state = NULL;
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -2132,6 +2156,13 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 		damaged_area.x2 += new_plane_state->uapi.dst.x1 - src.x1;
 
 		clip_area_update(&pipe_clip, &damaged_area, &crtc_state->pipe_src);
+
+		/*
+		 * Cursor plane new state is stored to adjust su area to cover
+		 * cursor are fully.
+		 */
+		if (plane->id == PLANE_CURSOR)
+			cursor_plane_state = new_plane_state;
 	}
 
 	/*
@@ -2160,6 +2191,11 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 	if (ret)
 		return ret;
 
+	/* Adjust su area to cover cursor fully as necessary */
+	if (cursor_plane_state)
+		intel_psr2_sel_fetch_et_alignment(crtc_state, cursor_plane_state,
+						  &pipe_clip);
+
 	intel_psr2_sel_fetch_pipe_alignment(crtc_state, &pipe_clip);
 
 	/*
-- 
2.34.1


  parent reply	other threads:[~2023-12-18 18:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 17:49 [PATCH 0/7] Early Transport for Panel Replay and PSR Jouni Högander
2023-12-18 17:49 ` [PATCH 1/7] drm: Add eDP 1.5 early transport definition Jouni Högander
2024-01-03 10:46   ` Kahola, Mika
2024-01-10  8:08     ` Hogander, Jouni
2023-12-18 17:49 ` Jouni Högander [this message]
2024-01-05 14:07   ` [PATCH 2/7] drm/i915/psr: Extend SU area to cover cursor fully if needed Kahola, Mika
2023-12-18 17:50 ` [PATCH 3/7] drm/i915/psr: Carry su area in crtc_state Jouni Högander
2024-01-05 14:17   ` Kahola, Mika
2023-12-18 17:50 ` [PATCH 4/7] drm/i915/psr: Calculate and configure CUR_POS_ERLY_TPT Jouni Högander
2024-01-09 12:33   ` Kahola, Mika
2023-12-18 17:50 ` [PATCH 5/7] drm/i915/psr: Configure PIPE_SRCSZ_ERLY_TPT for psr2 early transport Jouni Högander
2024-01-09 12:50   ` Kahola, Mika
2023-12-18 17:50 ` [PATCH 6/7] drm/i915/psr: Enable psr2 early transport as possible Jouni Högander
2024-01-09 12:56   ` Kahola, Mika
2023-12-18 17:50 ` [PATCH 7/7] drm/i915/psr: Disable early transport by default Jouni Högander
2024-01-09 12:57   ` Kahola, Mika
2024-01-10  6:05     ` Hogander, Jouni
2023-12-19  1:02 ` ✗ Fi.CI.CHECKPATCH: warning for Early Transport for Panel Replay and PSR Patchwork
2023-12-19  1:02 ` ✗ Fi.CI.SPARSE: " Patchwork
2023-12-19  1:15 ` ✓ Fi.CI.BAT: success " Patchwork
2023-12-19  4:29 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-01-09 15:19   ` Hogander, Jouni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231218175004.52875-3-jouni.hogander@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox