From patchwork Thu Jun 4 09:02:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 6545751 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E6009C0433 for ; Thu, 4 Jun 2015 11:07:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09860206D6 for ; Thu, 4 Jun 2015 11:07:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5DCF120713 for ; Thu, 4 Jun 2015 11:07:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 086DC6EB11; Thu, 4 Jun 2015 04:06:41 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by gabe.freedesktop.org (Postfix) with ESMTP id 6DCFF6EAD6 for ; Thu, 4 Jun 2015 02:04:15 -0700 (PDT) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t5494COE032314; Thu, 4 Jun 2015 04:04:12 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5494C8A030011; Thu, 4 Jun 2015 04:04:12 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Thu, 4 Jun 2015 04:04:12 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5493YwT014785; Thu, 4 Jun 2015 04:04:11 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 27/45] drm: omapdrm: Remove omap_crtc enabled field Date: Thu, 4 Jun 2015 12:02:44 +0300 Message-ID: <1433408582-9828-28-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433408582-9828-1-git-send-email-tomi.valkeinen@ti.com> References: <1433408582-9828-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 04 Jun 2015 04:06:34 -0700 Cc: Tomi Valkeinen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Pinchart The field tracks the CRTC state to avoid double-enable or -disable. As the DRM atomic core guarantees that the CRTC enable and disable functions won't be called on an already enabled or disabled CRTC, such tracking isn't needed. Remove the enabled field. Signed-off-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 430bf64521f0..e93ed34dea33 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -46,7 +46,6 @@ struct omap_crtc { struct omap_overlay_manager *mgr; struct omap_video_timings timings; - bool enabled; struct omap_drm_irq vblank_irq; struct omap_drm_irq error_irq; @@ -126,7 +125,7 @@ static void omap_crtc_dss_start_update(struct omap_overlay_manager *mgr) { } -/* Called only from omap_crtc_setup and suspend/resume handlers. */ +/* Called only from omap_crtc_encoder_setup and suspend/resume handlers. */ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) { struct drm_device *dev = crtc->dev; @@ -385,14 +384,14 @@ int omap_crtc_flush(struct drm_crtc *crtc) return 0; } -static void omap_crtc_setup(struct drm_crtc *crtc) +static void omap_crtc_encoder_setup(struct drm_crtc *crtc, bool enable) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); struct omap_drm_private *priv = crtc->dev->dev_private; struct drm_encoder *encoder = NULL; unsigned int i; - DBG("%s: enabled=%d", omap_crtc->name, omap_crtc->enabled); + DBG("%s: enable=%d", omap_crtc->name, enable); dispc_runtime_get(); @@ -408,14 +407,11 @@ static void omap_crtc_setup(struct drm_crtc *crtc) omap_crtc->current_encoder = encoder; - if (!omap_crtc->enabled) { - if (encoder) - omap_encoder_set_enabled(encoder, false); - } else { - if (encoder) { - omap_encoder_set_enabled(encoder, false); + if (encoder) { + omap_encoder_set_enabled(encoder, false); + if (enable) { omap_encoder_update(encoder, omap_crtc->mgr, - &omap_crtc->timings); + &omap_crtc->timings); omap_encoder_set_enabled(encoder, true); } } @@ -456,9 +452,6 @@ static void omap_crtc_enable(struct drm_crtc *crtc) DBG("%s", omap_crtc->name); - if (omap_crtc->enabled) - return; - /* Enable all planes associated with the CRTC. */ for (i = 0; i < priv->num_planes; i++) { struct drm_plane *plane = priv->planes[i]; @@ -467,9 +460,7 @@ static void omap_crtc_enable(struct drm_crtc *crtc) WARN_ON(omap_plane_set_enable(plane, true)); } - omap_crtc->enabled = true; - - omap_crtc_setup(crtc); + omap_crtc_encoder_setup(crtc, true); omap_crtc_flush(crtc); dispc_runtime_get(); @@ -485,9 +476,6 @@ static void omap_crtc_disable(struct drm_crtc *crtc) DBG("%s", omap_crtc->name); - if (!omap_crtc->enabled) - return; - omap_crtc_wait_page_flip(crtc); dispc_runtime_get(); drm_crtc_vblank_off(crtc); @@ -501,9 +489,7 @@ static void omap_crtc_disable(struct drm_crtc *crtc) WARN_ON(omap_plane_set_enable(plane, false)); } - omap_crtc->enabled = false; - - omap_crtc_setup(crtc); + omap_crtc_encoder_setup(crtc, false); omap_crtc_flush(crtc); }