Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2] drm/vblank: Estimate sample time
Date: Thu, 11 Jun 2020 19:09:29 +0300	[thread overview]
Message-ID: <20200611160929.GD6112@intel.com> (raw)
In-Reply-To: <20200611123447.92171-1-chris@chris-wilson.co.uk>

On Thu, Jun 11, 2020 at 01:34:47PM +0100, Chris Wilson wrote:
> Since we have a precise start/end time for the sample, the actual time
> the HW was read back is within that interval, and more likely closer to
> the mean of the interval. Use the mean sample time when estimating the
> vblank time.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Seems reasonable.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/drm_vblank.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index da7b0b0c1090..a7043d268cca 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -710,15 +710,18 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(
>  	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>  			   mode->crtc_clock);
>  
> +	/* Estimate when the sample was taken */
> +	stime += (etime - stime) >> 1;
> +
>  	/* Subtract time delta from raw timestamp to get final
>  	 * vblank_time timestamp for end of vblank.
>  	 */
> -	*vblank_time = ktime_sub_ns(etime, delta_ns);
> +	*vblank_time = ktime_sub_ns(stime, delta_ns);
>  
>  	if (!drm_debug_enabled(DRM_UT_VBL))
>  		return true;
>  
> -	ts_etime = ktime_to_timespec64(etime);
> +	ts_etime = ktime_to_timespec64(stime);
>  	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>  
>  	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
> -- 
> 2.27.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-06-11 16:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 12:30 [Intel-gfx] [PATCH 1/2] drm/vblank: Estimate sample time Chris Wilson
2020-06-11 12:30 ` [Intel-gfx] [PATCH 2/2] drm/i915: Tighten timestamp around vblank sampling Chris Wilson
2020-06-11 12:36   ` Chris Wilson
2020-06-11 16:15   ` Ville Syrjälä
2020-06-11 12:34 ` [Intel-gfx] [PATCH 1/2] drm/vblank: Estimate sample time Chris Wilson
2020-06-11 12:34 ` [Intel-gfx] [PATCH v2] " Chris Wilson
2020-06-11 16:09   ` Ville Syrjälä [this message]
2020-06-11 14:00 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v2] drm/vblank: Estimate sample time (rev2) Patchwork
2020-06-11 18:02 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=20200611160929.GD6112@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox