From patchwork Wed Mar 7 00:24:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10263257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D32F36016D for ; Wed, 7 Mar 2018 00:28:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C13EB2922F for ; Wed, 7 Mar 2018 00:28:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B60E629234; Wed, 7 Mar 2018 00:28:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 348482922F for ; Wed, 7 Mar 2018 00:28:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1432D6E58E; Wed, 7 Mar 2018 00:25:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from galahad.ideasonboard.com (galahad.ideasonboard.com [IPv6:2001:4b98:dc2:45:216:3eff:febb:480d]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1D446E40E for ; Wed, 7 Mar 2018 00:24:51 +0000 (UTC) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 700B722B08; Wed, 7 Mar 2018 01:22:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1520382146; bh=3AifdPJh5YVBDZUzHToWkhSB6h0P2NsdrfDBEacJUTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iY7PiVpuu9J7Q6XRY3EiS8GicdwMoYFnJC/p7ffNbEBoTtD5c07I8uPwE9QWOAJUQ cJQu5Ff79D1BwrcWjW8cc2cP+aVBdSOn/elJ2E2irMqSKuFo4yBft16+dOv4nZQvef mPJOmh1IxNMz0GQGi2sk/HEDgqZpS6vgNMlqIkXE= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH/RFC 44/60] drm/omap: dss: Add for_each_dss_output() macro Date: Wed, 7 Mar 2018 02:24:47 +0200 Message-Id: <20180307002503.19455-45-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180307002503.19455-1-laurent.pinchart@ideasonboard.com> References: <20180307002503.19455-1-laurent.pinchart@ideasonboard.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Similarly to for_each_dss_display(), the for_each_dss_output() macro iterates over all the DSS connected outputs. Signed-off-by: Laurent Pinchart --- 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);