drm/vblank: Fix vblank timestamp debugs
Subsystems (2)
PATCH 1/1 drm/vblank: Fix vblank timestamp debugs
From: Ville Syrjälä <[email protected]>
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.
--- drivers/gpu/drm/drm_vblank.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_vblank.c +7 -5
@@ -664,14 +664,16 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, delta_ns =div_s64 (1000000LL * (vpos * mode->crtc_htotal + hpos), mode->crtc_clock); -/* save this only for debugging purposes */ - ts_etime =ktime_to_timespec64 (etime); - ts_vblank_time =ktime_to_timespec64 (*vblank_time);/* Subtract time delta from raw timestamp to get final * vblank_time timestamp for end of vblank. */ - etime =ktime_sub_ns (etime, delta_ns); - *vblank_time = etime; + *vblank_time =ktime_sub_ns (etime, delta_ns); + +if ((drm_debug &DRM_UT_VBL ) ==0 ) +return true; + + ts_etime =ktime_to_timespec64 (etime); + 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", pipe, hpos, vpos,
Signature · 6 lines
2.13.6 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
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 thektime_tfirst 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")
Sorry about the mess and thanks for cleaning up behind me.
Arnd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel