Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1724822

[PATCH] drm/vblank: Fix delta_ns to an absolute value

From Hoegeun Kwon <hoegeun.kwon@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] drm/vblank: Fix delta_ns to an absolute value
Date 2017-09-01 09:10 +0200
Message-ID <ukOfw-xa-7@gated-at.bofh.it> (permalink)
References <ukOfw-xa-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] drm/vblank: Fix delta_ns to an absolute value Hoegeun Kwon <hoegeun.kwon@samsung.com> - 2017-09-01 09:10 +0200
  Re: [PATCH] drm/vblank: Fix delta_ns to an absolute value Ville Syrjälä <ville.syrjala@linux.intel.com> - 2017-09-01 15:40 +0200
    Re: [PATCH] drm/vblank: Fix delta_ns to an absolute value Daniel Vetter <daniel@ffwll.ch> - 2017-09-04 09:40 +0200
      Re: [PATCH] drm/vblank: Fix delta_ns to an absolute value Hoegeun Kwon <hoegeun.kwon@samsung.com> - 2017-09-05 08:40 +0200

csiph-web