From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Shankar, Uma" <uma.shankar@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Srinivas, Vidya" <vidya.srinivas@intel.com>
Subject: Re: [PATCH 1/2] drm/i915: Enable scanline read for gen9 dsi
Date: Tue, 19 Sep 2017 13:29:01 +0300 [thread overview]
Message-ID: <20170919102901.GK4914@intel.com> (raw)
In-Reply-To: <E7C9878FBA1C6D42A1CA3F62AEB6945F7EFFF1AC@BGSMSX104.gar.corp.intel.com>
On Tue, Sep 19, 2017 at 08:49:21AM +0000, Shankar, Uma wrote:
>
>
> >-----Original Message-----
> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of
> >Maarten Lankhorst
> >Sent: Tuesday, September 19, 2017 12:56 PM
> >To: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >Cc: intel-gfx@lists.freedesktop.org; Srinivas, Vidya <vidya.srinivas@intel.com>
> >Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915: Enable scanline read for gen9 dsi
> >
> >Op 18-09-17 om 16:24 schreef Ville Syrjälä:
> >> On Mon, Sep 18, 2017 at 03:57:38PM +0200, Maarten Lankhorst wrote:
> >>> Op 18-09-17 om 15:32 schreef Vidya Srinivas:
> >>>> From: Uma Shankar <uma.shankar@intel.com>
<snip>
> >>>> + WARN_ON(!crtc_vtotal);
> >>>> + if (!crtc_vtotal)
> >>>> + return scanline;
> >>>> +
> >>>> + /* To avoid the race condition where we might cross into the
> >>>> + * next vblank just between the PIPE_FRMTMSTMP and TIMESTAMP_CTR
> >>>> + * reads. We make sure we read PIPE_FRMTMSTMP and
> >TIMESTAMP_CTR
> >>>> + * during the same frame.
> >>>> + */
> >>>> + do {
> >>>> + /*
> >>>> + * This field provides read back of the display
> >>>> + * pipe frame time stamp. The time stamp value
> >>>> + * is sampled at every start of vertical blank.
> >>>> + */
> >>>> + scan_prev_time = I915_READ_FW(PIPE_FRMTMSTMP(crtc-
> >>pipe));
> >>>> +
> >>>> + /*
> >>>> + * The TIMESTAMP_CTR register has the current
> >>>> + * time stamp value.
> >>>> + */
> >>>> + scan_curr_time = I915_READ_FW(GEN7_TIMESTAMP_CTR);
> >>>> +
> >>>> + scan_post_time = I915_READ_FW(PIPE_FRMTMSTMP(crtc-
> >>pipe));
> >>>> + } while (scan_post_time != scan_prev_time);
> >>>> +
> >>>> + /*
> >>>> + * Since the register is 32 bit and the values
> >>>> + * can overflow and wrap around, making sure
> >>>> + * current time accounts for the register
> >>>> + * wrap
> >>>> + */
> >>>> + if (scan_curr_time < scan_prev_time)
> >>>> + scan_curr_time += 0x100000000;
> >>>> +
> >>>> + scanline = div_u64(mul_u64_u32_shr((scan_curr_time -
> >>>> +scan_prev_time),
> >>> Isn't mul_u64_u32_div exactly what you want here?
> >> I think we'd actually want a mul_u32_u32_div(). But that doesn't seem
> >> to exist.
> >Yeah, couldn't find it either. :(
> >
> >Why do we even use the macros, can't we simply do the multiplications and
> >divide without?
> >i915 is only on x86 anyway. :)
>
> mul_u32_u32 handles it differently using x86 assembly instructions (arch/x86/include/asm/div64.h).
> I guess it's more precise than normal u32*u32 multiplication.
It's a workaround for modern gcc which (for whatever reason) can no
longer figure out that on a 32bit machine we can do this witha a
normal 32x32->64 multiplication rather than a full blown 64 bit
multiplication, which would be more expensive.
Earlier gcc versions did work this out correctly without handholding,
but somehow they broke it at some point.
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-09-19 10:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1505391181-9477-2-git-send-email-vidya.srinivas@intel.com>
2017-09-18 13:32 ` [PATCH 1/2] drm/i915: Enable scanline read for gen9 dsi Vidya Srinivas
2017-09-18 13:57 ` Maarten Lankhorst
2017-09-18 14:24 ` Ville Syrjälä
2017-09-19 7:25 ` Maarten Lankhorst
2017-09-19 8:49 ` Shankar, Uma
2017-09-19 10:29 ` Ville Syrjälä [this message]
2017-09-18 14:09 ` Ville Syrjälä
2017-09-19 9:20 ` [PATCH] drm/i915: Enable scanline read based on frame timestamps Vidya Srinivas
2017-09-22 13:27 ` Ville Syrjälä
2017-09-22 15:03 ` Shankar, Uma
2017-09-22 15:41 ` [PATCH v5] " Vidya Srinivas
2017-09-22 15:48 ` Ville Syrjälä
2017-09-23 7:34 ` Saarinen, Jani
2017-09-22 16:09 ` [PATCH v6] " Vidya Srinivas
2017-09-25 9:34 ` Jani Nikula
2017-09-25 10:53 ` [PATCH] " Vidya Srinivas
2017-09-25 13:16 ` Ville Syrjälä
2017-09-25 13:44 ` Shankar, Uma
2017-09-14 11:47 [PATCH] drm/i915: Enable scanline read for gen9 dsi Shankar, Uma
2017-09-14 12:12 ` [PATCH 1/2] " Vidya Srinivas
2017-09-15 10:25 ` Chauhan, Madhav
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=20170919102901.GK4914@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=uma.shankar@intel.com \
--cc=vidya.srinivas@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