[CI 20/23] drm/i915: Remove crtc->active usage from g4x/vlv code

Harish Chegondi harish.chegondi at intel.com
Thu Apr 18 21:50:10 UTC 2019


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

Track the pipe state in the wm state so that the wm merging across
pipes works without having to consult crtc->active.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |  1 -
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 drivers/gpu/drm/i915/intel_pm.c      | 13 +++++++++++--
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8980beb7ada1..576166c2e7b0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13495,7 +13495,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
 
 			/* FIXME unify this for all platforms */
 			if (!new_crtc_state->active &&
-			    !HAS_GMCH(dev_priv) &&
 			    dev_priv->display.initial_watermarks)
 				dev_priv->display.initial_watermarks(intel_state,
 								     new_intel_crtc_state);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 989b1c4befd1..82440a7f55d0 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -764,6 +764,7 @@ struct vlv_wm_state {
 	struct g4x_pipe_wm normal[NUM_VLV_WM_LEVELS];
 	struct g4x_sr_wm sr[NUM_VLV_WM_LEVELS];
 	u8 num_levels;
+	bool pipe_enabled;
 };
 
 struct vlv_fifo_state {
@@ -782,6 +783,7 @@ struct g4x_wm_state {
 	struct g4x_sr_wm sr;
 	struct g4x_sr_wm hpll;
 	bool fbc_en;
+	bool pipe_enabled;
 };
 
 struct intel_crtc_wm_state {
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index a68012fece54..61e6aa6f5c60 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1390,6 +1390,7 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
 		to_intel_atomic_state(crtc_state->base.state);
 	const struct intel_plane_state *old_plane_state;
 	const struct intel_plane_state *new_plane_state;
+	struct g4x_wm_state *optimal = &crtc_state->wm.g4x.optimal;
 	struct intel_plane *plane;
 	unsigned int dirty = 0;
 	int i;
@@ -1405,6 +1406,8 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
 			dirty |= BIT(plane->id);
 	}
 
+	optimal->pipe_enabled = crtc_state->base.active;
+
 	if (!dirty)
 		return 0;
 
@@ -1546,7 +1549,7 @@ static void g4x_merge_wm(struct drm_i915_private *dev_priv,
 	for_each_intel_crtc(&dev_priv->drm, crtc) {
 		const struct g4x_wm_state *active = &crtc->wm.active.g4x;
 
-		if (!crtc->active)
+		if (!active->pipe_enabled)
 			continue;
 
 		if (!active->sr.enable)
@@ -1961,6 +1964,7 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
 	struct intel_atomic_state *state =
 		to_intel_atomic_state(crtc_state->base.state);
 	bool needs_modeset = drm_atomic_crtc_needs_modeset(&crtc_state->base);
+	struct vlv_wm_state *optimal = &crtc_state->wm.vlv.optimal;
 	const struct intel_plane_state *old_plane_state;
 	const struct intel_plane_state *new_plane_state;
 	struct intel_plane *plane;
@@ -1990,6 +1994,8 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
 	if (needs_modeset)
 		dirty = ~0;
 
+	optimal->pipe_enabled = crtc_state->base.active;
+
 	if (!dirty)
 		return 0;
 
@@ -2136,6 +2142,7 @@ static int vlv_compute_intermediate_wm(struct intel_crtc_state *new_crtc_state)
 		goto out;
 	}
 
+	intermediate->pipe_enabled = optimal->pipe_enabled;
 	intermediate->num_levels = min(optimal->num_levels, active->num_levels);
 
 	for (level = 0; level < intermediate->num_levels; level++) {
@@ -2232,7 +2239,7 @@ static void vlv_merge_wm(struct drm_i915_private *dev_priv,
 	for_each_intel_crtc(&dev_priv->drm, crtc) {
 		const struct vlv_wm_state *active = &crtc->wm.active.vlv;
 
-		if (!crtc->active)
+		if (!active->pipe_enabled)
 			continue;
 
 		if (!active->sr[VLV_WM_LEVEL_PM2].enable)
@@ -6153,6 +6160,7 @@ void g4x_wm_get_hw_state(struct drm_i915_private *dev_priv)
 		if (crtc_state->base.active)
 			active_pipes |= BIT(pipe);
 
+		active->pipe_enabled = crtc_state->base.active;
 		active->sr.enable = wm->sr.enable;
 		active->hpll.enable = wm->hpll.enable;
 		active->fbc_en = wm->fbc_en;
@@ -6328,6 +6336,7 @@ void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv)
 
 		vlv_get_fifo_size(crtc_state);
 
+		active->pipe_enabled = crtc_state->base.active;
 		active->num_levels = wm->level + 1;
 
 		for (level = 0; level < active->num_levels; level++) {
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list