Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp356911rdb; Thu, 15 Feb 2024 02:12:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXEPyJNd5JoEOeqzFushknh+D55o197sTpZXhyH+YUiorLXq0i6UjlKfzFwNy+a8JMw9REAIHyp8TQ0wDOFKjz/uGXH9qXJrLKH/4N81Q== X-Google-Smtp-Source: AGHT+IE0XG+H2HInyJTOh5LJYL+OTdWG4I+qAKmj5f9SfenqJYzV669eoFfXtdk3keTY0s7Zzmul X-Received: by 2002:a0c:9c01:0:b0:68c:45b8:4efd with SMTP id v1-20020a0c9c01000000b0068c45b84efdmr1325547qve.6.1707991963433; Thu, 15 Feb 2024 02:12:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707991963; cv=pass; d=google.com; s=arc-20160816; b=aJ1+XfeFaLvM/qJuQ2IIH+DfTV+l55ifcejX5CGvg3PXCX4ecDMgCCeh0AiUP7X1AC RgaPxM0Ff+eoqrYjOGcvfjHoxl/r2YDIKr1NBx0nFp2zNv/KzlUjm9zdP4dP+jQwyX2o Gnvr+aUCrkWbTBQpWN4NboUcWVqjraotw6e6+vBWPubFnyiovs2nulhx3mMkqyA4dRF3 kVMsAo9Guvj5uPW/x0ZnDI6/qHNtfRvTyiw54pOfNJn6oOJzvCoSbY2WXn1P6NAywV3I eRl0zcsAmWv5CwJs8DC2i0K73ZwCadfEDpT+4ZaKoNUbwUaQyaEeiCAsYCkyFKs7TFqd cQCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7s1oTV14wUXmLQ2Hzo35A2BBQL2juVHpTagPf8ZfOXQ=; fh=PWpMUFySz/+abNBcZMGAF+1x8Vi76p56GtPU1dgQSG4=; b=BkmTQddD1NsxQmzztTLu7GPcmqZcDml8OTmHqyFTmYmnc46ABVdgr5xbFwtzzWTaM3 vTKQOLIkwIPz4mu4c2OLcdgSTopCJS14RI4wAsYdVvM6dnL1H0iv3cYZYXPLwBH7wNoA xEifcuiC+pt1lxsed9f5n/3ua7BrNMgudQgiKzCXT60TsJyPGeoILCAc/msz5QhpKoWC gu7qJLe+5ZSklPDhh9i78q8ZtE4gVIROx63T1DUy0FtCvdS7KkNoPnrjaMyxZO9MwiBR oyx5NTSHFgclQ6joiX786kdjDWbeJNmWNW37IwH+HNs9HBKxlHvemZqDk9VpMHpny5zH NrxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kt8UGFQe; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-66601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o8-20020a0562140e4800b0068c6deb6160si1066248qvc.70.2024.02.15.02.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:12:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kt8UGFQe; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-66601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id ECED01C21F56 for ; Thu, 15 Feb 2024 10:12:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0348B6A8C4; Thu, 15 Feb 2024 10:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="kt8UGFQe" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFDF069D18 for ; Thu, 15 Feb 2024 10:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707991891; cv=none; b=P6BzN3snUYLhuf6GdSKgRAddv6qGJVcOLAKFTMIg8DbEjiCE4SBJOkUJKWr4UfTqt9C9KRwPwoctdepjvxheObY79Pdc7YYWJUhQKGMa+LD0nAkqRJ0CsHUsLHdE3vYfmT784Oh1B+ICDBE8iMD6sOGNWjAfIGNvn6eDZE/mvpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707991891; c=relaxed/simple; bh=N8TiFFxxmTMa2QT5avLlhWkJIAIwN1BDdxEy63NKX2g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gpfbCDS4uVLTIDr2yz2ya7VJiO65BqhwXd03Z6k91OKoTRfdmvpMkeoV9Fupqx0Z9jks8A8KKlE8VatceIo/qQln5Og9awklbwiqF8I5ZaXneXdcP/PkhVvgduYjIiah09CL6x7mq+ahrrXxaK+042aEQGLHdNuFxupl1lt2A+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=kt8UGFQe; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 927958eacbea11eea2298b7352fd921d-20240215 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=7s1oTV14wUXmLQ2Hzo35A2BBQL2juVHpTagPf8ZfOXQ=; b=kt8UGFQeyfzyoG0A2ceRPCKAF7/tz60QMJcpFLxm+eUnyyRYCyrnS6fx9uE5jBuQR2zpfid5lbwa6+BA255fyvvEx+7TdSL8qSmtzHKBGXLVVKJJ7osz5snpL8TgCNI8moCrLmjB1fxTmlEwh7xzzUdfwxXDvFptyA/YUadNx28=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:e9e63957-d945-449b-9aef-ac563c64b069,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:6f543d0,CLOUDID:dc5cd0fe-c16b-4159-a099-3b9d0558e447,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT: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: 927958eacbea11eea2298b7352fd921d-20240215 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1699541002; Thu, 15 Feb 2024 18:11:23 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 15 Feb 2024 18:11:22 +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; Thu, 15 Feb 2024 18:11:22 +0800 From: Hsiao Chien Sung To: AngeloGioacchino Del Regno , Chun-Kuang Hu CC: Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , Bibby Hsieh , CK Hu , Sean Paul , Fei Shao , Jason Chen , "Nancy . Lin" , , , , , Hsiao Chien Sung Subject: [PATCH v5 06/13] drm/mediatek: Turn off the layers with zero width or height Date: Thu, 15 Feb 2024 18:11:12 +0800 Message-ID: <20240215101119.12629-7-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240215101119.12629-1-shawn.sung@mediatek.com> References: <20240215101119.12629-1-shawn.sung@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N 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 a situation. Fixes: 777b7bc86a0a3 ("drm/mediatek: Add ovl_adaptor support for MT8195") Fixes: fa97fe71f6f93 ("drm/mediatek: Add ETHDR support for MT8195") 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 d4a13a1402148..68a20312ac6f1 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -157,7 +157,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 73dc4da3ba3bd..69872b77922eb 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c @@ -160,7 +160,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