drm_crtc_vblank_helper_get_vblank_timestamp_internal() is called about ~100 times per sec, on a single display. It currently calls drm_debug_enabled(DRM_UT_VBL) to avoid doing ktime_to_timespec64() conversions when the debug logging is disabled.
When CONFIG_DRM_USE_DYNAMIC_DEBUG=Y, the drm_debug_enabled() is redundant, because the following drm_dbg_vbl() already carries a static-key optimization. So move the ktime conversions into the drm_dbg_vbl() argument list, then they are guarded natively by the static key. This avoids the double-check entirely. TBD: if CONFIG_DRM_USE_DYNAMIC_DEBUG=N, this does the ktime conversions unconditionally, so this might not be prudent (yet). Signed-off-by: Jim Cromie <[email protected]> --- drivers/gpu/drm/drm_vblank.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index f78bf37f1e0a..0dac7eec2066 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -803,15 +803,11 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal( */ *vblank_time = ktime_sub_ns(etime, delta_ns); - if (!drm_debug_enabled(DRM_UT_VBL)) - return true; - - ts_etime = ktime_to_timespec64(etime); - ts_vblank_time = ktime_to_timespec64(*vblank_time); - drm_dbg_vbl(dev, "crtc %u : v p(%d,%d)@ %ptSp -> %ptSp [e %d us, %d rep]\n", - pipe, hpos, vpos, &ts_etime, &ts_vblank_time, + pipe, hpos, vpos, + (ts_etime = ktime_to_timespec64(etime), &ts_etime), + (ts_vblank_time = ktime_to_timespec64(*vblank_time), &ts_vblank_time), duration_ns / 1000, i); return true; -- 2.53.0
