Skip to content

Commit

Permalink
drm/i915: Refactor wm_lp to level calculation
Browse files Browse the repository at this point in the history
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ä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Ville Syrjälä authored and Daniel Vetter committed Oct 15, 2013
1 parent a5db6b6 commit b380ca3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/gpu/drm/i915/intel_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit b380ca3

Please sign in to comment.