[v2,17/40] drm: Add for_each_oldnew_intel_crtc_in_state_reverse()

Submitted by Lucas De Marchi on Aug. 17, 2019, 9:38 a.m.

Details

Message ID 20190817093902.2171-18-lucas.demarchi@intel.com
State New
Headers show
Series "Tiger Lake batch 3" ( rev: 4 3 2 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Lucas De Marchi Aug. 17, 2019, 9:38 a.m.
From: José Roberto de Souza <jose.souza@intel.com>

Same as for_each_oldnew_intel_crtc_in_state() but iterates in reverse
order.

v2: Fix additional blank line

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index fd3043e77b50..b63fb7a4599e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -419,6 +419,15 @@  enum phy_fia {
 			     ((connector) = to_intel_connector((__state)->base.connectors[__i].ptr), \
 			     (new_connector_state) = to_intel_digital_connector_state((__state)->base.connectors[__i].new_state), 1))
 
+#define for_each_oldnew_intel_crtc_in_state_reverse(__state, crtc, old_crtc_state, new_crtc_state, __i) \
+	for ((__i) = (__state)->base.dev->mode_config.num_crtc - 1; \
+	     (__i) >= 0  && \
+	     ((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
+	      (old_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].old_state), \
+	      (new_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].new_state), 1); \
+	     (__i)--) \
+		for_each_if(crtc)
+
 void intel_link_compute_m_n(u16 bpp, int nlanes,
 			    int pixel_clock, int link_clock,
 			    struct intel_link_m_n *m_n,

Comments

On Sat, 2019-08-17 at 02:38 -0700, Lucas De Marchi wrote:
> From: José Roberto de Souza <jose.souza@intel.com>
> 
> Same as for_each_oldnew_intel_crtc_in_state() but iterates in reverse
> order.
> 
> v2: Fix additional blank line
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h
> b/drivers/gpu/drm/i915/display/intel_display.h
> index fd3043e77b50..b63fb7a4599e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -419,6 +419,15 @@ enum phy_fia {
>  			     ((connector) =
> to_intel_connector((__state)->base.connectors[__i].ptr), \
>  			     (new_connector_state) =
> to_intel_digital_connector_state((__state)-
> >base.connectors[__i].new_state), 1))
>  
> +#define for_each_oldnew_intel_crtc_in_state_reverse(__state, crtc,
> old_crtc_state, new_crtc_state, __i) \
> +	for ((__i) = (__state)->base.dev->mode_config.num_crtc - 1; \
Maybe aligning these two 'for' loops on top of each other similarly to
to other. Now, it seems the lower one is off by one.

Otherwise, this is

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> +	     (__i) >= 0  && \
> +	     ((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
> +	      (old_crtc_state) = to_intel_crtc_state((__state)-
> >base.crtcs[__i].old_state), \
> +	      (new_crtc_state) = to_intel_crtc_state((__state)-
> >base.crtcs[__i].new_state), 1); \
> +	     (__i)--) \
> +		for_each_if(crtc)
> +
>  void intel_link_compute_m_n(u16 bpp, int nlanes,
>  			    int pixel_clock, int link_clock,
>  			    struct intel_link_m_n *m_n,
On Wed, 2019-08-21 at 11:22 +0000, Kahola, Mika wrote:
> On Sat, 2019-08-17 at 02:38 -0700, Lucas De Marchi wrote:
> > From: José Roberto de Souza <jose.souza@intel.com>
> > 
> > Same as for_each_oldnew_intel_crtc_in_state() but iterates in
> > reverse
> > order.
> > 
> > v2: Fix additional blank line
> > 
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.h | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.h
> > b/drivers/gpu/drm/i915/display/intel_display.h
> > index fd3043e77b50..b63fb7a4599e 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display.h
> > @@ -419,6 +419,15 @@ enum phy_fia {
> >  			     ((connector) =
> > to_intel_connector((__state)->base.connectors[__i].ptr), \
> >  			     (new_connector_state) =
> > to_intel_digital_connector_state((__state)-
> > > base.connectors[__i].new_state), 1))
> > 
> >  
> > +#define for_each_oldnew_intel_crtc_in_state_reverse(__state, crtc,
> > old_crtc_state, new_crtc_state, __i) \
> > +	for ((__i) = (__state)->base.dev->mode_config.num_crtc - 1; \
> 
> Maybe aligning these two 'for' loops on top of each other similarly
> to
> to other. Now, it seems the lower one is off by one.
Please forget this comment. The patch DOES align cleanly. 

> 
> Otherwise, this is
> 
> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> 
> > +	     (__i) >= 0  && \
> > +	     ((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
> > +	      (old_crtc_state) = to_intel_crtc_state((__state)-
> > > base.crtcs[__i].old_state), \
> > 
> > +	      (new_crtc_state) = to_intel_crtc_state((__state)-
> > > base.crtcs[__i].new_state), 1); \
> > 
> > +	     (__i)--) \
> > +		for_each_if(crtc)
> > +
> >  void intel_link_compute_m_n(u16 bpp, int nlanes,
> >  			    int pixel_clock, int link_clock,
> >  			    struct intel_link_m_n *m_n,
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx