Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use min() instead of hand rolling it

2023-04-13 Thread Golani, Mitulkumar Ajitkumar
Hi Ville

> -Original Message-
> From: Intel-gfx  On Behalf Of Ville
> Syrjala
> Sent: 04 April 2023 23:25
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 3/3] drm/i915: Use min() instead of hand rolling 
> it
> 
> From: Ville Syrjälä 
> 
> Most places in the vblank code use min() to clamp scanline counters below
> vtotal. But we missed one in the gen3/4 pixel counter based codepath.
> 
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/display/intel_vblank.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c
> b/drivers/gpu/drm/i915/display/intel_vblank.c
> index f8bf9810527d..136393d99298 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.c
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.c
> @@ -340,8 +340,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc
> *_crtc,
>* matches how the scanline counter based position works
> since
>* the scanline counter doesn't count the two half lines.
>*/
> - if (position >= vtotal)
> - position = vtotal - 1;
> + position = min(position, vtotal - 1);

changes LGTM. 
Thanks
 
Reviewed-by: Mitul Golani 

> 
>   /*
>* Start of vblank interrupt is triggered at start of hsync,
> --
> 2.39.2



[Intel-gfx] [PATCH 3/3] drm/i915: Use min() instead of hand rolling it

2023-04-04 Thread Ville Syrjala
From: Ville Syrjälä 

Most places in the vblank code use min() to clamp scanline
counters below vtotal. But we missed one in the gen3/4
pixel counter based codepath.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_vblank.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c 
b/drivers/gpu/drm/i915/display/intel_vblank.c
index f8bf9810527d..136393d99298 100644
--- a/drivers/gpu/drm/i915/display/intel_vblank.c
+++ b/drivers/gpu/drm/i915/display/intel_vblank.c
@@ -340,8 +340,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 * matches how the scanline counter based position works since
 * the scanline counter doesn't count the two half lines.
 */
-   if (position >= vtotal)
-   position = vtotal - 1;
+   position = min(position, vtotal - 1);
 
/*
 * Start of vblank interrupt is triggered at start of hsync,
-- 
2.39.2