[Intel-gfx] [PATCH 01/10] drm: Move a few macros away from drm_crtc.h
On Wed, 2016-08-31 at 18:09 +0200, Daniel Vetter wrote: > Now that there's less stuff in there I noticed that I overlooked > them. > Sprinkle some docs over them while at it. > > Signed-off-by: Daniel Vetter > --- >  include/drm/drm_connector.h   | 24 ++-- >  include/drm/drm_crtc.h        | 32 >  include/drm/drm_encoder.h     | 22 ++ >  include/drm/drm_framebuffer.h | 17 + >  include/drm/drm_modes.h       |  2 ++ >  include/drm/drm_property.h    |  1 + >  6 files changed, 64 insertions(+), 34 deletions(-) > > diff --git a/include/drm/drm_connector.h > b/include/drm/drm_connector.h > index 66b7d6744dd2..e4e545e9516d 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -181,14 +181,19 @@ int drm_display_info_set_bus_formats(struct > drm_display_info *info, >  /** >  * struct drm_connector_state - mutable connector state >  * @connector: backpointer to the connector > - * @crtc: CRTC to connect connector to, NULL if disabled >  * @best_encoder: can be used by helpers and drivers to select the > encoder >  * @state: backpointer to global drm_atomic_state >  */ >  struct drm_connector_state { >  struct drm_connector *connector; >  > - struct drm_crtc *crtc;  /* do not write directly, use > drm_atomic_set_crtc_for_connector() */ > + /** > +  * @crtc: CRTC to connect connector to, NULL if disabled. > +  * > +  * Do not change this directly, use > drm_atomic_set_crtc_for_connector() > +  * instead. > +  */ > + struct drm_crtc *crtc; >  >  struct drm_encoder *best_encoder; >  > @@ -744,4 +749,19 @@ int drm_mode_connector_set_path_property(struct > drm_connector *connector, >  int drm_mode_connector_set_tile_property(struct drm_connector > *connector); >  int drm_mode_connector_update_edid_property(struct drm_connector > *connector, >      const struct edid > *edid); > + > +/** > + * drm_for_each_connector - iterate over all connectors > + * @connector: the loop cursor > + * @dev: the DRM device > + * > + * Iterate over all connectors of @dev. > + */ > +#define drm_for_each_connector(connector, dev) \ > + for (assert_drm_connector_list_read_locked(&(dev)- > >mode_config),\ > +      connector = list_first_entry(&(dev)- > >mode_config.connector_list, \ > +   struct drm_connector, > head);\ > +      &connector->head != (&(dev)- > >mode_config.connector_list); \ > +      connector = list_next_entry(connector, head)) > + >  #endif > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index 4880606e2ffd..2a642ae96127 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -1991,22 +1991,7 @@ struct drm_mode_config { >  list_for_each_entry((plane), &(dev)->mode_config.plane_list, > head) \ >  for_each_if ((plane_mask) & (1 << > drm_plane_index(plane))) >  > -/** > - * drm_for_each_encoder_mask - iterate over encoders specified by > bitmask > - * @encoder: the loop cursor > - * @dev: the DRM device > - * @encoder_mask: bitmask of encoder indices > - * > - * Iterate over all encoders specified by bitmask. > - */ > -#define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \ > - list_for_each_entry((encoder), &(dev)- > >mode_config.encoder_list, head) \ > - for_each_if ((encoder_mask) & (1 << > drm_encoder_index(encoder))) > - >  #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) > -#define obj_to_mode(x) container_of(x, struct drm_display_mode, > base) > -#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) > -#define obj_to_blob(x) container_of(x, struct drm_property_blob, > base) >  #define obj_to_plane(x) container_of(x, struct drm_plane, base) >  >  extern __printf(6, 7) > @@ -2174,23 +2159,6 @@ assert_drm_connector_list_read_locked(struct > drm_mode_config *mode_config) >  !drm_modeset_is_locked(&mode_config- > >connection_mutex)); >  } >  > -#define drm_for_each_connector(connector, dev) \ > - for (assert_drm_connector_list_read_locked(&(dev)- > >mode_config),\ > -      connector = list_first_entry(&(dev)- > >mode_config.connector_list, \ > -   struct drm_connector, > head);\ > -      &connector->head != (&(dev)- > >mode_config.connector_list); \ > -      connector = list_next_entry(connector, head)) > - > -#define drm_for_each_encoder(encoder, dev) \ > - list_for_each_entry(encoder, &(dev)- > >mode_config.encoder_list, head) > - > -#define drm_for_each_fb(fb, dev) \ > - for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), > \ > -      fb = list_first_entry(&(dev)->mode_config.fb_list, > \ > -
[Intel-gfx] [PATCH 01/10] drm: Move a few macros away from drm_crtc.h
On Wed, Aug 31, 2016 at 12:09 PM, Daniel Vetter wrote: > Now that there's less stuff in there I noticed that I overlooked them. > Sprinkle some docs over them while at it. > > Signed-off-by: Daniel Vetter Reviewed-by: Sean Paul > --- > include/drm/drm_connector.h | 24 ++-- > include/drm/drm_crtc.h| 32 > include/drm/drm_encoder.h | 22 ++ > include/drm/drm_framebuffer.h | 17 + > include/drm/drm_modes.h | 2 ++ > include/drm/drm_property.h| 1 + > 6 files changed, 64 insertions(+), 34 deletions(-) > > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index 66b7d6744dd2..e4e545e9516d 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -181,14 +181,19 @@ int drm_display_info_set_bus_formats(struct > drm_display_info *info, > /** > * struct drm_connector_state - mutable connector state > * @connector: backpointer to the connector > - * @crtc: CRTC to connect connector to, NULL if disabled > * @best_encoder: can be used by helpers and drivers to select the encoder > * @state: backpointer to global drm_atomic_state > */ > struct drm_connector_state { > struct drm_connector *connector; > > - struct drm_crtc *crtc; /* do not write directly, use > drm_atomic_set_crtc_for_connector() */ > + /** > +* @crtc: CRTC to connect connector to, NULL if disabled. > +* > +* Do not change this directly, use > drm_atomic_set_crtc_for_connector() > +* instead. > +*/ > + struct drm_crtc *crtc; > > struct drm_encoder *best_encoder; > > @@ -744,4 +749,19 @@ int drm_mode_connector_set_path_property(struct > drm_connector *connector, > int drm_mode_connector_set_tile_property(struct drm_connector *connector); > int drm_mode_connector_update_edid_property(struct drm_connector *connector, > const struct edid *edid); > + > +/** > + * drm_for_each_connector - iterate over all connectors > + * @connector: the loop cursor > + * @dev: the DRM device > + * > + * Iterate over all connectors of @dev. > + */ > +#define drm_for_each_connector(connector, dev) \ > + for (assert_drm_connector_list_read_locked(&(dev)->mode_config), > \ > +connector = list_first_entry(&(dev)->mode_config.connector_list, > \ > + struct drm_connector, head); > \ > +&connector->head != (&(dev)->mode_config.connector_list); > \ > +connector = list_next_entry(connector, head)) > + > #endif > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index 4880606e2ffd..2a642ae96127 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -1991,22 +1991,7 @@ struct drm_mode_config { > list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \ > for_each_if ((plane_mask) & (1 << drm_plane_index(plane))) > > -/** > - * drm_for_each_encoder_mask - iterate over encoders specified by bitmask > - * @encoder: the loop cursor > - * @dev: the DRM device > - * @encoder_mask: bitmask of encoder indices > - * > - * Iterate over all encoders specified by bitmask. > - */ > -#define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \ > - list_for_each_entry((encoder), &(dev)->mode_config.encoder_list, > head) \ > - for_each_if ((encoder_mask) & (1 << > drm_encoder_index(encoder))) > - > #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) > -#define obj_to_mode(x) container_of(x, struct drm_display_mode, base) > -#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) > -#define obj_to_blob(x) container_of(x, struct drm_property_blob, base) > #define obj_to_plane(x) container_of(x, struct drm_plane, base) > > extern __printf(6, 7) > @@ -2174,23 +2159,6 @@ assert_drm_connector_list_read_locked(struct > drm_mode_config *mode_config) > !drm_modeset_is_locked(&mode_config->connection_mutex)); > } > > -#define drm_for_each_connector(connector, dev) \ > - for (assert_drm_connector_list_read_locked(&(dev)->mode_config), > \ > -connector = list_first_entry(&(dev)->mode_config.connector_list, > \ > - struct drm_connector, head); > \ > -&connector->head != (&(dev)->mode_config.connector_list); > \ > -connector = list_next_entry(connector, head)) > - > -#define drm_for_each_encoder(encoder, dev) \ > - list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head) > - > -#define drm_for_each_fb(fb, dev) \ > - for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), > \ > -fb = list_first_entry(&(dev)->mode_config.fb_list, \ > - struct drm_framebuffer, head);
[PATCH 01/10] drm: Move a few macros away from drm_crtc.h
Now that there's less stuff in there I noticed that I overlooked them. Sprinkle some docs over them while at it. Signed-off-by: Daniel Vetter --- include/drm/drm_connector.h | 24 ++-- include/drm/drm_crtc.h| 32 include/drm/drm_encoder.h | 22 ++ include/drm/drm_framebuffer.h | 17 + include/drm/drm_modes.h | 2 ++ include/drm/drm_property.h| 1 + 6 files changed, 64 insertions(+), 34 deletions(-) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 66b7d6744dd2..e4e545e9516d 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -181,14 +181,19 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, /** * struct drm_connector_state - mutable connector state * @connector: backpointer to the connector - * @crtc: CRTC to connect connector to, NULL if disabled * @best_encoder: can be used by helpers and drivers to select the encoder * @state: backpointer to global drm_atomic_state */ struct drm_connector_state { struct drm_connector *connector; - struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */ + /** +* @crtc: CRTC to connect connector to, NULL if disabled. +* +* Do not change this directly, use drm_atomic_set_crtc_for_connector() +* instead. +*/ + struct drm_crtc *crtc; struct drm_encoder *best_encoder; @@ -744,4 +749,19 @@ int drm_mode_connector_set_path_property(struct drm_connector *connector, int drm_mode_connector_set_tile_property(struct drm_connector *connector); int drm_mode_connector_update_edid_property(struct drm_connector *connector, const struct edid *edid); + +/** + * drm_for_each_connector - iterate over all connectors + * @connector: the loop cursor + * @dev: the DRM device + * + * Iterate over all connectors of @dev. + */ +#define drm_for_each_connector(connector, dev) \ + for (assert_drm_connector_list_read_locked(&(dev)->mode_config), \ +connector = list_first_entry(&(dev)->mode_config.connector_list, \ + struct drm_connector, head); \ +&connector->head != (&(dev)->mode_config.connector_list); \ +connector = list_next_entry(connector, head)) + #endif diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 4880606e2ffd..2a642ae96127 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1991,22 +1991,7 @@ struct drm_mode_config { list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \ for_each_if ((plane_mask) & (1 << drm_plane_index(plane))) -/** - * drm_for_each_encoder_mask - iterate over encoders specified by bitmask - * @encoder: the loop cursor - * @dev: the DRM device - * @encoder_mask: bitmask of encoder indices - * - * Iterate over all encoders specified by bitmask. - */ -#define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \ - list_for_each_entry((encoder), &(dev)->mode_config.encoder_list, head) \ - for_each_if ((encoder_mask) & (1 << drm_encoder_index(encoder))) - #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) -#define obj_to_mode(x) container_of(x, struct drm_display_mode, base) -#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) -#define obj_to_blob(x) container_of(x, struct drm_property_blob, base) #define obj_to_plane(x) container_of(x, struct drm_plane, base) extern __printf(6, 7) @@ -2174,23 +2159,6 @@ assert_drm_connector_list_read_locked(struct drm_mode_config *mode_config) !drm_modeset_is_locked(&mode_config->connection_mutex)); } -#define drm_for_each_connector(connector, dev) \ - for (assert_drm_connector_list_read_locked(&(dev)->mode_config), \ -connector = list_first_entry(&(dev)->mode_config.connector_list, \ - struct drm_connector, head); \ -&connector->head != (&(dev)->mode_config.connector_list); \ -connector = list_next_entry(connector, head)) - -#define drm_for_each_encoder(encoder, dev) \ - list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head) - -#define drm_for_each_fb(fb, dev) \ - for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), \ -fb = list_first_entry(&(dev)->mode_config.fb_list, \ - struct drm_framebuffer, head); \ -&fb->head != (&(dev)->mode_config.fb_list); \ -fb = list_next_entry(fb, head)) - /* drm_edid.c */ bool drm_probe_ddc(struct i2c_adapter *adapter); struct edid *drm_get_edid(struct drm_connector *connector, diff --git a/include/drm/drm_encoder.h b/include/drm/dr