From abfc00b545ba2c4dee1dcb124be59f34df3ed7d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Thu, 5 Mar 2015 21:19:43 +0200 Subject: [PATCH] drm/i915: Simplify VLV drain latency computation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The current drain lantency computation relies on hardcoded limits to determine when the to use the low vs. high precision multiplier. Rewrite the code to use a more straightforward approach. Reviewed-by: Jesse Barnes Signed-off-by: Ville Syrjälä Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_pm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index cc3c2d9eb7f4..c198dbad3e82 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -755,12 +755,15 @@ static bool vlv_compute_drain_latency(struct drm_crtc *crtc, return false; entries = DIV_ROUND_UP(clock, 1000) * pixel_size; - if (IS_CHERRYVIEW(dev)) - *prec_mult = (entries > 32) ? 16 : 8; - else - *prec_mult = (entries > 128) ? 64 : 32; + + *prec_mult = IS_CHERRYVIEW(dev) ? 16 : 64; *drain_latency = (64 * (*prec_mult) * 4) / entries; + if (*drain_latency > DRAIN_LATENCY_MASK) { + *prec_mult /= 2; + *drain_latency = (64 * (*prec_mult) * 4) / entries; + } + if (*drain_latency > DRAIN_LATENCY_MASK) *drain_latency = DRAIN_LATENCY_MASK; -- 2.39.5