drm/i915/skl: Only disable scalers once
diff mbox

Message ID 1438786776-10775-1-git-send-email-tvrtko.ursulin@linux.intel.com
State New
Headers show

Commit Message

Tvrtko Ursulin Aug. 5, 2015, 2:59 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Only disable scalers once when transitioning from enabled state.

Avoids a lot of log noise as a side effect.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chandra Konduru <chandra.konduru@intel.com>
---
Compile tested only due momentary lack of suitable hardware for testing!!!
---
 drivers/gpu/drm/i915/intel_display.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 83dadb4796a4..b7541a9b5223 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2954,16 +2954,19 @@  static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id)
 /*
  * This function detaches (aka. unbinds) unused scalers in hardware
  */
-static void skl_detach_scalers(struct intel_crtc *intel_crtc)
+static void skl_detach_scalers(struct intel_crtc *intel_crtc,
+			       struct intel_crtc_state *old_intel_crtc_state)
 {
-	struct intel_crtc_scaler_state *scaler_state;
+	struct intel_crtc_scaler_state *scaler_state, *old_scaler_state;
 	int i;
 
 	scaler_state = &intel_crtc->config->scaler_state;
+	old_scaler_state = &old_intel_crtc_state->scaler_state;
 
 	/* loop through and disable scalers that aren't in use */
 	for (i = 0; i < intel_crtc->num_scalers; i++) {
-		if (!scaler_state->scalers[i].in_use)
+		if (!scaler_state->scalers[i].in_use &&
+		    old_scaler_state->scalers[i].in_use)
 			skl_detach_scaler(intel_crtc, i);
 	}
 }
@@ -13665,7 +13668,8 @@  static void intel_begin_crtc_commit(struct drm_crtc *crtc,
 		intel_pipe_update_start(intel_crtc, &intel_crtc->start_vbl_count);
 
 	if (!needs_modeset(crtc->state) && INTEL_INFO(dev)->gen >= 9)
-		skl_detach_scalers(intel_crtc);
+		skl_detach_scalers(intel_crtc,
+				   to_intel_crtc_state(old_crtc_state));
 }
 
 static void intel_finish_crtc_commit(struct drm_crtc *crtc,