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: 109234 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2941083qge; Wed, 2 Aug 2017 08:48:40 -0700 (PDT) X-Received: by 10.84.217.142 with SMTP id p14mr15970075pli.22.1501688920614; Wed, 02 Aug 2017 08:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501688920; cv=none; d=google.com; s=arc-20160816; b=VE2cRaAJtX8q4EipZbZ5kGUK6M82eARaEc3S7fhWHRdtQF6E45CbEc8Su+gCJ1oxCN 6P/H+1ySxsSz3HzpDRR6NMOd0LrdlBqKyqsvDkZYXu23oYQB6id55gDhWpP0rZVuHVaa L4arqlJqUR9QzgSpRuSYQWTI04yLoEVVta8E7/Gr2qVmdzMsfnnmrv18UKICTA9jnYkw 46Tbp9sFplEXf5Q6EzABfADHwCqe4JofeHkUQQuxvM81oaxv1N7nZXvFMnZ0ZPKLN6c/ RRBpIdV0LTMDQXP25/D+M3ipN3Ih/NLHI658NJpxYLoETteWyK8dtgWVf3ZQjdwVGgY6 9PXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=QMDbjIbmV7C3yy1xKAPm3nv/cF69zLimsMg90whBp3I=; b=mndDXx8BVCeVLKglfTPORrZxYFsCQXbN3GSFL7MvJi0edv/ml9/pbRVwuWm+BjuDDF TYCTmrWIrFkp7ZYnq3M0WXuwUhwsOYory8+S82zCPWz+eIAsbP9zPddxqC+PLsM42foj TzX7OxKZo6HNKwpHl2ToP/CPHGXkcSrV0EWEYVq5BmWYh9B3R7zHVMWloMrHP7V1lW7d OfXZOp9JHx8N9ZG4/uIidg+nfGhoLgL4ZzOdU8OsK5ZKIJDurKHKlpL+UVbnqPelPFf/ 5Zvt/jeMHgAhddMWs25K3Il2KEJ8jCk3ZUSq7ROHwSiJ+L+MWaInqsQFcn7YG2Xbhhgv rzzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id d63si18465922pld.902.2017.08.02.08.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 08:48:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org 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" 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);