diff mbox series

[02/22] drm/amdgpu: Remove pointless on stack mode copies

Message ID 20220218100403.7028-3-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Review of mode copies | expand

Commit Message

Ville Syrjälä Feb. 18, 2022, 10:03 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

These on stack copies of the modes appear to be pointless.
Just look at the originals directly.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Nikola Cornij <nikola.cornij@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

Comments

Harry Wentland Feb. 18, 2022, 4:28 p.m. UTC | #1
On 2022-02-18 05:03, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> These on stack copies of the modes appear to be pointless.
> Just look at the originals directly.
> 
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: Nikola Cornij <nikola.cornij@amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++----------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 21dba337dab0..65aab0d086b6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -10139,27 +10139,27 @@ static bool
>  is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state,
>  				 struct drm_crtc_state *new_crtc_state)
>  {
> -	struct drm_display_mode old_mode, new_mode;
> +	const struct drm_display_mode *old_mode, *new_mode;
>  
>  	if (!old_crtc_state || !new_crtc_state)
>  		return false;
>  
> -	old_mode = old_crtc_state->mode;
> -	new_mode = new_crtc_state->mode;
> +	old_mode = &old_crtc_state->mode;
> +	new_mode = &new_crtc_state->mode;
>  
> -	if (old_mode.clock       == new_mode.clock &&
> -	    old_mode.hdisplay    == new_mode.hdisplay &&
> -	    old_mode.vdisplay    == new_mode.vdisplay &&
> -	    old_mode.htotal      == new_mode.htotal &&
> -	    old_mode.vtotal      != new_mode.vtotal &&
> -	    old_mode.hsync_start == new_mode.hsync_start &&
> -	    old_mode.vsync_start != new_mode.vsync_start &&
> -	    old_mode.hsync_end   == new_mode.hsync_end &&
> -	    old_mode.vsync_end   != new_mode.vsync_end &&
> -	    old_mode.hskew       == new_mode.hskew &&
> -	    old_mode.vscan       == new_mode.vscan &&
> -	    (old_mode.vsync_end - old_mode.vsync_start) ==
> -	    (new_mode.vsync_end - new_mode.vsync_start))
> +	if (old_mode->clock       == new_mode->clock &&
> +	    old_mode->hdisplay    == new_mode->hdisplay &&
> +	    old_mode->vdisplay    == new_mode->vdisplay &&
> +	    old_mode->htotal      == new_mode->htotal &&
> +	    old_mode->vtotal      != new_mode->vtotal &&
> +	    old_mode->hsync_start == new_mode->hsync_start &&
> +	    old_mode->vsync_start != new_mode->vsync_start &&
> +	    old_mode->hsync_end   == new_mode->hsync_end &&
> +	    old_mode->vsync_end   != new_mode->vsync_end &&
> +	    old_mode->hskew       == new_mode->hskew &&
> +	    old_mode->vscan       == new_mode->vscan &&
> +	    (old_mode->vsync_end - old_mode->vsync_start) ==
> +	    (new_mode->vsync_end - new_mode->vsync_start))
>  		return true;
>  
>  	return false;
Alex Deucher March 15, 2022, 3:57 p.m. UTC | #2
Applied.  Thanks!

Alex

On Fri, Feb 18, 2022 at 11:28 AM Harry Wentland <harry.wentland@amd.com> wrote:
>
>
>
> On 2022-02-18 05:03, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > These on stack copies of the modes appear to be pointless.
> > Just look at the originals directly.
> >
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Leo Li <sunpeng.li@amd.com>
> > Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: Nikola Cornij <nikola.cornij@amd.com>
> > Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++----------
> >  1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > index 21dba337dab0..65aab0d086b6 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > @@ -10139,27 +10139,27 @@ static bool
> >  is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state,
> >                                struct drm_crtc_state *new_crtc_state)
> >  {
> > -     struct drm_display_mode old_mode, new_mode;
> > +     const struct drm_display_mode *old_mode, *new_mode;
> >
> >       if (!old_crtc_state || !new_crtc_state)
> >               return false;
> >
> > -     old_mode = old_crtc_state->mode;
> > -     new_mode = new_crtc_state->mode;
> > +     old_mode = &old_crtc_state->mode;
> > +     new_mode = &new_crtc_state->mode;
> >
> > -     if (old_mode.clock       == new_mode.clock &&
> > -         old_mode.hdisplay    == new_mode.hdisplay &&
> > -         old_mode.vdisplay    == new_mode.vdisplay &&
> > -         old_mode.htotal      == new_mode.htotal &&
> > -         old_mode.vtotal      != new_mode.vtotal &&
> > -         old_mode.hsync_start == new_mode.hsync_start &&
> > -         old_mode.vsync_start != new_mode.vsync_start &&
> > -         old_mode.hsync_end   == new_mode.hsync_end &&
> > -         old_mode.vsync_end   != new_mode.vsync_end &&
> > -         old_mode.hskew       == new_mode.hskew &&
> > -         old_mode.vscan       == new_mode.vscan &&
> > -         (old_mode.vsync_end - old_mode.vsync_start) ==
> > -         (new_mode.vsync_end - new_mode.vsync_start))
> > +     if (old_mode->clock       == new_mode->clock &&
> > +         old_mode->hdisplay    == new_mode->hdisplay &&
> > +         old_mode->vdisplay    == new_mode->vdisplay &&
> > +         old_mode->htotal      == new_mode->htotal &&
> > +         old_mode->vtotal      != new_mode->vtotal &&
> > +         old_mode->hsync_start == new_mode->hsync_start &&
> > +         old_mode->vsync_start != new_mode->vsync_start &&
> > +         old_mode->hsync_end   == new_mode->hsync_end &&
> > +         old_mode->vsync_end   != new_mode->vsync_end &&
> > +         old_mode->hskew       == new_mode->hskew &&
> > +         old_mode->vscan       == new_mode->vscan &&
> > +         (old_mode->vsync_end - old_mode->vsync_start) ==
> > +         (new_mode->vsync_end - new_mode->vsync_start))
> >               return true;
> >
> >       return false;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 21dba337dab0..65aab0d086b6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -10139,27 +10139,27 @@  static bool
 is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state,
 				 struct drm_crtc_state *new_crtc_state)
 {
-	struct drm_display_mode old_mode, new_mode;
+	const struct drm_display_mode *old_mode, *new_mode;
 
 	if (!old_crtc_state || !new_crtc_state)
 		return false;
 
-	old_mode = old_crtc_state->mode;
-	new_mode = new_crtc_state->mode;
+	old_mode = &old_crtc_state->mode;
+	new_mode = &new_crtc_state->mode;
 
-	if (old_mode.clock       == new_mode.clock &&
-	    old_mode.hdisplay    == new_mode.hdisplay &&
-	    old_mode.vdisplay    == new_mode.vdisplay &&
-	    old_mode.htotal      == new_mode.htotal &&
-	    old_mode.vtotal      != new_mode.vtotal &&
-	    old_mode.hsync_start == new_mode.hsync_start &&
-	    old_mode.vsync_start != new_mode.vsync_start &&
-	    old_mode.hsync_end   == new_mode.hsync_end &&
-	    old_mode.vsync_end   != new_mode.vsync_end &&
-	    old_mode.hskew       == new_mode.hskew &&
-	    old_mode.vscan       == new_mode.vscan &&
-	    (old_mode.vsync_end - old_mode.vsync_start) ==
-	    (new_mode.vsync_end - new_mode.vsync_start))
+	if (old_mode->clock       == new_mode->clock &&
+	    old_mode->hdisplay    == new_mode->hdisplay &&
+	    old_mode->vdisplay    == new_mode->vdisplay &&
+	    old_mode->htotal      == new_mode->htotal &&
+	    old_mode->vtotal      != new_mode->vtotal &&
+	    old_mode->hsync_start == new_mode->hsync_start &&
+	    old_mode->vsync_start != new_mode->vsync_start &&
+	    old_mode->hsync_end   == new_mode->hsync_end &&
+	    old_mode->vsync_end   != new_mode->vsync_end &&
+	    old_mode->hskew       == new_mode->hskew &&
+	    old_mode->vscan       == new_mode->vscan &&
+	    (old_mode->vsync_end - old_mode->vsync_start) ==
+	    (new_mode->vsync_end - new_mode->vsync_start))
 		return true;
 
 	return false;