From patchwork Wed Aug 2 15:48:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 9876935 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 111D360360 for ; Wed, 2 Aug 2017 15:48:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02BE3287C3 for ; Wed, 2 Aug 2017 15:48:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB881287D4; Wed, 2 Aug 2017 15:48:40 +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.2 required=2.0 tests=BAYES_00, 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 8B8B5287C3 for ; Wed, 2 Aug 2017 15:48:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E6296F1C4; Wed, 2 Aug 2017 15:48:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 07D976F1C4 for ; Wed, 2 Aug 2017 15:48:37 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.60]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v72FmTvd026863; Wed, 2 Aug 2017 16:48:29 +0100 From: Liviu Dudau To: Mali DP Maintainers Subject: [PATCH] drm: mali-dp: Restore commit_tail behaviour to the runtime_pm friendly version. Date: Wed, 2 Aug 2017 16:48:28 +0100 Message-Id: <20170802154828.21519-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.13.3 Cc: LKML , DRI devel , Laurent Pinchart 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit 46f1d42f2738 ("drm: mali-dp: Update the state of all planes before re-enabling active CRTCs.") changed the runtime_pm recommended order of doing the commit_tail (disable old crtc, enable new crtc, do the plane updates) to the old non-atomic compat order (disable old crtc, do the plane updates, enable new crtc) in order to stop planes streaming out stale data. Turns out that the proper thing to do is to remember to disable the planes on the crtcs that get disabled, and the problem goes away. Oh, and only activate the planes that are involved in the new commit, too. Fixes commit 46f1d42f2738 ("drm: mali-dp: Update the state of all planes before re-enabling active CRTCs.") Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_crtc.c | 4 ++++ drivers/gpu/drm/arm/malidp_drv.c | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 3615d18a7ddf..ca413896b087 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -77,7 +77,11 @@ static void malidp_crtc_atomic_disable(struct drm_crtc *crtc, struct malidp_hw_device *hwdev = malidp->dev; int err; + /* always disable planes on the CRTC that is being turned off */ + drm_atomic_helper_disable_planes_on_crtc(old_state, false); + drm_crtc_vblank_off(crtc); + hwdev->enter_config_mode(hwdev); clk_disable_unprepare(hwdev->pxlclk); diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index a6a05a768dd1..d4b1636b441a 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -221,9 +221,8 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state) struct drm_crtc_state *old_crtc_state; int i; - pm_runtime_get_sync(drm->dev); - drm_atomic_helper_commit_modeset_disables(drm, state); + drm_atomic_helper_commit_modeset_enables(drm, state); for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { malidp_atomic_commit_update_gamma(crtc, old_crtc_state); @@ -231,16 +230,12 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state) malidp_atomic_commit_se_config(crtc, old_crtc_state); } - drm_atomic_helper_commit_planes(drm, state, 0); - - drm_atomic_helper_commit_modeset_enables(drm, state); + drm_atomic_helper_commit_planes(drm, state, DRM_PLANE_COMMIT_ACTIVE_ONLY); malidp_atomic_commit_hw_done(state); drm_atomic_helper_wait_for_vblanks(drm, state); - pm_runtime_put(drm->dev); - drm_atomic_helper_cleanup_planes(drm, state); } @@ -685,12 +680,12 @@ static void malidp_unbind(struct device *dev) struct malidp_drm *malidp = drm->dev_private; drm_dev_unregister(drm); + pm_runtime_get_sync(dev); if (malidp->fbdev) { drm_fbdev_cma_fini(malidp->fbdev); malidp->fbdev = NULL; } drm_kms_helper_poll_fini(drm); - pm_runtime_get_sync(dev); malidp_se_irq_fini(drm); malidp_de_irq_fini(drm); component_unbind_all(dev, drm);