diff mbox series

[6/9] drm/i915: Move the min/max scanline sanity check into intel_vblank_evade()

Message ID 20231213102519.13500-7-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Cursor vblank evasion | expand

Commit Message

Ville Syrjälä Dec. 13, 2023, 10:25 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

There isn't really any reason to make the caller suffer through
checking the vblank evasion min/max scanlines. If we somehow
ended up with bogus values (which really shouldn't happen)
then just skip the actual vblank evasion loop but otherwise
plow ahead as normal.

The only "real" change is that we now get+put a vblank reference
even if the min/max values are bogus, previously we skipped
directly to the end.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_crtc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Shankar, Uma Dec. 20, 2023, 11:27 a.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Wednesday, December 13, 2023 3:55 PM
> To: intel-gfx@lists.freedesktop.org
> Subject: [PATCH 6/9] drm/i915: Move the min/max scanline sanity check into
> intel_vblank_evade()
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> There isn't really any reason to make the caller suffer through checking the vblank
> evasion min/max scanlines. If we somehow ended up with bogus values (which
> really shouldn't happen) then just skip the actual vblank evasion loop but
> otherwise plow ahead as normal.
> 
> The only "real" change is that we now get+put a vblank reference even if the
> min/max values are bogus, previously we skipped directly to the end.

Looks fine to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_crtc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c
> b/drivers/gpu/drm/i915/display/intel_crtc.c
> index 26a07b2219bf..11a6a4b0a258 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -544,6 +544,9 @@ static int intel_vblank_evade(struct
> intel_vblank_evade_ctx *evade)
>  	DEFINE_WAIT(wait);
>  	int scanline;
> 
> +	if (evade->min <= 0 || evade->max <= 0)
> +		return 0;
> +
>  	for (;;) {
>  		/*
>  		 * prepare_to_wait() has a memory barrier, which guarantees
> @@ -633,8 +636,6 @@ void intel_pipe_update_start(struct intel_atomic_state
> *state,
>  		intel_crtc_vblank_work_init(new_crtc_state);
> 
>  	intel_vblank_evade_init(old_crtc_state, new_crtc_state, &evade);
> -	if (evade.min <= 0 || evade.max <= 0)
> -		goto irq_disable;
> 
>  	if (drm_WARN_ON(&dev_priv->drm, drm_crtc_vblank_get(&crtc-
> >base)))
>  		goto irq_disable;
> --
> 2.41.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index 26a07b2219bf..11a6a4b0a258 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -544,6 +544,9 @@  static int intel_vblank_evade(struct intel_vblank_evade_ctx *evade)
 	DEFINE_WAIT(wait);
 	int scanline;
 
+	if (evade->min <= 0 || evade->max <= 0)
+		return 0;
+
 	for (;;) {
 		/*
 		 * prepare_to_wait() has a memory barrier, which guarantees
@@ -633,8 +636,6 @@  void intel_pipe_update_start(struct intel_atomic_state *state,
 		intel_crtc_vblank_work_init(new_crtc_state);
 
 	intel_vblank_evade_init(old_crtc_state, new_crtc_state, &evade);
-	if (evade.min <= 0 || evade.max <= 0)
-		goto irq_disable;
 
 	if (drm_WARN_ON(&dev_priv->drm, drm_crtc_vblank_get(&crtc->base)))
 		goto irq_disable;