From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Use DIV_ROUND_CLOSEST() to calculate dot/vco
Date: Mon, 14 Oct 2013 07:43:11 -0700 [thread overview]
Message-ID: <20131014074311.5cf15ec6@jbarnes-desktop> (raw)
In-Reply-To: <1381751431-29424-1-git-send-email-ville.syrjala@linux.intel.com>
On Mon, 14 Oct 2013 14:50:30 +0300
ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Rounding down when calculating the dot/vco frequencies doesn't make much
> sense. Round to closest should give slightly nicer answers.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index fbd028e..baa6ef6 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -329,8 +329,8 @@ static void vlv_clock(int refclk, intel_clock_t *clock)
> {
> clock->m = clock->m1 * clock->m2;
> clock->p = clock->p1 * clock->p2;
> - clock->vco = refclk * clock->m / clock->n;
> - clock->dot = clock->vco / clock->p;
> + clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
> + clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
> }
>
> /**
> @@ -430,8 +430,8 @@ static void pineview_clock(int refclk, intel_clock_t *clock)
> {
> clock->m = clock->m2 + 2;
> clock->p = clock->p1 * clock->p2;
> - clock->vco = refclk * clock->m / clock->n;
> - clock->dot = clock->vco / clock->p;
> + clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
> + clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
> }
>
> static uint32_t i9xx_dpll_compute_m(struct dpll *dpll)
> @@ -443,8 +443,8 @@ static void i9xx_clock(int refclk, intel_clock_t *clock)
> {
> clock->m = i9xx_dpll_compute_m(clock);
> clock->p = clock->p1 * clock->p2;
> - clock->vco = refclk * clock->m / (clock->n + 2);
> - clock->dot = clock->vco / clock->p;
> + clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n + 2);
> + clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
> }
>
> #define INTELPllInvalid(s) do { /* DRM_DEBUG(s); */ return false; } while (0)
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2013-10-14 14:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 11:50 [PATCH 1/2] drm/i915: Use DIV_ROUND_CLOSEST() to calculate dot/vco ville.syrjala
2013-10-14 11:50 ` [PATCH 2/2] drm/i915: Use vlv_clock() in vlv_crtc_clock_get() ville.syrjala
2013-10-14 14:44 ` Jesse Barnes
2013-10-14 14:59 ` Daniel Vetter
2013-10-14 14:43 ` Jesse Barnes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131014074311.5cf15ec6@jbarnes-desktop \
--to=jbarnes@virtuousgeek.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox