[5/5] drm/i915: Add intel_atomic_add_affected_planes()
diff mbox series

Message ID 20190927131432.15978-6-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/5] drm/i915: Switch intel_legacy_cursor_update() to intel_ types
Related show

Commit Message

Ville Syrjälä Sept. 27, 2019, 1:14 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_atomic_add_affected_planes() can't be used in some cases
once we do the uapi vs. hw state split because we'll want
to consider the plane maks in the hw state rather than the
uapi state. Roll our own :(

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_atomic.c | 25 +++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_atomic.h |  3 +++
 drivers/gpu/drm/i915/display/intel_cdclk.c  |  3 +--
 3 files changed, 29 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
index ef714b258707..0fb0a8d91337 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic.c
@@ -443,6 +443,31 @@  intel_atomic_get_crtc_state(struct drm_atomic_state *state,
 	return to_intel_crtc_state(crtc_state);
 }
 
+int intel_atomic_add_affected_planes(struct intel_atomic_state *state,
+				     struct intel_crtc *crtc)
+{
+	const struct intel_crtc_state *old_crtc_state =
+		intel_atomic_get_old_crtc_state(state, crtc);
+	struct intel_plane *plane;
+
+	WARN_ON(!intel_atomic_get_new_crtc_state(state, crtc));
+
+	DRM_DEBUG_ATOMIC("Adding all current planes for [CRTC:%d:%s] to %p\n",
+			 crtc->base.base.id, crtc->base.name, state);
+
+	intel_for_each_plane_mask(plane, state->base.dev,
+				  old_crtc_state->base.plane_mask) {
+		struct intel_plane_state *plane_state =
+			intel_atomic_get_plane_state(state, plane);
+
+		if (IS_ERR(plane_state))
+			return PTR_ERR(plane_state);
+	}
+
+	return 0;
+
+}
+
 const struct intel_plane_state *
 __intel_atomic_get_current_plane_state(struct intel_atomic_state *state,
 				       struct intel_plane *plane)
diff --git a/drivers/gpu/drm/i915/display/intel_atomic.h b/drivers/gpu/drm/i915/display/intel_atomic.h
index 02d626e6ebf1..888962a95dba 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.h
+++ b/drivers/gpu/drm/i915/display/intel_atomic.h
@@ -48,6 +48,9 @@  int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
 			       struct intel_crtc *intel_crtc,
 			       struct intel_crtc_state *crtc_state);
 
+int intel_atomic_add_affected_planes(struct intel_atomic_state *state,
+				     struct intel_crtc *crtc);
+
 const struct intel_plane_state *
 __intel_atomic_get_current_plane_state(struct intel_atomic_state *state,
 				       struct intel_plane *plane);
diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 43564295b864..08167922d7f6 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -2266,8 +2266,7 @@  static int intel_modeset_all_pipes(struct intel_atomic_state *state)
 		if (ret)
 			return ret;
 
-		ret = drm_atomic_add_affected_planes(&state->base,
-						     &crtc->base);
+		ret = intel_atomic_add_affected_planes(state, crtc);
 		if (ret)
 			return ret;