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: 9614813 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 78C1960415 for ; Fri, 10 Mar 2017 04:53:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1CC286D1 for ; Fri, 10 Mar 2017 04:53:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F03F286EF; Fri, 10 Mar 2017 04:53: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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham 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 0F329286D1 for ; Fri, 10 Mar 2017 04:53:40 +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=Q+0pNlLjbonGZ0AodjEEBSqTCNFm0oE4ZxfJ/9enjzE=; b=bpZDusHUzLN2tl9qMaeUEkcpNd 1talc1I3lOnqeZMq+PJB4sfO4/m2MfiuJQF6z+mKc6Maro/ZCaHXayEw6up/teiR2Y5mb3AERiSbQ REcznav8mqU3iZhHmSHbS/HQyB/MP2C7EW9U/hqujkfUVEuLD7IiOKx0XkadQkXtDTQj3tuZfJmGK u3ruhs+2YXefKv83/FnLjrgvfZf5GPqxu4akQXOenYWuw32oJfLrQnxgMIdCJiKhsGnskVRpsNZyz tmpb0Ab0or0SgtDbbCyHP0wuHF4lSy4qh9q6E4+rTmCd1FlzsBFnR9mtvfrok9ZKE7Tdbe8TRssaE tX/aKS3w==; 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 1cmCYd-0001nw-JN; Fri, 10 Mar 2017 04:53:39 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCY5-0001OX-H2 for linux-rockchip@bombadil.infradead.org; Fri, 10 Mar 2017 04:53:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=saX3YoWieZEqSygfEPNryUZmw 53VUb4c2e42nyYwwgP+uS6ztxUeUTmfYJjhoYt8s2lLXSZVluVcZv9LZYTOasn+0/HObaNsRZ2nPJ /nkCFh486Z49x9dZpkIn3WcjFv2l5bV75Mfcuq2t6vjV2E5Yp8pGD3EWV19fIfbsde4qOor5BbVg9 O3y8MhpyjMZeoZLp760hpHWLCrB29+tesAvgTfqghNHB0dVs/lLboCgCOeazGQha+tjN7zIJdGAZ2 8x67dRmNB1olyGfnFLK/7LChAJ3ykkX6fMKof/BK/qSAQb/HR2Ddo1EyV4iYvhmroU7zBqptvtI8u VWI8ZEZlw==; Received: from mail-qk0-x234.google.com ([2607:f8b0:400d:c09::234]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCMt-0001vm-No for linux-rockchip@lists.infradead.org; Fri, 10 Mar 2017 04:41:33 +0000 Received: by mail-qk0-x234.google.com with SMTP id 1so151623845qkl.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=eW5UcT4FXsA08Jg5HpC7fC5NFPAOan4w07ztpepdA7DLgKG3avHCZ/wHrsaaB6+zFl nkc0lt6Bq3fJWnInADu0dHeYF7opohPX6e37HCqSDxcID0brjjKozUG9/23OSKDYd9au lE0xYm1SgsPhYPo4bTivcca2rR5i0F2NoFfS3xnBZPkIcUr0drsMWz8y0YrNWQu/sVkC M2LsfT07d3xt9ZoABLv9rhf6vTqZR28a0WQCAIbT0iXMNC1VbC3UR44iDHWRvA55QXK1 uhrNrFy2So3khhiikgwbhLxQgTaaSnlKvtgiMZTjw6SRSuaxDRBNyBrtyJ0VpTaXZcZF /nWw== X-Gm-Message-State: AFeK/H2hiFthgu8VuC9imnawKoEJ9sEpAcprPH1BGHL6ga5oZwbNnmIQN4ZtWCPol63+SHY4 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-20170310_044131_896453_78B7979C X-CRM114-Status: GOOD ( 11.75 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=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)