Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 07/11] drm/i915: Extract link_nv12_planes()
Date: Mon, 27 Jan 2025 19:21:52 +0200	[thread overview]
Message-ID: <20250127172156.21928-8-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20250127172156.21928-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Pull the code linking the UV and Y planes together into a
sensible function instead of having the code plastered inside
the higher level loop.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 83 +++++++++++---------
 1 file changed, 47 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 8004ad20ed0a..a1fa40622d35 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4402,6 +4402,52 @@ static bool check_single_encoder_cloning(struct intel_atomic_state *state,
 	return true;
 }
 
+static void link_nv12_planes(struct intel_crtc_state *crtc_state,
+			     struct intel_plane_state *plane_state,
+			     struct intel_plane_state *linked_state)
+{
+	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
+	struct intel_plane *linked = to_intel_plane(linked_state->uapi.plane);
+	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+
+	plane_state->planar_linked_plane = linked;
+
+	linked_state->is_y_plane = true;
+	linked_state->planar_linked_plane = plane;
+	crtc_state->enabled_planes |= BIT(linked->id);
+	crtc_state->active_planes |= BIT(linked->id);
+	crtc_state->update_planes |= BIT(linked->id);
+	crtc_state->data_rate[linked->id] =
+		crtc_state->data_rate_y[plane->id];
+	crtc_state->rel_data_rate[linked->id] =
+		crtc_state->rel_data_rate_y[plane->id];
+	drm_dbg_kms(&dev_priv->drm, "Using %s as Y plane for %s\n",
+		    linked->base.name, plane->base.name);
+
+	/* Copy parameters to slave plane */
+	linked_state->ctl = plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE;
+	linked_state->color_ctl = plane_state->color_ctl;
+	linked_state->view = plane_state->view;
+	linked_state->decrypt = plane_state->decrypt;
+
+	intel_plane_copy_hw_state(linked_state, plane_state);
+	linked_state->uapi.src = plane_state->uapi.src;
+	linked_state->uapi.dst = plane_state->uapi.dst;
+
+	if (icl_is_hdr_plane(dev_priv, plane->id)) {
+		if (linked->id == PLANE_7)
+			plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_7_ICL;
+		else if (linked->id == PLANE_6)
+			plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_6_ICL;
+		else if (linked->id == PLANE_5)
+			plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_5_RKL;
+		else if (linked->id == PLANE_4)
+			plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_4_RKL;
+		else
+			MISSING_CASE(linked->id);
+	}
+}
+
 static void unlink_nv12_plane(struct intel_crtc_state *crtc_state,
 			      struct intel_plane_state *plane_state)
 {
@@ -4481,42 +4527,7 @@ static int icl_check_nv12_planes(struct intel_atomic_state *state,
 			return -EINVAL;
 		}
 
-		plane_state->planar_linked_plane = linked;
-
-		linked_state->is_y_plane = true;
-		linked_state->planar_linked_plane = plane;
-		crtc_state->enabled_planes |= BIT(linked->id);
-		crtc_state->active_planes |= BIT(linked->id);
-		crtc_state->update_planes |= BIT(linked->id);
-		crtc_state->data_rate[linked->id] =
-			crtc_state->data_rate_y[plane->id];
-		crtc_state->rel_data_rate[linked->id] =
-			crtc_state->rel_data_rate_y[plane->id];
-		drm_dbg_kms(&dev_priv->drm, "Using %s as Y plane for %s\n",
-			    linked->base.name, plane->base.name);
-
-		/* Copy parameters to slave plane */
-		linked_state->ctl = plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE;
-		linked_state->color_ctl = plane_state->color_ctl;
-		linked_state->view = plane_state->view;
-		linked_state->decrypt = plane_state->decrypt;
-
-		intel_plane_copy_hw_state(linked_state, plane_state);
-		linked_state->uapi.src = plane_state->uapi.src;
-		linked_state->uapi.dst = plane_state->uapi.dst;
-
-		if (icl_is_hdr_plane(dev_priv, plane->id)) {
-			if (linked->id == PLANE_7)
-				plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_7_ICL;
-			else if (linked->id == PLANE_6)
-				plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_6_ICL;
-			else if (linked->id == PLANE_5)
-				plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_5_RKL;
-			else if (linked->id == PLANE_4)
-				plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_4_RKL;
-			else
-				MISSING_CASE(linked->id);
-		}
+		link_nv12_planes(crtc_state, plane_state, linked_state);
 	}
 
 	return 0;
-- 
2.45.3


  parent reply	other threads:[~2025-01-27 17:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 17:21 [PATCH 00/11] drm/i915: joiner and Y plane fixes and reorganization Ville Syrjala
2025-01-27 17:21 ` [PATCH 01/11] drm/i915: Make sure all planes in use by the joiner have their crtc included Ville Syrjala
2025-01-27 17:21 ` [PATCH 02/11] Revert "drm/i915: Fix NULL ptr deref by checking new_crtc_state" Ville Syrjala
2025-01-27 17:21 ` [PATCH 03/11] drm/i915: Rework joiner and Y plane dependency handling Ville Syrjala
2025-01-27 17:21 ` [PATCH 04/11] drm/i915: s/planar_slave/is_y_plane/ Ville Syrjala
2025-01-27 17:21 ` [PATCH 05/11] drm/i915: Extract unlink_nv12_plane() Ville Syrjala
2025-01-27 17:21 ` [PATCH 06/11] drm/i915: Remove pointless visible check in unlink_nv12_plane() Ville Syrjala
2025-01-27 17:21 ` Ville Syrjala [this message]
2025-01-27 17:21 ` [PATCH 08/11] drm/i915: Rename the variables in icl_check_nv12_planes() Ville Syrjala
2025-01-27 17:21 ` [PATCH 09/11] drm/i915: Move icl+ nv12 plane register mangling into skl_universal_plane.c Ville Syrjala
2025-01-27 17:21 ` [PATCH 10/11] drm/i915: Relocate intel_atomic_check_planes() Ville Syrjala
2025-01-27 17:21 ` [PATCH 11/11] drm/i915: Pimp the Y plane selection debugs Ville Syrjala
2025-02-12  9:39   ` Maarten Lankhorst
2025-02-12 16:46     ` Ville Syrjälä
2025-01-27 21:59 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: joiner and Y plane fixes and reorganization Patchwork
2025-01-27 21:59 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-01-27 22:14 ` ✓ i915.CI.BAT: success " Patchwork
2025-01-28 11:40 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-08 12:41 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: joiner and Y plane fixes and reorganization (rev2) Patchwork
2025-02-08 12:41 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-08 15:12 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-08 16:12 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: joiner and Y plane fixes and reorganization (rev3) Patchwork
2025-02-08 16:12 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-08 18:37 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-09 18:32 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: joiner and Y plane fixes and reorganization (rev4) Patchwork
2025-02-09 18:32 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-09 20:21 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-09 22:47 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: joiner and Y plane fixes and reorganization (rev5) Patchwork
2025-02-09 22:47 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-10  0:44 ` ✓ i915.CI.BAT: success " Patchwork
2025-02-10  2:13 ` ✗ i915.CI.Full: failure " Patchwork

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=20250127172156.21928-8-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.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