From b380ca3caa821150fddab0052dcce624d18e88ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Wed, 9 Oct 2013 19:18:01 +0300 Subject: [PATCH] drm/i915: Refactor wm_lp to level calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On HSW the LP1,LP2,LP3 levels are either 1,2,3 or 1,3,4. We make the conversion from LPn to to the level at one point current. Later we're going to do it in a few places, so move it to a separate function. Signed-off-by: Ville Syrjälä Reviewed-by: Paulo Zanoni Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a5503cd7a1c8..9f33e37f8a2d 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -2705,6 +2705,12 @@ static void ilk_wm_merge(struct drm_device *dev, } } +static int ilk_wm_lp_to_level(int wm_lp, const struct intel_pipe_wm *pipe_wm) +{ + /* LP1,LP2,LP3 levels are either 1,2,3 or 1,3,4 */ + return wm_lp + (wm_lp >= 2 && pipe_wm->wm[4].enable); +} + static void hsw_compute_wm_results(struct drm_device *dev, const struct intel_pipe_wm *merged, struct hsw_wm_values *results) @@ -2718,7 +2724,7 @@ static void hsw_compute_wm_results(struct drm_device *dev, for (wm_lp = 1; wm_lp <= 3; wm_lp++) { const struct intel_wm_level *r; - level = wm_lp + (wm_lp >= 2 && merged->wm[4].enable); + level = ilk_wm_lp_to_level(wm_lp, merged); r = &merged->wm[level]; if (!r->enable) -- GitLab