diff mbox series

[05/11] drm/i915: Extract unlink_nv12_plane()

Message ID 20250127172156.21928-6-ville.syrjala@linux.intel.com (mailing list archive)
State New
Headers show
Series drm/i915: joiner and Y plane fixes and reorganization | expand

Commit Message

Ville Syrjälä Jan. 27, 2025, 5:21 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Pull the details of the nv12 plane unlinking to a small
funciton to make the higher level code less messy.

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

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 875597007461..bc62298b1b49 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4402,6 +4402,24 @@  static bool check_single_encoder_cloning(struct intel_atomic_state *state,
 	return true;
 }
 
+static void unlink_nv12_plane(struct intel_crtc_state *crtc_state,
+			      struct intel_plane_state *plane_state)
+{
+	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
+
+	plane_state->planar_linked_plane = NULL;
+
+	if (plane_state->is_y_plane && !plane_state->uapi.visible) {
+		crtc_state->enabled_planes &= ~BIT(plane->id);
+		crtc_state->active_planes &= ~BIT(plane->id);
+		crtc_state->update_planes |= BIT(plane->id);
+		crtc_state->data_rate[plane->id] = 0;
+		crtc_state->rel_data_rate[plane->id] = 0;
+	}
+
+	plane_state->is_y_plane = false;
+}
+
 static int icl_check_nv12_planes(struct intel_atomic_state *state,
 				 struct intel_crtc *crtc)
 {
@@ -4420,19 +4438,11 @@  static int icl_check_nv12_planes(struct intel_atomic_state *state,
 	 * in the crtc_state->active_planes mask.
 	 */
 	for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
-		if (plane->pipe != crtc->pipe || !plane_state->planar_linked_plane)
+		if (plane->pipe != crtc->pipe)
 			continue;
 
-		plane_state->planar_linked_plane = NULL;
-		if (plane_state->is_y_plane && !plane_state->uapi.visible) {
-			crtc_state->enabled_planes &= ~BIT(plane->id);
-			crtc_state->active_planes &= ~BIT(plane->id);
-			crtc_state->update_planes |= BIT(plane->id);
-			crtc_state->data_rate[plane->id] = 0;
-			crtc_state->rel_data_rate[plane->id] = 0;
-		}
-
-		plane_state->is_y_plane = false;
+		if (plane_state->planar_linked_plane)
+			unlink_nv12_plane(crtc_state, plane_state);
 	}
 
 	if (!crtc_state->nv12_planes)