diff mbox series

[4/7] drm/i915: Clean up intel_wm_need_update()

Message ID 20240916162413.8555-5-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Some wm/cxsr cleanups | expand

Commit Message

Ville Syrjala Sept. 16, 2024, 4:24 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

intel_wm_need_update() is a mess when it comes to variable
names and constness. The checks also keep alternating randomly
between 'old != cur' vs. 'cur != old'. Clean it all up.

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

Comments

Vinod Govindapillai Sept. 22, 2024, 9:54 a.m. UTC | #1
On Mon, 2024-09-16 at 19:24 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> intel_wm_need_update() is a mess when it comes to variable
> names and constness. The checks also keep alternating randomly
> between 'old != cur' vs. 'cur != old'. Clean it all up.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  .../gpu/drm/i915/display/intel_atomic_plane.c | 20 +++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)

Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>

> 
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index b5bbcc773ec0..2aeb4cd5b5a1 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -393,22 +393,22 @@ void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
>  }
>  
>  /* FIXME nuke when all wm code is atomic */
> -static bool intel_wm_need_update(const struct intel_plane_state *cur,
> -                                struct intel_plane_state *new)
> +static bool intel_wm_need_update(const struct intel_plane_state *old_plane_state,
> +                                const struct intel_plane_state *new_plane_state)
>  {
>         /* Update watermarks on tiling or size changes. */
> -       if (new->uapi.visible != cur->uapi.visible)
> +       if (old_plane_state->uapi.visible != new_plane_state->uapi.visible)
>                 return true;
>  
> -       if (!cur->hw.fb || !new->hw.fb)
> +       if (!old_plane_state->hw.fb || !new_plane_state->hw.fb)
>                 return false;
>  
> -       if (cur->hw.fb->modifier != new->hw.fb->modifier ||
> -           cur->hw.rotation != new->hw.rotation ||
> -           drm_rect_width(&new->uapi.src) != drm_rect_width(&cur->uapi.src) ||
> -           drm_rect_height(&new->uapi.src) != drm_rect_height(&cur->uapi.src) ||
> -           drm_rect_width(&new->uapi.dst) != drm_rect_width(&cur->uapi.dst) ||
> -           drm_rect_height(&new->uapi.dst) != drm_rect_height(&cur->uapi.dst))
> +       if (old_plane_state->hw.fb->modifier != new_plane_state->hw.fb->modifier ||
> +           old_plane_state->hw.rotation != new_plane_state->hw.rotation ||
> +           drm_rect_width(&old_plane_state->uapi.src) != drm_rect_width(&new_plane_state-
> >uapi.src) ||
> +           drm_rect_height(&old_plane_state->uapi.src) != drm_rect_height(&new_plane_state-
> >uapi.src) ||
> +           drm_rect_width(&old_plane_state->uapi.dst) != drm_rect_width(&new_plane_state-
> >uapi.dst) ||
> +           drm_rect_height(&old_plane_state->uapi.dst) != drm_rect_height(&new_plane_state-
> >uapi.dst))
>                 return true;
>  
>         return false;
Vinod Govindapillai Sept. 22, 2024, 10:34 a.m. UTC | #2
On Sun, 2024-09-22 at 12:54 +0300, Govindapillai, Vinod wrote:
> On Mon, 2024-09-16 at 19:24 +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > intel_wm_need_update() is a mess when it comes to variable
> > names and constness. The checks also keep alternating randomly
> > between 'old != cur' vs. 'cur != old'. Clean it all up.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  .../gpu/drm/i915/display/intel_atomic_plane.c | 20 +++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>

Just noticed that the next patch in this series nuke this intel_wm_need_update() and move to
i9xx_wm_need_update(). So wonder if we need this patch.

Anyway, already RB-ed.

BR
Vinod

> 
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > index b5bbcc773ec0..2aeb4cd5b5a1 100644
> > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > @@ -393,22 +393,22 @@ void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
> >  }
> >  
> >  /* FIXME nuke when all wm code is atomic */
> > -static bool intel_wm_need_update(const struct intel_plane_state *cur,
> > -                                struct intel_plane_state *new)
> > +static bool intel_wm_need_update(const struct intel_plane_state *old_plane_state,
> > +                                const struct intel_plane_state *new_plane_state)
> >  {
> >         /* Update watermarks on tiling or size changes. */
> > -       if (new->uapi.visible != cur->uapi.visible)
> > +       if (old_plane_state->uapi.visible != new_plane_state->uapi.visible)
> >                 return true;
> >  
> > -       if (!cur->hw.fb || !new->hw.fb)
> > +       if (!old_plane_state->hw.fb || !new_plane_state->hw.fb)
> >                 return false;
> >  
> > -       if (cur->hw.fb->modifier != new->hw.fb->modifier ||
> > -           cur->hw.rotation != new->hw.rotation ||
> > -           drm_rect_width(&new->uapi.src) != drm_rect_width(&cur->uapi.src) ||
> > -           drm_rect_height(&new->uapi.src) != drm_rect_height(&cur->uapi.src) ||
> > -           drm_rect_width(&new->uapi.dst) != drm_rect_width(&cur->uapi.dst) ||
> > -           drm_rect_height(&new->uapi.dst) != drm_rect_height(&cur->uapi.dst))
> > +       if (old_plane_state->hw.fb->modifier != new_plane_state->hw.fb->modifier ||
> > +           old_plane_state->hw.rotation != new_plane_state->hw.rotation ||
> > +           drm_rect_width(&old_plane_state->uapi.src) != drm_rect_width(&new_plane_state-
> > > uapi.src) ||
> > +           drm_rect_height(&old_plane_state->uapi.src) != drm_rect_height(&new_plane_state-
> > > uapi.src) ||
> > +           drm_rect_width(&old_plane_state->uapi.dst) != drm_rect_width(&new_plane_state-
> > > uapi.dst) ||
> > +           drm_rect_height(&old_plane_state->uapi.dst) != drm_rect_height(&new_plane_state-
> > > uapi.dst))
> >                 return true;
> >  
> >         return false;
>
Ville Syrjala Sept. 23, 2024, 5:33 p.m. UTC | #3
On Sun, Sep 22, 2024 at 10:34:07AM +0000, Govindapillai, Vinod wrote:
> On Sun, 2024-09-22 at 12:54 +0300, Govindapillai, Vinod wrote:
> > On Mon, 2024-09-16 at 19:24 +0300, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > intel_wm_need_update() is a mess when it comes to variable
> > > names and constness. The checks also keep alternating randomly
> > > between 'old != cur' vs. 'cur != old'. Clean it all up.
> > > 
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  .../gpu/drm/i915/display/intel_atomic_plane.c | 20 +++++++++----------
> > >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> 
> Just noticed that the next patch in this series nuke this intel_wm_need_update() and move to
> i9xx_wm_need_update().

That's just a rename. Nothing to do with the internals of the function.

> So wonder if we need this patch.
> 
> Anyway, already RB-ed.
> 
> BR
> Vinod
> 
> > 
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > index b5bbcc773ec0..2aeb4cd5b5a1 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > > @@ -393,22 +393,22 @@ void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
> > >  }
> > >  
> > >  /* FIXME nuke when all wm code is atomic */
> > > -static bool intel_wm_need_update(const struct intel_plane_state *cur,
> > > -                                struct intel_plane_state *new)
> > > +static bool intel_wm_need_update(const struct intel_plane_state *old_plane_state,
> > > +                                const struct intel_plane_state *new_plane_state)
> > >  {
> > >         /* Update watermarks on tiling or size changes. */
> > > -       if (new->uapi.visible != cur->uapi.visible)
> > > +       if (old_plane_state->uapi.visible != new_plane_state->uapi.visible)
> > >                 return true;
> > >  
> > > -       if (!cur->hw.fb || !new->hw.fb)
> > > +       if (!old_plane_state->hw.fb || !new_plane_state->hw.fb)
> > >                 return false;
> > >  
> > > -       if (cur->hw.fb->modifier != new->hw.fb->modifier ||
> > > -           cur->hw.rotation != new->hw.rotation ||
> > > -           drm_rect_width(&new->uapi.src) != drm_rect_width(&cur->uapi.src) ||
> > > -           drm_rect_height(&new->uapi.src) != drm_rect_height(&cur->uapi.src) ||
> > > -           drm_rect_width(&new->uapi.dst) != drm_rect_width(&cur->uapi.dst) ||
> > > -           drm_rect_height(&new->uapi.dst) != drm_rect_height(&cur->uapi.dst))
> > > +       if (old_plane_state->hw.fb->modifier != new_plane_state->hw.fb->modifier ||
> > > +           old_plane_state->hw.rotation != new_plane_state->hw.rotation ||
> > > +           drm_rect_width(&old_plane_state->uapi.src) != drm_rect_width(&new_plane_state-
> > > > uapi.src) ||
> > > +           drm_rect_height(&old_plane_state->uapi.src) != drm_rect_height(&new_plane_state-
> > > > uapi.src) ||
> > > +           drm_rect_width(&old_plane_state->uapi.dst) != drm_rect_width(&new_plane_state-
> > > > uapi.dst) ||
> > > +           drm_rect_height(&old_plane_state->uapi.dst) != drm_rect_height(&new_plane_state-
> > > > uapi.dst))
> > >                 return true;
> > >  
> > >         return false;
> > 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index b5bbcc773ec0..2aeb4cd5b5a1 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -393,22 +393,22 @@  void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
 }
 
 /* FIXME nuke when all wm code is atomic */
-static bool intel_wm_need_update(const struct intel_plane_state *cur,
-				 struct intel_plane_state *new)
+static bool intel_wm_need_update(const struct intel_plane_state *old_plane_state,
+				 const struct intel_plane_state *new_plane_state)
 {
 	/* Update watermarks on tiling or size changes. */
-	if (new->uapi.visible != cur->uapi.visible)
+	if (old_plane_state->uapi.visible != new_plane_state->uapi.visible)
 		return true;
 
-	if (!cur->hw.fb || !new->hw.fb)
+	if (!old_plane_state->hw.fb || !new_plane_state->hw.fb)
 		return false;
 
-	if (cur->hw.fb->modifier != new->hw.fb->modifier ||
-	    cur->hw.rotation != new->hw.rotation ||
-	    drm_rect_width(&new->uapi.src) != drm_rect_width(&cur->uapi.src) ||
-	    drm_rect_height(&new->uapi.src) != drm_rect_height(&cur->uapi.src) ||
-	    drm_rect_width(&new->uapi.dst) != drm_rect_width(&cur->uapi.dst) ||
-	    drm_rect_height(&new->uapi.dst) != drm_rect_height(&cur->uapi.dst))
+	if (old_plane_state->hw.fb->modifier != new_plane_state->hw.fb->modifier ||
+	    old_plane_state->hw.rotation != new_plane_state->hw.rotation ||
+	    drm_rect_width(&old_plane_state->uapi.src) != drm_rect_width(&new_plane_state->uapi.src) ||
+	    drm_rect_height(&old_plane_state->uapi.src) != drm_rect_height(&new_plane_state->uapi.src) ||
+	    drm_rect_width(&old_plane_state->uapi.dst) != drm_rect_width(&new_plane_state->uapi.dst) ||
+	    drm_rect_height(&old_plane_state->uapi.dst) != drm_rect_height(&new_plane_state->uapi.dst))
 		return true;
 
 	return false;