Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Add high-precision time to vblank trace event

Store the timestamp of the current vblank in the new field 'time' of the
vblank trace event. If the timestamp is calculated by a driver that
supports high-precision vblank timing, set the field 'high-prec' to
'true'.

User space can now access actual hardware vblank times via the tracing
infrastructure. Tracing applications (such as GPUVis, see [0] for
related discussion), can use the newly added information to conduct a
more accurate analysis of display timing.

v2 Fix author name (missing last name)

[0] https://github.com/mikesart/gpuvis/issues/30

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Heinrich Fink <heinrich.fink@daqri.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190902142412.27846-2-heinrich.fink@daqri.com

authored by

Heinrich Fink and committed by
Daniel Vetter
6914f8eb acff2f86

+12 -5
+10 -4
drivers/gpu/drm/drm_trace.h
··· 13 13 #define TRACE_INCLUDE_FILE drm_trace 14 14 15 15 TRACE_EVENT(drm_vblank_event, 16 - TP_PROTO(int crtc, unsigned int seq), 17 - TP_ARGS(crtc, seq), 16 + TP_PROTO(int crtc, unsigned int seq, ktime_t time, bool high_prec), 17 + TP_ARGS(crtc, seq, time, high_prec), 18 18 TP_STRUCT__entry( 19 19 __field(int, crtc) 20 20 __field(unsigned int, seq) 21 + __field(ktime_t, time) 22 + __field(bool, high_prec) 21 23 ), 22 24 TP_fast_assign( 23 25 __entry->crtc = crtc; 24 26 __entry->seq = seq; 25 - ), 26 - TP_printk("crtc=%d, seq=%u", __entry->crtc, __entry->seq) 27 + __entry->time = time; 28 + __entry->high_prec = high_prec; 29 + ), 30 + TP_printk("crtc=%d, seq=%u, time=%lld, high-prec=%s", 31 + __entry->crtc, __entry->seq, __entry->time, 32 + __entry->high_prec ? "true" : "false") 27 33 ); 28 34 29 35 TRACE_EVENT(drm_vblank_event_queued,
+2 -1
drivers/gpu/drm/drm_vblank.c
··· 1731 1731 send_vblank_event(dev, e, seq, now); 1732 1732 } 1733 1733 1734 - trace_drm_vblank_event(pipe, seq); 1734 + trace_drm_vblank_event(pipe, seq, now, 1735 + dev->driver->get_vblank_timestamp != NULL); 1735 1736 } 1736 1737 1737 1738 /**