summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/intel_pm.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2013-05-04 00:23:40 +0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-05-21 13:26:52 +0400
commiteaa591ec528ad75bb4c77606c5cb671f05e04db6 (patch)
tree3021f454514d44379ecf9f9b5d57c24341f64b36 /drivers/gpu/drm/i915/intel_pm.c
parent7366937312d4e406539b1cf70e1562358bdd560e (diff)
downloadlinux-eaa591ec528ad75bb4c77606c5cb671f05e04db6.tar.xz
drm/i915: fix haswell linetime watermarks calculation
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@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_pm.c')
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 198d9c9ada68..2c406ddc6354 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2093,7 +2093,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