aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2017-11-13 10:02:10 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2017-11-29 08:10:53 -0500
commitbcbec31ce500fe036f75a19bca5c73bfa6dd420b (patch)
tree72afef93301b9f19150ca7dadeff7af5bb071e36
parent44a2d56429bc9d1f9edd56761bfb504ed68fef01 (diff)
drm/vblank: Fix vblank timestamp debugs
We're currently calling ktime_to_timespec64() on stack garbage hence the debug output for vblank timestamps also contains garbage. Let's assing something to the ktime_t first before we go converting it to a timespec. While at it micro-optimize the ktime_to_timespec64() calls away when vblank debugging isn't enabled. Fixes: 67680d3c0464 ("drm: vblank: use ktime_t instead of timeval") Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keith Packard <keithp@keithp.com> Cc: Sean Paul <seanpaul@chromium.org> Cc: Dave Airlie <airlied@redhat.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171113150210.11311-1-ville.syrjala@linux.intel.com Acked-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--drivers/gpu/drm/drm_vblank.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 09c1c4ff93ca..2c68909637b5 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -664,14 +664,16 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
664 delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos), 664 delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
665 mode->crtc_clock); 665 mode->crtc_clock);
666 666
667 /* save this only for debugging purposes */
668 ts_etime = ktime_to_timespec64(etime);
669 ts_vblank_time = ktime_to_timespec64(*vblank_time);
670 /* Subtract time delta from raw timestamp to get final 667 /* Subtract time delta from raw timestamp to get final
671 * vblank_time timestamp for end of vblank. 668 * vblank_time timestamp for end of vblank.
672 */ 669 */
673 etime = ktime_sub_ns(etime, delta_ns); 670 *vblank_time = ktime_sub_ns(etime, delta_ns);
674 *vblank_time = etime; 671
672 if ((drm_debug & DRM_UT_VBL) == 0)
673 return true;
674
675 ts_etime = ktime_to_timespec64(etime);
676 ts_vblank_time = ktime_to_timespec64(*vblank_time);
675 677
676 DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n", 678 DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
677 pipe, hpos, vpos, 679 pipe, hpos, vpos,