Skip to contentSkip to conversation

Patch "drm/vblank: Fix vblank timestamp debugs" has been added to the 4.15-stable tree

PATCH [email protected] 1 participant 1 message Mar 16, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drm/vblank: Fix vblank timestamp debugs

to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-vblank-fix-vblank-timestamp-debugs.patch
and it can be found in the queue-4.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Fri Mar 16 15:11:07 CET 2018

From: "Ville Syrj�l�" <[email protected]>
Date: Mon, 13 Nov 2017 17:02:10 +0200
Subject: drm/vblank: Fix vblank timestamp debugs

From: "Ville Syrj�l�" <[email protected]>

[ Upstream commit bcbec31ce500fe036f75a19bca5c73bfa6dd420b ]

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 <[email protected]>
Cc Keith Packard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Dave Airlie <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_vblank.c +7 -5
@@ -663,14 +663,16 @@ bool drm_calc_vbltimestamp_from_scanoutp
 	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,

Patches currently in stable-queue which might be from [email protected] are

queue-4.15/drm-vblank-fix-vblank-timestamp-debugs.patch queue-4.15/video-hdmi-allow-empty-hdmi-infoframes.patch queue-4.15/drm-edid-set-eld-connector-type-in-drm_edid_to_eld.patch