Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4596144rdb; Tue, 12 Dec 2023 04:20:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt0OrEzVMBd3tScuHDnz3bplCdVdFJT5A7HBk7XlL05Lkk47b98cxpuoMwmvblLGIo2MaN X-Received: by 2002:a05:6871:208c:b0:1fb:d89:48c3 with SMTP id ry12-20020a056871208c00b001fb0d8948c3mr7355956oab.27.1702383635844; Tue, 12 Dec 2023 04:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702383635; cv=none; d=google.com; s=arc-20160816; b=HewLTx6eToCtLhf4q2bvnPaoISC1xVAXy/xeb+H72aZldl+z7LvrmE9/23i1fEFEn0 hahL5zRSrUxbPWSwW1fbdhCC61bd1JvUsk7kIkzKJclzAovTQbFfMOm5KhhsX/3Dlgc/ kI5MDT9jRXTfiTgYTG4vXDF7Kaaew4h6sF/HetYaeK/yRtVctWnTgOIfzWttzBB31AiJ W6Y1BTTqfnIY1uii9T+akUppQZ5PCrSeFvrS47+LGNvAhSg/0OnZ/SUE896XdiaP0opO IO0zW2TB2QKa8JEtdXj3W4tCcPzI3Wd08BaISBGyVL1o8xHRmit9P2gNUijRJGCmrca7 WR8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4lXtxRLW2YUA4Wg50wpANF7MKGwStkbHF3oDgsbY6kQ=; fh=9gBY3LVbdxTioLa7O2pOsMOkTMxlNAxxvKin9b2wF1U=; b=l8Wk68GT0OF3BHPTxbJ23S6rDTl9AhULCBE+8lbZHWrXoifPlXZuEcT5qChh6EPa6e GnOCJeFxk6MEx+z1FS+BbpQNwnt02HqPFfByVpjL89CgyCOKRRYRm+rkpElyMbvBdLCG ERy8vDQ0l528unQwgw15HOOoYmUBpLDSzV2I+zJ3fdmT/SVIvPg66rdfF77kses7ku2I C4Sxey4YTf0P1Inn/8ZYFqoHICj8A5R8aDFMQvfypwWUt/BY86O9aB+B1SmIW6RoWxdD tZVn4DMh6apAIT+IKRIZT++P1Vsq3VyLJc1M+imtBCpoIOiFaZ7ApvaznBkUL9NsD3Xg JSiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=eIsTuf9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id q24-20020a63e958000000b005c6b4091c32si7616911pgj.385.2023.12.12.04.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 04:20:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=eIsTuf9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 29EE48021397; Tue, 12 Dec 2023 04:20:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346413AbjLLMUI (ORCPT + 99 others); Tue, 12 Dec 2023 07:20:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232372AbjLLMUG (ORCPT ); Tue, 12 Dec 2023 07:20:06 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3AA3D5; Tue, 12 Dec 2023 04:20:07 -0800 (PST) X-UUID: c66cc80698e811eea5db2bebc7c28f94-20231212 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=4lXtxRLW2YUA4Wg50wpANF7MKGwStkbHF3oDgsbY6kQ=; b=eIsTuf9DRXBPrpwn+rN+YYCcQ5KFwuT/XDGvaYAX2E+nWYYTHVq/5ZtfTB6KMGa78/yvBCbFC9gt+19S4NZ3DfJJN65SBDaJhccORouBws5L3ldMEDVMY8lS7DR/0wVgZgcpc15LC9lWgLfXbtK7cRYI1p2P0IKuxtuSGf1FFVw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:c23d5db9-7d0d-42f6-8d8b-5969664cc573,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:0a7d16bd-2ac7-4da2-9f94-677a477649d9,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: c66cc80698e811eea5db2bebc7c28f94-20231212 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2088098696; Tue, 12 Dec 2023 20:20:02 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 12 Dec 2023 20:20:02 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 12 Dec 2023 20:20:01 +0800 From: Hsiao Chien Sung To: AngeloGioacchino Del Regno , Chun-Kuang Hu , CK Hu CC: Philipp Zabel , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Chen-Yu Tsai , Sean Paul , Fei Shao , Bibby Hsieh , , , , , , Hsiao Chien Sung Subject: [PATCH v4 11/17] drm/mediatek: Turn off the layers with zero width or height Date: Tue, 12 Dec 2023 20:19:51 +0800 Message-ID: <20231212121957.19231-12-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231212121957.19231-1-shawn.sung@mediatek.com> References: <20231212121957.19231-1-shawn.sung@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 04:20:33 -0800 (PST) We found that IGT (Intel GPU Tool) will try to commit layers with zero width or height and lead to undefined behaviors in hardware. Disable the layers in such situations. Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +- drivers/gpu/drm/mediatek/mtk_ethdr.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index 10d23e76acaa..8789442c039f 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -156,7 +156,7 @@ void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int idx, merge = ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_MERGE0 + idx]; ethdr = ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]; - if (!pending->enable) { + if (!pending->enable || !pending->width || !pending->height) { mtk_merge_stop_cmdq(merge, cmdq_pkt); mtk_mdp_rdma_stop(rdma_l, cmdq_pkt); mtk_mdp_rdma_stop(rdma_r, cmdq_pkt); diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c index 73c9e3da56a7..e95331c06815 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c @@ -163,7 +163,12 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, if (idx >= 4) return; - if (!pending->enable) { + if (!pending->enable || !pending->width || !pending->height) { + /* + * instead of disabling layer with MIX_SRC_CON directly + * set the size to 0 to avoid screen shift due to mixer + * mode switch (hardware behavior) + */ mtk_ddp_write(cmdq_pkt, 0, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_SIZE(idx)); return; } -- 2.18.0