[Intel-gfx] [PATCH 4/9] drm/i915: fix haswell linetime watermarks calculation
Paulo Zanoni
przanoni at gmail.com
Fri May 3 22:23:40 CEST 2013
From: Paulo Zanoni <paulo.r.zanoni at intel.com>
Move the "*8" calculation to the left side so we don't propagate
rounding errors. Also use DIV_ROUND_CLOSEST because that's what the
spec says we need to do.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
drivers/gpu/drm/i915/intel_pm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 4cc5f99..8468b40 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
* row at the given clock rate, multiplied by 8.
* */
temp |= PIPE_WM_LINETIME_TIME(
- ((mode->htotal * 1000) / mode->clock) * 8);
+ DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock));
/* IPS watermarks are only used by pipe A, and are ignored by
* pipes B and C. They are calculated similarly to the common
--
1.7.10.4
More information about the Intel-gfx
mailing list