From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 13/28] drm/i915: fix VLV limits and m/n/p calculations
Date: Tue, 5 Mar 2013 13:49:17 +0200 [thread overview]
Message-ID: <20130305114917.GR4469@intel.com> (raw)
In-Reply-To: <1362172471-7643-14-git-send-email-jbarnes@virtuousgeek.org>
On Fri, Mar 01, 2013 at 01:14:16PM -0800, Jesse Barnes wrote:
> For high res modes m n p calculation is fixed for VLV platform.
>
> Signed-off-by: Vijay Purushothaman <vijay.a.purushothaman@intel.com>
> Signed-off-by: Pallavi G <pallavi.g@intel.com>
> Signed-off-by: Yogesh M <yogesh.mohan.marimuthu@intel.com>
> Signed-off-by: Gajanan Bhat <gajanan.bhat@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++----------
> 1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 3b189fa..fd4a0d4 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -380,21 +380,21 @@ static const intel_limit_t intel_limits_vlv_dac = {
> .m1 = { .min = 2, .max = 3 },
> .m2 = { .min = 11, .max = 156 },
> .p = { .min = 10, .max = 30 },
> - .p1 = { .min = 2, .max = 3 },
> + .p1 = { .min = 1, .max = 3 },
> .p2 = { .dot_limit = 270000,
> .p2_slow = 2, .p2_fast = 20 },
> .find_pll = intel_vlv_find_best_pll,
> };
>
> static const intel_limit_t intel_limits_vlv_hdmi = {
> - .dot = { .min = 20000, .max = 165000 },
> - .vco = { .min = 4000000, .max = 5994000},
> - .n = { .min = 1, .max = 7 },
> + .dot = { .min = 25000, .max = 180000 },
> + .vco = { .min = 4040000, .max = 5960000 },
> + .n = { .min = 1, .max = 5 },
> .m = { .min = 60, .max = 300 }, /* guess */
> .m1 = { .min = 2, .max = 3 },
> - .m2 = { .min = 11, .max = 156 },
> + .m2 = { .min = 15, .max = 149 },
> .p = { .min = 10, .max = 30 },
> - .p1 = { .min = 2, .max = 3 },
> + .p1 = { .min = 1, .max = 3 },
> .p2 = { .dot_limit = 270000,
> .p2_slow = 2, .p2_fast = 20 },
> .find_pll = intel_vlv_find_best_pll,
> @@ -408,7 +408,7 @@ static const intel_limit_t intel_limits_vlv_dp = {
> .m1 = { .min = 2, .max = 3 },
> .m2 = { .min = 11, .max = 156 },
> .p = { .min = 10, .max = 30 },
> - .p1 = { .min = 2, .max = 3 },
> + .p1 = { .min = 1, .max = 3 },
> .p2 = { .dot_limit = 270000,
> .p2_slow = 2, .p2_fast = 20 },
> .find_pll = intel_vlv_find_best_pll,
> @@ -809,10 +809,14 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc,
> int target, int refclk, intel_clock_t *match_clock,
> intel_clock_t *best_clock)
> {
> +#define LONG_OVERFLOW 0x7FFFFFFF
> +#define DIFF_OVERFLOW (LONG_OVERFLOW/10000)
> +
> u32 p1, p2, m1, m2, vco, bestn, bestm1, bestm2, bestp1, bestp2;
> u32 m, n, fastclk;
> u32 updrate, minupdate, fracbits, p;
> - unsigned long bestppm, ppm, absppm;
> + long bestppm, ppm, absppm, ppmdiff, absppmdiff;
> + unsigned long ulMult = 1;
> int dotclk, flag;
>
> flag = 0;
> @@ -841,8 +845,15 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc,
> m = m1 * m2;
> vco = updrate * m;
> if (vco >= limit->vco.min && vco < limit->vco.max) {
> - ppm = 1000000 * ((vco / p) - fastclk) / fastclk;
> - absppm = (ppm > 0) ? ppm : (-ppm);
> + ppmdiff = ((100*vco)/p) - (100*fastclk);
> + absppmdiff = (ppmdiff > 0) ? ppmdiff : (-ppmdiff);
> + ulMult = 1;
> + while (absppmdiff > DIFF_OVERFLOW) {
> + absppmdiff /= 10;
> + ulMult *= 10;
> + }
> + absppm = ((absppmdiff*10000)/fastclk)*ulMult;
> +
This seems to expect long to be >32 bits. If it needs 64bit math it
should use proper sized types, and of course the division needs to
use something like div_s64().
Also it should use abs()/abs64() instead of the open-coded versions.
That would also allow getting rid of some of these temporary variables.
> if (absppm < 100 && ((p1 * p2) > (bestp1 * bestp2))) {
> bestppm = 0;
> flag = 1;
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2013-03-05 11:49 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 21:14 VLV updates Jesse Barnes
2013-03-01 21:14 ` [PATCH 01/28] drm/i915: sprite support for ValleyView Jesse Barnes
2013-03-04 18:23 ` Ville Syrjälä
2013-03-01 21:14 ` [PATCH 02/28] drm/i915: add sprite assertion function for VLV Jesse Barnes
2013-03-04 18:29 ` Ville Syrjälä
2013-03-07 23:24 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 03/28] drm/i915: add constant alpha support to sprite ioctl Jesse Barnes
2013-03-01 21:14 ` [PATCH 04/28] drm/i915: update VLV PLL and DPIO code Jesse Barnes
2013-03-01 21:14 ` [PATCH 05/28] drm/i915: panel power sequencing for VLV eDP Jesse Barnes
2013-03-01 21:43 ` Ville Syrjälä
2013-03-01 21:57 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 06/28] drm/i915: add more VLV IDs Jesse Barnes
2013-03-01 21:14 ` [PATCH 07/28] drm/i915: implement WaForceL3Serialization on VLV and IVB Jesse Barnes
2013-03-01 21:43 ` Ville Syrjälä
2013-03-01 21:58 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 08/28] drm/i915: implement WaGTEnableMiFlush on VLV Jesse Barnes
2013-03-01 21:47 ` Ville Syrjälä
2013-03-01 21:58 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 09/28] drm/i915: implement WaDisablePSDDualDispatchEnable " Jesse Barnes
2013-03-01 21:14 ` [PATCH 10/28] drm/i915: VLV has force wake Jesse Barnes
2013-03-06 18:53 ` Daniel Vetter
2013-03-01 21:14 ` [PATCH 11/28] drm/i915: add power context allocation and setup on VLV Jesse Barnes
2013-03-01 21:14 ` [PATCH 12/28] drm/i915: add more clock gating for VLV, allow force wake at init Jesse Barnes
2013-03-06 18:54 ` Daniel Vetter
2013-03-01 21:14 ` [PATCH 13/28] drm/i915: fix VLV limits and m/n/p calculations Jesse Barnes
2013-03-05 11:49 ` Ville Syrjälä [this message]
2013-03-01 21:14 ` [PATCH 14/28] drm/i915: disable watermarks on VLV, pondicherry takes care of this Jesse Barnes
2013-03-06 18:56 ` Daniel Vetter
2013-03-06 19:09 ` Ville Syrjälä
2013-03-06 19:14 ` Daniel Vetter
2013-03-06 19:19 ` Ville Syrjälä
2013-03-06 19:32 ` Daniel Vetter
2013-03-07 23:12 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 15/28] drm/i915: use gen6 stolen check on VLV Jesse Barnes
2013-03-01 21:14 ` [PATCH 16/28] drm/i915: add Punit read/write routines for VLV Jesse Barnes
2013-03-04 8:43 ` Jani Nikula
2013-03-04 16:35 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 17/28] drm/i915: add media well to VLV force wake routines Jesse Barnes
2013-03-01 21:14 ` [PATCH 18/28] drm/i915: turbo & RC6 support for VLV Jesse Barnes
2013-03-01 21:14 ` [PATCH 19/28] drm/i915: remove VLV MSI IRQ hack Jesse Barnes
2013-03-01 21:14 ` [PATCH 20/28] drm/i915: don't enumerate VGA on VLV Jesse Barnes
2013-03-06 18:58 ` Daniel Vetter
2013-03-06 19:00 ` Ville Syrjälä
2013-03-06 19:09 ` Jesse Barnes
2013-03-06 19:14 ` Ville Syrjälä
2013-03-01 21:14 ` [PATCH 21/28] drm/i915: DSPFW and BLC regs are in the display offset range Jesse Barnes
2013-03-01 21:14 ` [PATCH 22/28] drm/i915: don't use plane pipe select on VLV Jesse Barnes
2013-03-01 21:14 ` [PATCH 23/28] drm/i915: use VLV DIP routines " Jesse Barnes
2013-03-06 19:00 ` Daniel Vetter
2013-03-06 19:09 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 24/28] drm/i915: export intel_dpio_write for use in intel_dp.c Jesse Barnes
2013-03-06 19:02 ` Daniel Vetter
2013-03-06 19:10 ` Jesse Barnes
2013-03-01 21:14 ` [PATCH 25/28] drm/i915/dp: program VSwing and Preemphasis control settings on VLV Jesse Barnes
2013-03-01 21:14 ` [PATCH 26/28] drm/i915: VLV doesn't have HDMI on port C Jesse Barnes
2013-03-01 21:14 ` [PATCH 27/28] drm/i915/dp: don't use ILK paths on VLV Jesse Barnes
2013-03-06 19:04 ` Daniel Vetter
2013-03-01 21:14 ` [PATCH 28/28] drm/i915/dp: add pre-PCH eDP checking to DP detect for VLV Jesse Barnes
2013-03-06 19:05 ` Daniel Vetter
2013-03-06 20:55 ` Jesse Barnes
2013-03-06 21:02 ` Daniel Vetter
2013-03-01 21:59 ` VLV updates Jesse Barnes
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=20130305114917.GR4469@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.