[PATCH/RFC 44/60] drm/omap: dss: Add for_each_dss_output() macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similarly to for_each_dss_display(), the for_each_dss_output() macro
iterates over all the DSS connected outputs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 20 ++++++++++++++------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 ++++++---
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 96be800a0f25..519682f18d36 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -127,11 +127,13 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
 
 /*
  * Search for the next device starting at @from. If display_only is true, skip
- * non-display devices. Release the reference to the @from device, and acquire
- * a reference to the returned device if found.
+ * non-display devices. If output_only is true, skip non-output devices and
+ * non-connected output devices. Release the reference to the @from device, and
+ * acquire a reference to the returned device if found.
  */
 struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
-						bool display_only)
+						bool display_only,
+						bool output_only)
 {
 	struct omap_dss_device *dssdev;
 	struct list_head *list;
@@ -159,9 +161,15 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
 			goto done;
 		}
 
-		/* Filter out non-display entries if display_only is set. */
-		if (!display_only || dssdev->driver)
-			goto done;
+		/*
+		 * Filter out non-display entries if display_only is set, and
+		 * non-output entries if output_only is set.
+		 */
+		if (display_only && !dssdev->driver)
+			continue;
+		if (output_only && (!dssdev->id || !dssdev->next))
+			continue;
+		goto done;
 	}
 
 	dssdev = NULL;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 076512628afc..f563cbce86e1 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -486,9 +486,9 @@ static inline bool omapdss_is_initialized(void)
 	return !!omapdss_get_dss();
 }
 
-void omapdss_display_init(struct omap_dss_device *dssdev);
 #define for_each_dss_display(d) \
-	while ((d = omapdss_device_get_next(d, true)) != NULL)
+	while ((d = omapdss_device_get_next(d, true, false)) != NULL)
+void omapdss_display_init(struct omap_dss_device *dssdev);
 
 void omapdss_device_register(struct omap_dss_device *dssdev);
 void omapdss_device_unregister(struct omap_dss_device *dssdev);
@@ -497,7 +497,8 @@ void omapdss_device_put(struct omap_dss_device *dssdev);
 struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
 						    unsigned int port);
 struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
-						bool display_only);
+						bool display_only,
+						bool output_only);
 int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *src,
 			   struct omap_dss_device *dst);
@@ -509,6 +510,8 @@ int omap_dss_get_num_overlay_managers(void);
 
 int omap_dss_get_num_overlays(void);
 
+#define for_each_dss_output(d) \
+	while ((d = omapdss_device_get_next(d, false, true)) != NULL)
 int omapdss_output_set_device(struct omap_dss_device *out,
 		struct omap_dss_device *dssdev);
 int omapdss_output_unset_device(struct omap_dss_device *out);
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux