public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/vlv: fix up broken precision in vlv_crtc_clock_get
@ 2013-09-25 21:24 Jesse Barnes
  2013-09-25 21:34 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Jesse Barnes @ 2013-09-25 21:24 UTC (permalink / raw)
  To: intel-gfx

From: Chris Wilson <chris@chris-wilson.co.uk>

With some divider values we end up with the wrong result.  So remove the
intermediates (like Ville suggested in the first place) to get the right
answer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5b52ab0..f52e6d4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5084,7 +5084,7 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
 	int pipe = pipe_config->cpu_transcoder;
 	intel_clock_t clock;
 	u32 mdiv;
-	int refclk = 100000, fastclk, update_rate;
+	int refclk = 100000;
 
 	mutex_lock(&dev_priv->dpio_lock);
 	mdiv = vlv_dpio_read(dev_priv, pipe, DPIO_DIV(pipe));
@@ -5096,10 +5096,8 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
 	clock.p1 = (mdiv >> DPIO_P1_SHIFT) & 7;
 	clock.p2 = (mdiv >> DPIO_P2_SHIFT) & 0x1f;
 
-	update_rate = refclk / clock.n;
-	clock.vco = update_rate * clock.m1 * clock.m2;
-	fastclk = clock.vco / clock.p1 / clock.p2;
-	clock.dot = (2 * fastclk);
+	clock.vco = refclk * clock.m1 * clock.m2 / clock.n;
+	clock.dot = 2 * clock.vco / (clock.p1 * clock.p2);
 
 	pipe_config->port_clock = clock.dot / 10;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915/vlv: fix up broken precision in vlv_crtc_clock_get
  2013-09-25 21:24 [PATCH] drm/i915/vlv: fix up broken precision in vlv_crtc_clock_get Jesse Barnes
@ 2013-09-25 21:34 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2013-09-25 21:34 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx

On Wed, Sep 25, 2013 at 02:24:01PM -0700, Jesse Barnes wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> With some divider values we end up with the wrong result.  So remove the
> intermediates (like Ville suggested in the first place) to get the right
> answer.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-25 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25 21:24 [PATCH] drm/i915/vlv: fix up broken precision in vlv_crtc_clock_get Jesse Barnes
2013-09-25 21:34 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox