All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	intel-gfx@lists.freedesktop.org,
	Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz
Date: Mon, 6 May 2013 10:53:22 -0300	[thread overview]
Message-ID: <CA+gsUGSnG-L6cPpfuCLiZkcxU3om5GdWepTeRsZBrXpsXbz15Q@mail.gmail.com> (raw)
In-Reply-To: <20130505072025.GB15274@cantiga.alporthouse.com>

2013/5/5 Chris Wilson <chris@chris-wilson.co.uk>:
> On Fri, May 03, 2013 at 05:23:42PM -0300, Paulo Zanoni wrote:
>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>
>> With this, that 338 can finally become the correct 337500.
>>
>> Due to the change we need to adjust the intel_dp_aux_ch function to
>> set the correct value, so adjust the division and also use
>> DIV_ROUND_CLOSEST instead of the old "round down" behavior because the
>> spec says the value "should be programmed to get as close as possible
>> to the ideal rate of 2MHz".
>
> Can you please demonstrate an instance where this code produces a
> different value? And only then correct the constants.

I use the 337500 value on the next patch, when setting the
ips_linetime value. The correct frequency is 337500, not 338000.

ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
intel_ddi_get_cdclk_freq);
For a mode with htotal of 2640 [0] we'll have: (i) (2640 * 1000 * 8) /
338000 = 62.48, resulting in 62 and (ii) (2640 * 1000 * 8) / 337500 =
62.57 resulting in 63.

For the case inside intel_dp.c:
Previously we were using 338. So with the old formula we were writing
338/2 = 169 to the register. And 337500 / 169 = 1997.04 (we use 337500
here because it's the real clock value). With the new value of
337500/2000 we'll have 168.75, which is 168 on the round-down case and
169 on the round-closest case. If we write 168 to the register, 337500
/ 168 = 2008.92, and 2008.92 is more distant from 2000 than 1997.04.
So with this patch we're changing the formula but still writing the
same correct value to the DP AUX register.

[0]: That's 1920x1080@50Hz on my DP monitor.

> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre



-- 
Paulo Zanoni

  reply	other threads:[~2013-05-06 13:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 20:23 [PATCH 0/9] Haswell watermarks, round 1 Paulo Zanoni
2013-05-03 20:23 ` [PATCH 1/9] drm/i915: ILK, SNB and IVB don't have linetime watermarks Paulo Zanoni
2013-05-20 13:41   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 2/9] drm/i915: fix linetime_watermarks code Paulo Zanoni
2013-05-05  7:19   ` Chris Wilson
2013-05-06 13:13     ` Paulo Zanoni
2013-05-06 13:43       ` Chris Wilson
2013-05-09 19:55         ` [PATCH 2/9] drm/i915: remove intel_update_linetime_watermarks Paulo Zanoni
2013-05-20 13:48           ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks Paulo Zanoni
2013-05-20 13:42   ` Ville Syrjälä
2013-05-21  9:26   ` Daniel Vetter
2013-05-21 14:33     ` Paulo Zanoni
2013-05-21 14:59       ` Daniel Vetter
2013-05-03 20:23 ` [PATCH 4/9] drm/i915: fix haswell linetime watermarks calculation Paulo Zanoni
2013-05-20 13:53   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 5/9] drm/i915: use the correct clock when calculating linetime watermarks Paulo Zanoni
2013-05-20 14:00   ` Ville Syrjälä
2013-05-21  9:35   ` Daniel Vetter
2013-05-03 20:23 ` [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz Paulo Zanoni
2013-05-05  7:20   ` Chris Wilson
2013-05-06 13:53     ` Paulo Zanoni [this message]
2013-05-20 14:11   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 7/9] drm/i915: set the IPS linetime watermark Paulo Zanoni
2013-05-20 14:05   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 8/9] drm/i915: MCH_SSKPD is a 64 bit register on Haswell Paulo Zanoni
2013-05-20 13:38   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround Paulo Zanoni
2013-05-20 13:37   ` Ville Syrjälä
2013-05-21 10:01   ` Daniel Vetter
2013-05-21 13:27     ` Paulo Zanoni
2013-05-23 10:36       ` Ville Syrjälä
2013-05-23 10:51         ` Daniel Vetter

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=CA+gsUGSnG-L6cPpfuCLiZkcxU3om5GdWepTeRsZBrXpsXbz15Q@mail.gmail.com \
    --to=przanoni@gmail.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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 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.