public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Cc: daniel.vetter@intel.com, jani.nikula@linux.intel.com,
	seanpaul@chromium.org, airlied@linux.ie,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/vblank: Fix delta_ns to an absolute value
Date: Fri, 1 Sep 2017 16:36:25 +0300	[thread overview]
Message-ID: <20170901133625.GT4914@intel.com> (raw)
In-Reply-To: <1504249636-11681-1-git-send-email-hoegeun.kwon@samsung.com>

On Fri, Sep 01, 2017 at 04:07:16PM +0900, Hoegeun Kwon wrote:
> If scanout started, we should reduce etime by delta_ns. But delta_ns
> is negative if scanout has not started. If delta_ns is negative,
> subtraction of delta_ns from etime increases etime. This is wrong, the
> etime should not be increased, so you have to make delta_ns an
> absolute value.
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> ---
> 
> Hello all,
> 
> I think that the etime should not be increased.
> In cases where delta_ns is negative, if you get time again after an
> interrupt call, there is a problem that the time obtained from the
> interrupt becomes the future time instead of the past time.
> 
> Please let me know if this patch is wrong.

It is wrong. The timestamp corresponds to the first active pixel of the
frame/field. So while between vblank start and active start we expect
to get a timestamp that is in the future.

> 
> Best regards,
> Hoegeun
> 
>  drivers/gpu/drm/drm_vblank.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 70f2b95..a3e0176 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -684,7 +684,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	/* Subtract time delta from raw timestamp to get final
>  	 * vblank_time timestamp for end of vblank.
>  	 */
> -	etime = ktime_sub_ns(etime, delta_ns);
> +	etime = ktime_sub_ns(etime, abs(delta_ns));
>  	*vblank_time = ktime_to_timeval(etime);
>  
>  	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2017-09-01 13:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170901070725epcas1p288a5be80c3a3edb02433d24f5beed338@epcas1p2.samsung.com>
2017-09-01  7:07 ` [PATCH] drm/vblank: Fix delta_ns to an absolute value Hoegeun Kwon
2017-09-01 13:36   ` Ville Syrjälä [this message]
2017-09-04  7:36     ` Daniel Vetter
2017-09-05  6:36       ` Hoegeun Kwon

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=20170901133625.GT4914@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hoegeun.kwon@samsung.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanpaul@chromium.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