From patchwork Fri Mar 10 04:32:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9615059 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 B115860415 for ; Fri, 10 Mar 2017 05:25:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2566286E3 for ; Fri, 10 Mar 2017 05:25:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95AE0286F1; Fri, 10 Mar 2017 05:25:02 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E657286E3 for ; Fri, 10 Mar 2017 05:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kN/nGWHwf3SD133H4MCJQUZzuYd8/As0opzcSkZ+15w=; b=gj4uC18H3NGPjfCXe6w9CaCQuK YJdXEQwK9aY71KLTk6g4Mtgzpk/F+dWU6qnzRXVfVTkKOmWbDWSp77R9a3ekwk+1cU+HsJ++rh4MM fyva1zW8apMX10XyE+Fj62Tc0oW81Cau1E8aEwALq3kyIm7dyvAdK/oCCVFevE40+3iaA8UeRnxb6 akh1t26RWwXS7DlAFOD4CiK7a7GloT5eQqdZW4UlS7HXXNzCjVtXKPXIPrRqfk8iZ/yv4/RgMwso9 q8Q7g07oMBfL7x5sX1+nJ7wVd02xycgFYwSAI0gSINkqEs+1i3cy6jdpGFk48y6Z+VB/SpjFcTH/5 C++yH5LQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cmD2x-0007zT-6E; Fri, 10 Mar 2017 05:24:59 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCMv-0004ks-9x for linux-arm-kernel@bombadil.infradead.org; Fri, 10 Mar 2017 04:41:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fZelgtP/qmGNRRPXdjGiyS8O82m+HqrKHKXnB2+6hLw=; b=3U5f3p4hn3iH18FV5G8zpywb5 bpz8tmaeFVTKgVb8Rr/kx32T4Vr8aPJDrSDjmPHV4eQXwkvXa8TAHIxUYRMwNvshrWnPgbTIRrTRK /ngfBlWJKKup8uUh5HT0whhWnX16M0bI420t+/gWD9O8XaAil/gNoNp49pyYkYBV/nbgqrKkF9xqR X5mlwfCmmiYhHGSvaPBQMLfY+aef/ZckVu7bK0iqnRT3QF7ABJ90Qtjmss1NpcePKpj43zE/kLwxd qTGqxOlUObWcc7kGbsefu8JVQB44vaFbd6lyMbcPcTKEWnp2EjMc2DKytH6ASWhhvhiMK4rCOxb0I w/7QcEtYw==; Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCMt-0006cH-7f for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2017 04:41:31 +0000 Received: by mail-qk0-x231.google.com with SMTP id 1so151623842qkl.3 for ; Thu, 09 Mar 2017 20:41:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fZelgtP/qmGNRRPXdjGiyS8O82m+HqrKHKXnB2+6hLw=; b=ahVD99KjJIWo4l9p7sFJq1pYBkZWm9PV81Dw/B49+3qr8pA1aTJEzuet6pgTuC3OCg 3nvPHj3LG3gr1N4/GWTGFCptHrnJNZQKYtPnXCD59UOn/V5c0KGnB/zgTjGDSzO9ZfQY fNZmJMNx5gviTRUdt5su2CqoVv/cGb0OEdgDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fZelgtP/qmGNRRPXdjGiyS8O82m+HqrKHKXnB2+6hLw=; b=aPruUQVzFYsUBiZlrMHrSM6j/rB2kvhCUKdLzPNQX3TodqxqJt3u9nj5Q38Sq14IPs EoI5ziwWeDYqFDKpAah+g6VE+jKVsi03V79qxART6H9S4WpXGnWgS6phkMPBrCgeF26X vmuwxCGYg/jNtwTzhOGFa4kCIU2O4XNQTC9aAi8z79a4It2BQjpRlcUtH7ApcULmibNr I4XgNY2mGaKShpICR2kPiJdyxCT4EdBY02tO94qtZnV5U2fAqcG13EZoPSB5hOGze8So xJOeSZTGKUNiGLXtCklBakr5QZ1NRMK2yvpe6unrhIra1AQpZ4WsCxxtDwjAKHRC+vdx 3IiQ== X-Gm-Message-State: AFeK/H0bJicYDpFpYA3HQcAM2UoMQan37+UbLrh2hivj5qXt7q/s/YwI6KPyuEKkItqxn1I0 X-Received: by 10.55.164.208 with SMTP id n199mr18457617qke.163.1489120870174; Thu, 09 Mar 2017 20:41:10 -0800 (PST) Received: from boxwood.roam.corp.google.com (cpe-75-189-128-87.nc.res.rr.com. [75.189.128.87]) by smtp.gmail.com with ESMTPSA id n19sm5697731qtn.35.2017.03.09.20.41.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 20:41:09 -0800 (PST) From: Sean Paul To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 32/41] drm/rockchip: Flush PSR before committing modeset disables/enables Date: Thu, 9 Mar 2017 23:32:47 -0500 Message-Id: <20170310043305.17216-33-seanpaul@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog In-Reply-To: <20170310043305.17216-1-seanpaul@chromium.org> References: <20170310043305.17216-1-seanpaul@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_234131_338303_62B87AFC X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , David Airlie , Tomasz Figa , Sean Paul , "Kristian H . Kristensen" , linux-arm-kernel@lists.infradead.org, Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tomasz Figa Currently PSR flush is triggered from CRTC's .atomic_begin() callback, which is executed after modeset disables and enables and before plane updates are committed. Since PSR flush and re-enable can be triggered asynchronously by external sources (input event, delayed work), it can race with hardware programming done in the aforementioned stages. To avoid the race, we can trigger PSR flush before committing modeset disables/enables. This also has the advantage of removing some PSR-specific knowledge from the VOP driver. Cc: Kristian H. Kristensen Signed-off-by: Tomasz Figa Signed-off-by: Sean Paul --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 13 +++++++++++++ drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 81f9548672b0..2067f4afadf3 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -175,10 +175,23 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev) } static void +rockchip_drm_psr_flush_state(struct drm_atomic_state *state) +{ + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + int i; + + for_each_crtc_in_state(state, crtc, crtc_state, i) + rockchip_drm_psr_flush(crtc); +} + +static void rockchip_atomic_commit_tail(struct drm_atomic_state *state) { struct drm_device *dev = state->dev; + rockchip_drm_psr_flush_state(state); + drm_atomic_helper_commit_modeset_disables(dev, state); drm_atomic_helper_commit_modeset_enables(dev, state); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index ea3fff4170d9..879efc3a6c67 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1067,18 +1067,11 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc, } } -static void vop_crtc_atomic_begin(struct drm_crtc *crtc, - struct drm_crtc_state *old_crtc_state) -{ - rockchip_drm_psr_flush(crtc); -} - static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs = { .enable = vop_crtc_enable, .disable = vop_crtc_disable, .mode_fixup = vop_crtc_mode_fixup, .atomic_flush = vop_crtc_atomic_flush, - .atomic_begin = vop_crtc_atomic_begin, }; static void vop_crtc_destroy(struct drm_crtc *crtc)