From patchwork Thu Jun 4 09:02:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 6545671 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 70E7A9F6CE for ; Thu, 4 Jun 2015 11:06:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7856B206D6 for ; Thu, 4 Jun 2015 11:06:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0612920713 for ; Thu, 4 Jun 2015 11:06:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DB956EAFE; Thu, 4 Jun 2015 04:06:36 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by gabe.freedesktop.org (Postfix) with ESMTP id CDD9B6EAD7 for ; Thu, 4 Jun 2015 02:11:54 -0700 (PDT) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t5494Ex2010377; Thu, 4 Jun 2015 04:04:14 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5494DJp030046; Thu, 4 Jun 2015 04:04:13 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Thu, 4 Jun 2015 04:04:13 -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 t5493YwU014785; Thu, 4 Jun 2015 04:04:12 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 28/45] drm: omapdrm: Remove omap_plane enabled field Date: Thu, 4 Jun 2015 12:02:45 +0300 Message-ID: <1433408582-9828-29-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 plane state to avoid double-enable or -disable. This isn't required anymore, as - the DRM atomic core guarantees that the plane atomic_update and atomic_disable functions will never be called on an enabled/disabled plane - the CRTC enable/disable operations that enable/disable the plane are already guarded against double enable/disable We can thus remove the enabled field completely. The omap_plane_set_enable() function then becomes a wrapper around omap_plane_setup() which can be called directly. Signed-off-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 11 +++++---- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_plane.c | 45 +++++++----------------------------- 3 files changed, 16 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index e93ed34dea33..82d03ed92576 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -452,19 +452,21 @@ static void omap_crtc_enable(struct drm_crtc *crtc) DBG("%s", omap_crtc->name); + dispc_runtime_get(); + /* Enable all planes associated with the CRTC. */ for (i = 0; i < priv->num_planes; i++) { struct drm_plane *plane = priv->planes[i]; if (plane->crtc == crtc) - WARN_ON(omap_plane_set_enable(plane, true)); + WARN_ON(omap_plane_setup(plane)); } omap_crtc_encoder_setup(crtc, true); omap_crtc_flush(crtc); - dispc_runtime_get(); drm_crtc_vblank_on(crtc); + dispc_runtime_put(); } @@ -479,18 +481,19 @@ static void omap_crtc_disable(struct drm_crtc *crtc) omap_crtc_wait_page_flip(crtc); dispc_runtime_get(); drm_crtc_vblank_off(crtc); - dispc_runtime_put(); /* Disable all planes associated with the CRTC. */ for (i = 0; i < priv->num_planes; i++) { struct drm_plane *plane = priv->planes[i]; if (plane->crtc == crtc) - WARN_ON(omap_plane_set_enable(plane, false)); + WARN_ON(omap_plane_setup(plane)); } omap_crtc_encoder_setup(crtc, false); omap_crtc_flush(crtc); + + dispc_runtime_put(); } static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index f5209412fae6..7f815552fe7e 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -151,7 +151,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, struct drm_plane *omap_plane_init(struct drm_device *dev, int id, enum drm_plane_type type); -int omap_plane_set_enable(struct drm_plane *plane, bool enable); +int omap_plane_setup(struct drm_plane *plane); void omap_plane_install_properties(struct drm_plane *plane, struct drm_mode_object *obj); diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 465fd9cafd7b..d18fe106e256 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -40,8 +40,6 @@ struct omap_plane { int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */ const char *name; - bool enabled; - uint32_t nformats; uint32_t formats[32]; @@ -60,18 +58,19 @@ to_omap_plane_state(struct drm_plane_state *state) return container_of(state, struct omap_plane_state, base); } -static int omap_plane_setup(struct omap_plane *omap_plane) +int omap_plane_setup(struct drm_plane *plane) { - struct drm_plane_state *state = omap_plane->base.state; + struct omap_plane *omap_plane = to_omap_plane(plane); + struct drm_plane_state *state = plane->state; struct omap_plane_state *omap_state = to_omap_plane_state(state); - struct drm_device *dev = omap_plane->base.dev; + struct drm_device *dev = plane->dev; struct omap_overlay_info info; struct omap_drm_window win; int ret; - DBG("%s, enabled=%d", omap_plane->name, omap_plane->enabled); + DBG("%s, crtc=%p fb=%p", omap_plane->name, state->crtc, state->fb); - if (!omap_plane->enabled) { + if (!state->crtc) { dispc_ovl_enable(omap_plane->id, false); return 0; } @@ -134,23 +133,6 @@ static int omap_plane_setup(struct omap_plane *omap_plane) return 0; } -int omap_plane_set_enable(struct drm_plane *plane, bool enable) -{ - struct omap_plane *omap_plane = to_omap_plane(plane); - int ret; - - if (enable == omap_plane->enabled) - return 0; - - omap_plane->enabled = enable; - - dispc_runtime_get(); - ret = omap_plane_setup(omap_plane); - dispc_runtime_put(); - - return ret; -} - static int omap_plane_prepare_fb(struct drm_plane *plane, struct drm_framebuffer *fb, const struct drm_plane_state *new_state) @@ -168,14 +150,7 @@ static void omap_plane_cleanup_fb(struct drm_plane *plane, static void omap_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct omap_plane *omap_plane = to_omap_plane(plane); - struct drm_plane_state *state = plane->state; - - if (!state->fb || !state->crtc) - return; - - omap_plane->enabled = true; - omap_plane_setup(omap_plane); + omap_plane_setup(plane); } static void omap_plane_atomic_disable(struct drm_plane *plane, @@ -188,11 +163,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : omap_plane->id; - if (!omap_plane->enabled) - return; - - omap_plane->enabled = false; - omap_plane_setup(omap_plane); + omap_plane_setup(plane); } static const struct drm_plane_helper_funcs omap_plane_helper_funcs = {