On Fri, Aug 29, 2025 at 03:17:02PM +0200, Maarten Lankhorst wrote:
> drm_crtc_accurate_vblank_count takes a spinlock, which we should avoid
> in tracepoints and debug functions.
> 
> This also prevents taking the spinlock 2x during the critical
> section of pipe updates for DSI updates.
> 
> Signed-off-by: Maarten Lankhorst <d...@lankhorst.se>
> ---
>  drivers/gpu/drm/i915/display/intel_crtc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c 
> b/drivers/gpu/drm/i915/display/intel_crtc.c
> index a187db6df2d36..cee00aa2c79de 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -84,8 +84,12 @@ u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc)
>       if (!crtc->active)
>               return 0;
>  
> -     if (!vblank->max_vblank_count)
> -             return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
> +     if (!vblank->max_vblank_count) {
> +             if (!IS_ENABLED(CONFIG_PREEMPT_RT))

The ! seems rather pointless here when you could just swap the two
statements instead.

Could also use a comment to remind us why we're avoiding the use
of the correct function with RT kernels.

With that
Acked-by: Ville Syrjälä <ville.syrj...@linux.intel.com>

> +                     return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
> +             else
> +                     return (u32)drm_crtc_vblank_count(&crtc->base);
> +     }
>  
>       return crtc->base.funcs->get_vblank_counter(&crtc->base);
>  }
> -- 
> 2.50.0

-- 
Ville Syrjälä
Intel

Reply via email to