dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 7/9] drm: Add drm_connector_has_possible_encoder()
Date: Thu, 28 Jun 2018 16:13:13 +0300	[thread overview]
Message-ID: <20180628131315.14156-8-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20180628131315.14156-1-ville.syrjala@linux.intel.com>

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

Add a small helper for checking whether a connector and
encoder are associated with each other.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_connector.c | 23 +++++++++++++++++++++++
 include/drm/drm_connector.h     |  3 +++
 2 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 186febcf4e55..84ff2fcdcb55 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -331,6 +331,29 @@ int drm_mode_connector_attach_encoder(struct drm_connector *connector,
 }
 EXPORT_SYMBOL(drm_mode_connector_attach_encoder);
 
+/**
+ * drm_connector_has_possible_encoder - check if the connector and encoder are assosicated with each other
+ * @connector: the connector
+ * @encoder: the encoder
+ *
+ * Returns:
+ * True if @encoder is one of the possible encoders for @connector.
+ */
+bool drm_connector_has_possible_encoder(struct drm_connector *connector,
+					struct drm_encoder *encoder)
+{
+	struct drm_encoder *enc;
+	int i;
+
+	drm_connector_for_each_possible_encoder(connector, enc, i) {
+		if (enc == encoder)
+			return true;
+	}
+
+	return false;
+}
+EXPORT_SYMBOL(drm_connector_has_possible_encoder);
+
 static void drm_mode_remove(struct drm_connector *connector,
 			    struct drm_display_mode *mode)
 {
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 8de3a3aa516a..9c59485fec36 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1181,6 +1181,9 @@ struct drm_connector *
 drm_connector_list_iter_next(struct drm_connector_list_iter *iter);
 void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
 
+bool drm_connector_has_possible_encoder(struct drm_connector *connector,
+					struct drm_encoder *encoder);
+
 /**
  * drm_for_each_connector_iter - connector_list iterator macro
  * @connector: &struct drm_connector pointer used as cursor
-- 
2.16.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-06-28 13:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 13:13 [PATCH v2 0/9] drm: Third attempt at fixing the fb-helper .best_encoder() mess Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 1/9] drm/fb-helper: Eliminate the .best_encoder() usage Ville Syrjala
2018-06-28 15:27   ` Alex Deucher
2018-07-05 13:59     ` Ville Syrjälä
2018-06-28 13:13 ` [PATCH v2 2/9] drm/i915: Nuke intel_mst_best_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 3/9] drm: Add drm_connector_for_each_possible_encoder() Ville Syrjala
2018-06-28 16:56   ` Daniel Vetter
2018-06-28 17:24     ` Ville Syrjälä
2018-06-28 13:13 ` [PATCH v2 4/9] drm/amdgpu: Use drm_connector_for_each_possible_encoder() Ville Syrjala
2018-06-28 13:13 ` Ville Syrjala [this message]
     [not found] ` <20180628131315.14156-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-28 13:13   ` [PATCH v2 5/9] drm/nouveau: " Ville Syrjala
2018-06-30 19:12     ` Dan Carpenter
2018-07-02 13:04       ` Ville Syrjälä
2018-07-02 14:05         ` Ville Syrjälä
     [not found]     ` <20180628131315.14156-6-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-02 15:29       ` [PATCH v3 " Ville Syrjala
2018-06-28 13:13   ` [PATCH v2 6/9] drm/radeon: " Ville Syrjala
2018-06-28 13:13   ` [PATCH v2 8/9] drm/msm: Use drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 9/9] drm/tilcdc: " Ville Syrjala
2018-06-28 13:45   ` Jyri Sarha
2018-06-28 17:52     ` Ville Syrjälä
2018-06-28 13:47 ` [PATCH v2 0/9] drm: Third attempt at fixing the fb-helper .best_encoder() mess Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628131315.14156-8-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox