* [Intel-gfx] [PATCH 0/1] Removing Connector iterator macro @ 2022-10-20 9:20 Suraj Kandpal 2022-10-20 9:20 ` [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro Suraj Kandpal 0 siblings, 1 reply; 6+ messages in thread From: Suraj Kandpal @ 2022-10-20 9:20 UTC (permalink / raw) To: intel-gfx; +Cc: jani.nikula Removing connector iterator macro (for_each_connector_on_encoder) as it is only used once and changing the function to use macros currently present. Suraj Kandpal (1): drm/i915: Removing one use macro drivers/gpu/drm/i915/display/intel_display.h | 4 ---- .../gpu/drm/i915/display/intel_modeset_setup.c | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro 2022-10-20 9:20 [Intel-gfx] [PATCH 0/1] Removing Connector iterator macro Suraj Kandpal @ 2022-10-20 9:20 ` Suraj Kandpal 2022-10-20 9:28 ` Murthy, Arun R 2022-10-20 9:37 ` Ville Syrjälä 0 siblings, 2 replies; 6+ messages in thread From: Suraj Kandpal @ 2022-10-20 9:20 UTC (permalink / raw) To: intel-gfx; +Cc: jani.nikula Removing one use macro for_each_connector_on_encoder which is only being used at intel_encoder_find_connector. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> --- drivers/gpu/drm/i915/display/intel_display.h | 4 ---- .../gpu/drm/i915/display/intel_modeset_setup.c | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 2af4a1925063..c803330a276d 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -469,10 +469,6 @@ enum hpd_pin { list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ for_each_if((intel_encoder)->base.crtc == (__crtc)) -#define for_each_connector_on_encoder(dev, __encoder, intel_connector) \ - list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \ - for_each_if((intel_connector)->base.encoder == (__encoder)) - #define for_each_old_intel_plane_in_state(__state, plane, old_plane_state, __i) \ for ((__i) = 0; \ (__i) < (__state)->base.dev->mode_config.num_total_plane && \ diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c index cbfabd58b75a..31ce4ac4059c 100644 --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c @@ -205,12 +205,22 @@ static bool intel_crtc_has_encoders(struct intel_crtc *crtc) static struct intel_connector *intel_encoder_find_connector(struct intel_encoder *encoder) { - struct drm_device *dev = encoder->base.dev; + struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct intel_connector *connector; + struct drm_connector_list_iter conn_iter; + bool found_connector = false; - for_each_connector_on_encoder(dev, &encoder->base, connector) - return connector; + drm_connector_list_iter_begin(&i915->drm, &conn_iter); + for_each_intel_connector_iter(connector, &conn_iter) { + if (&encoder->base == connector->base.encoder) { + found_connector = true; + break; + } + } + drm_connector_list_iter_end(&conn_iter); + if (found_connector) + return connector; return NULL; } -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro 2022-10-20 9:20 ` [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro Suraj Kandpal @ 2022-10-20 9:28 ` Murthy, Arun R 2022-10-20 9:37 ` Ville Syrjälä 1 sibling, 0 replies; 6+ messages in thread From: Murthy, Arun R @ 2022-10-20 9:28 UTC (permalink / raw) To: Kandpal, Suraj, intel-gfx@lists.freedesktop.org; +Cc: Nikula, Jani > -----Original Message----- > From: Kandpal, Suraj <suraj.kandpal@intel.com> > Sent: Thursday, October 20, 2022 2:51 PM > To: intel-gfx@lists.freedesktop.org > Cc: Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>; Nikula, Jani > <jani.nikula@intel.com>; Murthy, Arun R <arun.r.murthy@intel.com>; > Kandpal, Suraj <suraj.kandpal@intel.com> > Subject: [PATCH 1/1] drm/i915: Removing one use macro > > Removing one use macro for_each_connector_on_encoder which is only > being used at intel_encoder_find_connector. > > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> > --- Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com> Thanks and Regards Arun R Murthy -------------------- > drivers/gpu/drm/i915/display/intel_display.h | 4 ---- > .../gpu/drm/i915/display/intel_modeset_setup.c | 16 +++++++++++++--- > 2 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.h > b/drivers/gpu/drm/i915/display/intel_display.h > index 2af4a1925063..c803330a276d 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.h > +++ b/drivers/gpu/drm/i915/display/intel_display.h > @@ -469,10 +469,6 @@ enum hpd_pin { > list_for_each_entry((intel_encoder), &(dev)- > >mode_config.encoder_list, base.head) \ > for_each_if((intel_encoder)->base.crtc == (__crtc)) > > -#define for_each_connector_on_encoder(dev, __encoder, intel_connector) > \ > - list_for_each_entry((intel_connector), &(dev)- > >mode_config.connector_list, base.head) \ > - for_each_if((intel_connector)->base.encoder == (__encoder)) > - > #define for_each_old_intel_plane_in_state(__state, plane, old_plane_state, > __i) \ > for ((__i) = 0; \ > (__i) < (__state)->base.dev->mode_config.num_total_plane && \ > diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > index cbfabd58b75a..31ce4ac4059c 100644 > --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > @@ -205,12 +205,22 @@ static bool intel_crtc_has_encoders(struct > intel_crtc *crtc) > > static struct intel_connector *intel_encoder_find_connector(struct > intel_encoder *encoder) { > - struct drm_device *dev = encoder->base.dev; > + struct drm_i915_private *i915 = to_i915(encoder->base.dev); > struct intel_connector *connector; > + struct drm_connector_list_iter conn_iter; > + bool found_connector = false; > > - for_each_connector_on_encoder(dev, &encoder->base, connector) > - return connector; > + drm_connector_list_iter_begin(&i915->drm, &conn_iter); > + for_each_intel_connector_iter(connector, &conn_iter) { > + if (&encoder->base == connector->base.encoder) { > + found_connector = true; > + break; > + } > + } > + drm_connector_list_iter_end(&conn_iter); > > + if (found_connector) > + return connector; > return NULL; > } > > -- > 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro 2022-10-20 9:20 ` [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro Suraj Kandpal 2022-10-20 9:28 ` Murthy, Arun R @ 2022-10-20 9:37 ` Ville Syrjälä 2022-10-20 9:48 ` Kandpal, Suraj 1 sibling, 1 reply; 6+ messages in thread From: Ville Syrjälä @ 2022-10-20 9:37 UTC (permalink / raw) To: Suraj Kandpal; +Cc: jani.nikula, intel-gfx On Thu, Oct 20, 2022 at 02:50:49PM +0530, Suraj Kandpal wrote: > Removing one use macro for_each_connector_on_encoder which > is only being used at intel_encoder_find_connector. > > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> > --- > drivers/gpu/drm/i915/display/intel_display.h | 4 ---- > .../gpu/drm/i915/display/intel_modeset_setup.c | 16 +++++++++++++--- > 2 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h > index 2af4a1925063..c803330a276d 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.h > +++ b/drivers/gpu/drm/i915/display/intel_display.h > @@ -469,10 +469,6 @@ enum hpd_pin { > list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ > for_each_if((intel_encoder)->base.crtc == (__crtc)) > > -#define for_each_connector_on_encoder(dev, __encoder, intel_connector) \ > - list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \ > - for_each_if((intel_connector)->base.encoder == (__encoder)) > - > #define for_each_old_intel_plane_in_state(__state, plane, old_plane_state, __i) \ > for ((__i) = 0; \ > (__i) < (__state)->base.dev->mode_config.num_total_plane && \ > diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > index cbfabd58b75a..31ce4ac4059c 100644 > --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > @@ -205,12 +205,22 @@ static bool intel_crtc_has_encoders(struct intel_crtc *crtc) > > static struct intel_connector *intel_encoder_find_connector(struct intel_encoder *encoder) > { > - struct drm_device *dev = encoder->base.dev; > + struct drm_i915_private *i915 = to_i915(encoder->base.dev); > struct intel_connector *connector; > + struct drm_connector_list_iter conn_iter; > + bool found_connector = false; > > - for_each_connector_on_encoder(dev, &encoder->base, connector) > - return connector; > + drm_connector_list_iter_begin(&i915->drm, &conn_iter); > + for_each_intel_connector_iter(connector, &conn_iter) { Bogus indentation. > + if (&encoder->base == connector->base.encoder) { Still using the legacy pointers so not great. But I suppse it's still better than before because the horrors are now better contained in this file rather than in an official looking macro. I do have some work in some old branch to get rid of the legacy pointer crap, but it'll probably need a rewrite by now... > + found_connector = true; > + break; > + } > + } > + drm_connector_list_iter_end(&conn_iter); > > + if (found_connector) I would make that a pointer to the connector, then you can just return it directly. And as a bonus we don't use the loop iterator outside the loop anymore, which is a bit questionable in general. > + return connector; > return NULL; > } > > -- > 2.25.1 -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro 2022-10-20 9:37 ` Ville Syrjälä @ 2022-10-20 9:48 ` Kandpal, Suraj 2022-10-20 10:00 ` Ville Syrjälä 0 siblings, 1 reply; 6+ messages in thread From: Kandpal, Suraj @ 2022-10-20 9:48 UTC (permalink / raw) To: Ville Syrjälä; +Cc: Nikula, Jani, intel-gfx@lists.freedesktop.org > > diff --git a/drivers/gpu/drm/i915/display/intel_display.h > > b/drivers/gpu/drm/i915/display/intel_display.h > > index 2af4a1925063..c803330a276d 100644 > > --- a/drivers/gpu/drm/i915/display/intel_display.h > > +++ b/drivers/gpu/drm/i915/display/intel_display.h > > @@ -469,10 +469,6 @@ enum hpd_pin { > > list_for_each_entry((intel_encoder), &(dev)- > >mode_config.encoder_list, base.head) \ > > for_each_if((intel_encoder)->base.crtc == (__crtc)) > > > > -#define for_each_connector_on_encoder(dev, __encoder, > intel_connector) \ > > - list_for_each_entry((intel_connector), &(dev)- > >mode_config.connector_list, base.head) \ > > - for_each_if((intel_connector)->base.encoder == > (__encoder)) > > - > > #define for_each_old_intel_plane_in_state(__state, plane, > old_plane_state, __i) \ > > for ((__i) = 0; \ > > (__i) < (__state)->base.dev->mode_config.num_total_plane && \ > > diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > index cbfabd58b75a..31ce4ac4059c 100644 > > --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > @@ -205,12 +205,22 @@ static bool intel_crtc_has_encoders(struct > > intel_crtc *crtc) > > > > static struct intel_connector *intel_encoder_find_connector(struct > > intel_encoder *encoder) { > > - struct drm_device *dev = encoder->base.dev; > > + struct drm_i915_private *i915 = to_i915(encoder->base.dev); > > struct intel_connector *connector; > > + struct drm_connector_list_iter conn_iter; > > + bool found_connector = false; > > > > - for_each_connector_on_encoder(dev, &encoder->base, connector) > > - return connector; > > + drm_connector_list_iter_begin(&i915->drm, &conn_iter); > > + for_each_intel_connector_iter(connector, &conn_iter) { > > Bogus indentation. > Hi Ville, Will remove the bogus indentation. > > + if (&encoder->base == connector->base.encoder) { > > Still using the legacy pointers so not great. But I suppse it's still better than > before because the horrors are now better contained in this file rather than > in an official looking macro. Any suggestion on how I could make this better or should I go ahead with this approach for now > > I do have some work in some old branch to get rid of the legacy pointer > crap, but it'll probably need a rewrite by now... > > > + found_connector = true; > > + break; > > + } > > + } > > + drm_connector_list_iter_end(&conn_iter); > > > > + if (found_connector) > > I would make that a pointer to the connector, then you can just return it > directly. And as a bonus we don't use the loop iterator outside the loop > anymore, which is a bit questionable in general. Ah got it . Regards, Suraj Kandpal > > > + return connector; > > return NULL; > > } > > > > -- > > 2.25.1 > > -- > Ville Syrjälä > Intel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro 2022-10-20 9:48 ` Kandpal, Suraj @ 2022-10-20 10:00 ` Ville Syrjälä 0 siblings, 0 replies; 6+ messages in thread From: Ville Syrjälä @ 2022-10-20 10:00 UTC (permalink / raw) To: Kandpal, Suraj; +Cc: Nikula, Jani, intel-gfx@lists.freedesktop.org On Thu, Oct 20, 2022 at 09:48:20AM +0000, Kandpal, Suraj wrote: > > > diff --git a/drivers/gpu/drm/i915/display/intel_display.h > > > b/drivers/gpu/drm/i915/display/intel_display.h > > > index 2af4a1925063..c803330a276d 100644 > > > --- a/drivers/gpu/drm/i915/display/intel_display.h > > > +++ b/drivers/gpu/drm/i915/display/intel_display.h > > > @@ -469,10 +469,6 @@ enum hpd_pin { > > > list_for_each_entry((intel_encoder), &(dev)- > > >mode_config.encoder_list, base.head) \ > > > for_each_if((intel_encoder)->base.crtc == (__crtc)) > > > > > > -#define for_each_connector_on_encoder(dev, __encoder, > > intel_connector) \ > > > - list_for_each_entry((intel_connector), &(dev)- > > >mode_config.connector_list, base.head) \ > > > - for_each_if((intel_connector)->base.encoder == > > (__encoder)) > > > - > > > #define for_each_old_intel_plane_in_state(__state, plane, > > old_plane_state, __i) \ > > > for ((__i) = 0; \ > > > (__i) < (__state)->base.dev->mode_config.num_total_plane && \ > > > diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > > b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > > index cbfabd58b75a..31ce4ac4059c 100644 > > > --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > > +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c > > > @@ -205,12 +205,22 @@ static bool intel_crtc_has_encoders(struct > > > intel_crtc *crtc) > > > > > > static struct intel_connector *intel_encoder_find_connector(struct > > > intel_encoder *encoder) { > > > - struct drm_device *dev = encoder->base.dev; > > > + struct drm_i915_private *i915 = to_i915(encoder->base.dev); > > > struct intel_connector *connector; > > > + struct drm_connector_list_iter conn_iter; > > > + bool found_connector = false; > > > > > > - for_each_connector_on_encoder(dev, &encoder->base, connector) > > > - return connector; > > > + drm_connector_list_iter_begin(&i915->drm, &conn_iter); > > > + for_each_intel_connector_iter(connector, &conn_iter) { > > > > Bogus indentation. > > > Hi Ville, > > Will remove the bogus indentation. > > > > + if (&encoder->base == connector->base.encoder) { > > > > Still using the legacy pointers so not great. But I suppse it's still better than > > before because the horrors are now better contained in this file rather than > > in an official looking macro. > > Any suggestion on how I could make this better or should I go ahead with this > approach for now It's fine for now. Stopping the legacy pointer usage involved a lot of work. > > > > > I do have some work in some old branch to get rid of the legacy pointer > > crap, but it'll probably need a rewrite by now... > > > > > + found_connector = true; > > > + break; > > > + } > > > + } > > > + drm_connector_list_iter_end(&conn_iter); > > > > > > + if (found_connector) > > > > I would make that a pointer to the connector, then you can just return it > > directly. And as a bonus we don't use the loop iterator outside the loop > > anymore, which is a bit questionable in general. > > Ah got it . > > Regards, > Suraj Kandpal > > > > > > + return connector; > > > return NULL; > > > } > > > > > > -- > > > 2.25.1 > > > > -- > > Ville Syrjälä > > Intel -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-20 10:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-20 9:20 [Intel-gfx] [PATCH 0/1] Removing Connector iterator macro Suraj Kandpal 2022-10-20 9:20 ` [Intel-gfx] [PATCH 1/1] drm/i915: Removing one use macro Suraj Kandpal 2022-10-20 9:28 ` Murthy, Arun R 2022-10-20 9:37 ` Ville Syrjälä 2022-10-20 9:48 ` Kandpal, Suraj 2022-10-20 10:00 ` Ville Syrjälä
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox