[PATCH 01/14] drm: Add drm_encoder_mask()

Ville Syrjala ville.syrjala at linux.intel.com
Fri Jun 15 16:49:12 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Add drm_encoder_mask() which returns the 1<<index for the encoder.
We already have an identical drm_crtc_mask() for crtcs.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 include/drm/drm_encoder.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
index fb299696c7c4..d804a6897f4b 100644
--- a/include/drm/drm_encoder.h
+++ b/include/drm/drm_encoder.h
@@ -191,11 +191,23 @@ int drm_encoder_init(struct drm_device *dev,
  * Given a registered encoder, return the index of that encoder within a DRM
  * device's list of encoders.
  */
-static inline unsigned int drm_encoder_index(struct drm_encoder *encoder)
+static inline unsigned int drm_encoder_index(const struct drm_encoder *encoder)
 {
 	return encoder->index;
 }
 
+/**
+ * drm_encoder_mask - find the mask of a registered encoder
+ * @encoder: encoder to find mask for
+ *
+ * Given a registered encoder, return the mask bit of that encoder for an
+ * encoder's possible_clones field.
+ */
+static inline uint32_t drm_encoder_mask(const struct drm_encoder *encoder)
+{
+	return 1 << drm_encoder_index(encoder);
+}
+
 /**
  * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
  * @encoder: encoder to test
-- 
2.16.4



More information about the dri-devel mailing list