From patchwork Mon Jun 22 05:32:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 11617777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A06013A0 for ; Mon, 22 Jun 2020 13:46:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F12C20738 for ; Mon, 22 Jun 2020 13:46:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bhI7vZQZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="olcM+OpR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dPCYMgxw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F12C20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=dJNNZYv5X5pQvLY1rYJkFYgSGlVb4kCPvyOzIIedKKA=; b=bhI7vZQZDyN3wTNja437ytFaGI gK8WRDjAaNttJTNHH7iYtCOgMqk8pucljDLDGp+qWXcUUe4in2yq5OgEEG6suxhHs9/hzAMV/wGzi d6/cs5t9w4dlmgR7ylwKYp8zbOrElb7oDPlVk1BCixJMsuwQavOiUnAIQjcQejmdRWHUh2zzaMFNy 1aN3S53KZA3uB4zJaYrJ5y38F+yS5KIrCoaML2tTni/kIBQObHRSSQMNTn4SZJZk1jfXcJKdmn9ho Sm0azwMM85FP/Cf00Ch6qPqP8Z0lFL9ZqQ3BOqj7ysRUqWmWLRJh5qfGiqI/TbImbNPd5sJdFlKAR vy34NkIg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnMlx-0000o0-QE; Mon, 22 Jun 2020 13:46:05 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnLxo-000529-5S for linux-mediatek@merlin.infradead.org; Mon, 22 Jun 2020 12:54:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=FOs8/vOcSTNojAnkjIJLl6Zwh7pEFROh/lHqucoCGw4=; b=olcM+OpRei5fDxeJBbvg2XxYsx fbHtG7s9nSIqHVRc1a1VLNogSLymioPCYVsKG3sbfhQ9lTQTp0ZX2CFFHm3jewZbBtAnBAViVrVRU 9Aa2U2XdJQbSJH1jcHpbMae3ZLRG8unHqQAS0UTiaxKBkqgPE4nBW9w5YiUT+u3kKNu3/eHAtDRUh zTETGG/1YSBCScgzuoJUiRKnNc5hSPy8weaFjjXZilYHcUQU64Hnik/JB7Rk/tjBpPN+pqLxaFDui ASLxoeRqftPAW07pYo8G9lP6Z8MPyfnkIRJN1UZemrV5Sq6Wskcx/N65PbP4NL0G4bUcl3o/6lu5T 4y5qmqMQ==; Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnF4V-0007LX-VN for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 05:32:46 +0000 Received: by mail-pl1-x642.google.com with SMTP id y17so7092148plb.8 for ; Sun, 21 Jun 2020 22:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FOs8/vOcSTNojAnkjIJLl6Zwh7pEFROh/lHqucoCGw4=; b=dPCYMgxwutm6jIq2Wj18eM2TXJW8xWvR97Y37deovDDlPXTd+KGT1+Ju9/iINFjIht NCUTlZdh+IITFYHEEyBkDxE4y2z67kqprIsFDboISSXR+1vtlhazfUh8hCWCDTSOUdaT StTuEMbg+XmgJ+ClOhdbG3/p4rJCeIwGLQDdw= 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:mime-version :content-transfer-encoding; bh=FOs8/vOcSTNojAnkjIJLl6Zwh7pEFROh/lHqucoCGw4=; b=XOH1hlGaOmYuxlbqURj29/E9nfY4ZFtON0S5RhV8984Wc0LqBl2CxjwObBePyJTyfa ae8ya9BOpvxv9Tw+2b3asyFymXjA1anVO2+O+2YQr4k5mbIrEJMWZAKO8mS/F6/idvO5 wMPXMYNxCm78l09ZFbNe9hMnCgOjaXIjFYPpKSw8BXY/wAFgoUet06QkSTePvGxTCd04 hQ4qAIaLZhfKBkC3Bp2bNxmXHNtDr5BbpKi6pNbB5bg22dNUrQ5uXQckRK2xu9QU9V5p 5U7huPXr1niXYj6c1fCtW4PtrWyWkPeR8n+YVwShipjhqCWZ7vrvqJpmEMCc5jLrGgXx 8IIg== X-Gm-Message-State: AOAM531s1LRgwVjZL8U2NPIPxiZvMtFRX2FrtDy617qQlvjHhtNMeZX6 182YjqEQ9y4LPNGolmoezCaAfw== X-Google-Smtp-Source: ABdhPJyZmlvjgo1vg45lGnOaXcMAlL6/gigFUFN6X5r+Q50PTwVNyET7M9/6fIkpx0Z3VHooFu3v5w== X-Received: by 2002:a17:90a:1a17:: with SMTP id 23mr16362040pjk.231.1592803959593; Sun, 21 Jun 2020 22:32:39 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:b852:bd51:9305:4261]) by smtp.gmail.com with ESMTPSA id b1sm12240078pjc.33.2020.06.21.22.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jun 2020 22:32:39 -0700 (PDT) From: Hsin-Yi Wang To: linux-arm-kernel@lists.infradead.org, Chun-Kuang Hu Subject: [PATCH] drm/mediatek: check plane visibility in atomic_update Date: Mon, 22 Jun 2020 13:32:34 +0800 Message-Id: <20200622053234.122120-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.27.0.111.gc72c7da667-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200622_063244_165502_9B765F40 X-CRM114-Status: GOOD ( 11.55 ) X-Spam-Score: -2.1 (--) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Zabel , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, yongqiang.niu@mediatek.com, linux-mediatek@lists.infradead.org, Daniel Vetter , Matthias Brugger , tfiga@chromium.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Disable the plane if it's not visible. Otherwise mtk_ovl_layer_config() would proceed with invalid plane and we may see vblank timeout. Signed-off-by: Hsin-Yi Wang Reviewed-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index c2bd683a87c8..74dc71c7f3b6 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, true, true); } +static void mtk_plane_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct mtk_plane_state *state = to_mtk_plane_state(plane->state); + + state->pending.enable = false; + wmb(); /* Make sure the above parameter is set before update */ + state->pending.dirty = true; +} + static void mtk_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { @@ -178,6 +188,9 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, if (!crtc || WARN_ON(!fb)) return; + if (!plane->state->visible) + return mtk_plane_atomic_disable(plane, old_state); + gem = fb->obj[0]; mtk_gem = to_mtk_gem_obj(gem); addr = mtk_gem->dma_addr; @@ -200,16 +213,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, state->pending.dirty = true; } -static void mtk_plane_atomic_disable(struct drm_plane *plane, - struct drm_plane_state *old_state) -{ - struct mtk_plane_state *state = to_mtk_plane_state(plane->state); - - state->pending.enable = false; - wmb(); /* Make sure the above parameter is set before update */ - state->pending.dirty = true; -} - static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { .prepare_fb = drm_gem_fb_prepare_fb, .atomic_check = mtk_plane_atomic_check,