From patchwork Mon Jun 22 15:31:06 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: 11618225 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 6E2D160D for ; Mon, 22 Jun 2020 15:33:01 +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 469F320732 for ; Mon, 22 Jun 2020 15:33:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rZY1ThKs"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GCaW2vIs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 469F320732 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-arm-kernel-bounces+patchwork-linux-arm=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=XHQmfASkfrgwr1xd1T3kFJBzr3DsinlEK64CfAxBI/Q=; b=rZY1ThKsT5e/jUddH4FKS7GXRw ahXSSBdVuPRw/T9Z0YoJE6IGqCwLzVV2EWTPaTu9QwbAGdXULrDsNxPFhNc3PkhFad6nuLTDihha0 QP5151oUpwPyhO6vjYdGJez3inE7LchR2SvbCF+28SelPXUp5oigdEHE772s5YqcIWMXNI7mfcUXs FmRprhYXGP+BnzYouEOueLa+e4wHr4wDfxTvfldxGn3rPLq0DrYUoMrJ9+K2VJyw6+Ga8Ds2V3ZRK +4k6ko9y/FMqnIgqAq7zPzUyJ8qO1jBQnm6QsscAng43F1ray4hTynWeSwEI/83TcpBai1Y7xIpqB Zo8CLyDg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnOPm-0004EA-G9; Mon, 22 Jun 2020 15:31:18 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnOPi-0004CX-P7 for linux-arm-kernel@lists.infradead.org; Mon, 22 Jun 2020 15:31:15 +0000 Received: by mail-pg1-x543.google.com with SMTP id d4so8308376pgk.4 for ; Mon, 22 Jun 2020 08:31:14 -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=W7ixdH9XmCR/FGRBWjByQkDAMb4Q8iNrtrWXUPaU65E=; b=GCaW2vIs8IrqprYix18IRhF4GCZn+fvewA1HI3tj240Pvy5jWnECjwNMtHHB1x5egu rhNOAsJfnsQCNPXdT/l0XTf32ueyjcEd093oMY7/gqBRGas7eDy7Tb+yJ3woe7Nh1L2k BK59KeUXIf+/lckgrD2y2ZKa34XQvyzyntPkk= 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=W7ixdH9XmCR/FGRBWjByQkDAMb4Q8iNrtrWXUPaU65E=; b=AoI4RjMS4ovM57Js0RLjf663+ut2q/OoIyX86E0r50MQT7H6iYLpHnFdUVZMUT2q/x 19Kab4TXIqCf6YjLFVP9vv8c6OFJZWpurbpOqqvtblmMHZgq26XHHhgSCpmx88fJiI6N gjdWXjQQvSZWRzD32XMgNNM+0U4+i4xlPyYptZH3H44hNGeeV3zswh4BQwdXST6riIVA N4kk6hP6bAVRMRao77KQmhqfBp2nDX3BPyiiqfsNLUlSyavxOour6O4PmcEcBho2RzSR sM6D7Zk5m4buWyU5pI4jzG4AJaDr0MyqKMhwTocWN24DeinWEXHrNrFBsF245Ylut6R8 8csg== X-Gm-Message-State: AOAM530GI3GxumTv3vtKxjoR19CjInb4lb0nGpbq+Z0SVnA6aLYskflz IeeKfYS9dxfI+k2ZWUryGtKWutYN+mY= X-Google-Smtp-Source: ABdhPJyWELrsdwoWW5EjGH/mw6RztGq7UXdSlrI+wSZwEzbuiE+7gkSdERYqm6zry4UcsIZV7AV6aw== X-Received: by 2002:a63:525a:: with SMTP id s26mr10961206pgl.155.1592839872030; Mon, 22 Jun 2020 08:31:12 -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 e78sm14464926pfh.50.2020.06.22.08.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 08:31:11 -0700 (PDT) From: Hsin-Yi Wang To: linux-arm-kernel@lists.infradead.org, Chun-Kuang Hu Subject: [PATCH v3] drm/mediatek: check plane visibility in atomic_update Date: Mon, 22 Jun 2020 23:31:06 +0800 Message-Id: <20200622153106.112115-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.27.0.111.gc72c7da667-goog MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) 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:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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. Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") Signed-off-by: Hsin-Yi Wang Reviewed-by: Chun-Kuang Hu Change-Id: Id5341d60ddfffc88a38d9db0caa089b2d6a1d29c Reviewed-by: Tomasz Figa --- v3: Address comment v2: Add fixes tag --- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 25 ++++++++++++++---------- 1 file changed, 15 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..92141a19681b 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,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, if (!crtc || WARN_ON(!fb)) return; + if (!plane->state->visible) { + mtk_plane_atomic_disable(plane, old_state); + return; + } + gem = fb->obj[0]; mtk_gem = to_mtk_gem_obj(gem); addr = mtk_gem->dma_addr; @@ -200,16 +215,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,