From patchwork Sat May 26 17:25:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10429173 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 1FF7D60249 for ; Sat, 26 May 2018 17:30:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FFBF28D43 for ; Sat, 26 May 2018 17:30:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 047012901C; Sat, 26 May 2018 17:30:24 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 ADF4628D43 for ; Sat, 26 May 2018 17:30:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FE106EB31; Sat, 26 May 2018 17:26:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8297A6E4C6 for ; Sat, 26 May 2018 17:26:13 +0000 (UTC) Received: from avalon.bb.dnainternet.fi (unknown [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 73DD71C66; Sat, 26 May 2018 19:25:45 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 57/60] drm/omap: Remove omap_crtc_output global array Date: Sat, 26 May 2018 20:25:15 +0300 Message-Id: <20180526172518.18710-58-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180526172518.18710-1-laurent.pinchart@ideasonboard.com> References: <20180526172518.18710-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 The omap_crtc_output global array is used to look up the DSS output device by channel. We can replace that by accessing the output device from the pipeline if we store the pipeline pointer in the omap_crtc structure. The global array is also used to protect against double connection of an output. This can't happen with the connection handling mechanism going from DSS outputs to displays. We can thus drop that check, allowing removal of the global array. Signed-off-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_crtc.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 9742d9f49a7c..5a56c8e02179 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -41,6 +41,7 @@ struct omap_crtc { struct drm_crtc base; const char *name; + struct omap_drm_pipeline *pipe; enum omap_channel channel; struct videomode vm; @@ -108,9 +109,6 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc) * job of sequencing the setup of the video pipe in the proper order */ -/* ovl-mgr-id -> crtc */ -static struct omap_dss_device *omap_crtc_output[8]; - /* we can probably ignore these until we support command-mode panels: */ static int omap_crtc_dss_connect(struct omap_drm_private *priv, enum omap_channel channel, @@ -119,13 +117,9 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv, const struct dispc_ops *dispc_ops = priv->dispc_ops; struct dispc_device *dispc = priv->dispc; - if (omap_crtc_output[channel]) - return -EINVAL; - if (!(dispc_ops->mgr_get_supported_outputs(dispc, channel) & dst->id)) return -EINVAL; - omap_crtc_output[channel] = dst; dst->dispc_channel_connected = true; return 0; @@ -135,7 +129,6 @@ static void omap_crtc_dss_disconnect(struct omap_drm_private *priv, enum omap_channel channel, struct omap_dss_device *dst) { - omap_crtc_output[channel] = NULL; dst->dispc_channel_connected = false; } @@ -158,7 +151,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) if (WARN_ON(omap_crtc->enabled == enable)) return; - if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) { + if (omap_crtc->pipe->output->output_type == OMAP_DISPLAY_TYPE_HDMI) { priv->dispc_ops->mgr_enable(priv->dispc, channel, enable); omap_crtc->enabled = enable; return; @@ -716,6 +709,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, init_waitqueue_head(&omap_crtc->pending_wait); + omap_crtc->pipe = pipe; omap_crtc->channel = channel; omap_crtc->name = channel_names[channel];