From patchwork Fri Mar 15 17:01:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10855323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AB4E139A for ; Fri, 15 Mar 2019 17:01:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 226CC2AB36 for ; Fri, 15 Mar 2019 17:01:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 163F12AB4C; Fri, 15 Mar 2019 17:01:27 +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 BB3EA2AB36 for ; Fri, 15 Mar 2019 17:01:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35D136E4CB; Fri, 15 Mar 2019 17:01:23 +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 60F176E4C3 for ; Fri, 15 Mar 2019 17:01:19 +0000 (UTC) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F8E7998; Fri, 15 Mar 2019 18:01:17 +0100 (CET) From: Kieran Bingham To: linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Subject: [PATCH v2 3/6] drm: rcar-du: Add pre/post commit CRTC helpers Date: Fri, 15 Mar 2019 17:01:07 +0000 Message-Id: <20190315170110.23280-4-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190315170110.23280-1-kieran.bingham+renesas@ideasonboard.com> References: <20190315170110.23280-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1552669277; bh=aVY5f6PMZdwzbI1d/sLGxRVQepXzKdr0SDBDUq7PiNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JhgJXMxpkqGmt8O125KpUQynm8FHb8oYPrpczwYaK4GHTTIVRN98P88uOTWBXwPZ8 dsAkfY7sRvwJN9aA3gDQc6bestwknN4fwLLXZanxOJ7Yh1a8gshU9WL1r31+0RhIb2 hhc5Zs2o/idgYsahDrXqm13Tcto93WC2PyFmw824= 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: David Airlie , Kieran Bingham , open list Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Provide helpers to allow CRTC configuration to be separated from the power state handling. rcar_du_crtc_atomic_post_commit() is a no-op, but maintained for API symmetry. Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 25 +++++++++++++++++++++++-- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 5 +++++ drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 6109a97b0bb9..2606de788688 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -515,8 +515,6 @@ static int rcar_du_crtc_enable(struct rcar_du_crtc *rcrtc) if (ret < 0) goto error_group; - rcar_du_crtc_setup(rcrtc); - return 0; error_group: @@ -683,6 +681,29 @@ int rcar_du_crtc_atomic_enter_standby(struct drm_device *dev, return 0; } +int rcar_du_crtc_atomic_pre_commit(struct drm_device *dev, + struct drm_atomic_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *crtc_state; + unsigned int i; + + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + + if (crtc_state->active_changed && crtc_state->active) + rcar_du_crtc_setup(rcrtc); + } + + return 0; +} + +int rcar_du_crtc_atomic_post_commit(struct drm_device *dev, + struct drm_atomic_state *state) +{ + return 0; +} + static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index d12d4a788e9f..0b60a6e0b753 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h @@ -105,6 +105,11 @@ int rcar_du_crtc_atomic_exit_standby(struct drm_device *dev, int rcar_du_crtc_atomic_enter_standby(struct drm_device *dev, struct drm_atomic_state *state); +int rcar_du_crtc_atomic_pre_commit(struct drm_device *dev, + struct drm_atomic_state *state); +int rcar_du_crtc_atomic_post_commit(struct drm_device *dev, + struct drm_atomic_state *state); + void rcar_du_crtc_dsysr_clr_set(struct rcar_du_crtc *rcrtc, u32 clr, u32 set); #endif /* __RCAR_DU_CRTC_H__ */ diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b8da4dfc79d2..e4befb1937f8 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -304,12 +304,14 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state) /* Apply the atomic update. */ rcar_du_crtc_atomic_exit_standby(dev, old_state); + rcar_du_crtc_atomic_pre_commit(dev, old_state); drm_atomic_helper_commit_modeset_disables(dev, old_state); drm_atomic_helper_commit_planes(dev, old_state, DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_modeset_enables(dev, old_state); + rcar_du_crtc_atomic_post_commit(dev, old_state); rcar_du_crtc_atomic_enter_standby(dev, old_state); drm_atomic_helper_commit_hw_done(old_state);