[PATCH 4/9] drm/core: Add drm_for_each_encoder_mask.

Maarten Lankhorst
2015-11-24T09:34:31Z

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
include/drm/drm_crtc.h | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 29cfb4f8f99d..c54da2d297ec 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1172,6 +1172,17 @@ struct drm_mode_config {
list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
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) \
+ if ((encoder_mask) & (1 << drm_encoder_index(encoder)))

#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
#define obj_to_connector(x) container_of(x, struct drm_connector, base)
--
2.1.0