From patchwork Thu Feb 15 10:11:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?U2hhd24gU3VuZyAo5a6L5a2d6KyZKQ==?= X-Patchwork-Id: 201369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp311923dyb; Thu, 15 Feb 2024 02:56:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9VIRPe7pzTA/Dp5yR0PCjy6ux3dLtki7NWnD8So97G3qOfBPMj931sG4io5TB2KxoeBFpFzAD4ilzlxHoAxnG6a4l5g== X-Google-Smtp-Source: AGHT+IF99IbHJqUqVqKuhss2O0VW1KAVpRYoW8Rqllk3z/0iNNXllM2v2Z0V1Mb46cslXPQ5A41r X-Received: by 2002:a17:902:e751:b0:1db:3d36:507b with SMTP id p17-20020a170902e75100b001db3d36507bmr1599047plf.44.1707994595495; Thu, 15 Feb 2024 02:56:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707994595; cv=pass; d=google.com; s=arc-20160816; b=lBr3SJ5DntegQ5liHDLeZdf5u1NWBqNGfJuVbuNNmb6BbQu1gd89KU4dDfBBtBQr6X eXPaNw+8vmb23QiTC00p13f+VsUK+vfKZKiwzihprvdKlrhbTq6hTLopahedPDpwY4T3 /NZzHSydm2tvPCsOzsrRmXTAttvyoHul5iTPScjB8K92DHNyCeATb+E7UdfIhKjDnTsU OdRtLgT6GX46a2Dwx0/FcmsEJm+x2byqcnqGeUNk52B+Aulc6shGNTvbjDnFvo/Qw2q2 v4WzmXzRiKgxJBgr5/nM8qBeb7Rn7GoZWCMrOI6TOGBQFyHV4lMbLmmWHGd81AJgUUhf TfJQ== 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=I7cVLoCIGZryICIea5pm/7QKmeb5VjO8IC3m/+bitNs=; fh=PWpMUFySz/+abNBcZMGAF+1x8Vi76p56GtPU1dgQSG4=; b=pLTUvbQBhDzCxIb1JO9siZjRQgo7zAi7ztWg5DjbOwofVkYUcpRAF/j5NlX+E++Ghm MAtyrs9pdkf3Q5Q/vokN8cHDWTvjwYyfvwPEnyFF/HLZK6/b6rrHBjyeewHTnO6vICoh AkbQoRoRFIjSVPm49R7M0WdX5ajGVLGFL97Wr0cvRsMl7BKK0RcwomoQJiDWu+T94pGT OZ1jkTkl3qMsSwxiZIGQNgjBT5o6EWaDk98BKcO0FVr9jXpO7aoSy7ROQ4yJl4Y0hSyC 4UC6WAbGaaQMjFfs/8LYFyyqXv2rzzJixPamtLWzws1RStGkWOXLtuvvFRUeI6h6ltE1 jp8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HfCkjZMK; 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-66598-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66598-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q15-20020a170902a3cf00b001d9167b8e73si915583plb.444.2024.02.15.02.56.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:56:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66598-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HfCkjZMK; 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-66598-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66598-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 90FA1B2944E for ; Thu, 15 Feb 2024 10:13:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34DF0692E1; Thu, 15 Feb 2024 10:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="HfCkjZMK" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 79D4069D15 for ; Thu, 15 Feb 2024 10:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707991890; cv=none; b=ThSIfGcd06JJUGwRHgb+AYIclnPOc/mafEf7makqAuLWv+dB8n6ZrFN7N1ECNAkUYzeBhVgO0Q+1d7CMnepMp+MslydHpkSCtNrKbdOL9TfV+sITXOnoJrbjJf+MFM8m14qG7Nh2IXqjpGQWBkjc50mOqwbNbK+v9qJPCQZ9PTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707991890; c=relaxed/simple; bh=nYHaw5D9WmG8C8Cz3Ishfu6NfRhmSaS2MeGvKztBFFw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LPM+dEkncS9UgX8r1THyKT0P+P7KZ2luJfZZ4Ce33NMTZCBkVxoDpkgx5ljmBXscd5RurkJWpofX6FqHIvYvSZPkBNy/sVqTuZuXYH5hE4NWILKIzIhL2eS0FuReEizUvo/oPfxgCekOcSeMaFk0VUq3vGi5+7adgjzgvmzkLWE= 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=HfCkjZMK; arc=none smtp.client-ip=60.244.123.138 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: 926ba2eacbea11ee9e680517dc993faa-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=I7cVLoCIGZryICIea5pm/7QKmeb5VjO8IC3m/+bitNs=; b=HfCkjZMKowEJpK2M1UfpntfUFYGudRXQgSHxLnWFDCIA5Ua0Q0QzDoD1V4Em3Vmh1LalJFbg8lULirKRkXBylQH8ijnQG0ax4eug1ZCC2kBQHq9bhQTqPlRYKxOX3stmUNvG4hck6TdLx9oh0jrmCBOrkfiSCDRmmfIwoK6usEA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:52af26f8-60b6-4890-99e9-613b75677204,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6f543d0,CLOUDID:65636b80-4f93-4875-95e7-8c66ea833d57,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: 926ba2eacbea11ee9e680517dc993faa-20240215 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1655895590; Thu, 15 Feb 2024 18:11:23 +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; 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 05/13] drm/mediatek: Set DRM mode configs accordingly Date: Thu, 15 Feb 2024 18:11:11 +0800 Message-ID: <20240215101119.12629-6-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 X-MTK: N X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790962141248106288 X-GMAIL-MSGID: 1790962141248106288 Set DRM mode configs limitation according to the hardware capabilities and pass the IGT checks as below: - The test "graphics.IgtKms.kms_plane" requires a frame buffer with width of 4512 pixels (> 4096). - The test "graphics.IgtKms.kms_cursor_crc" checks if the cursor size is defined, and run the test with cursor size from 1x1 to 512x512. Please notice that the test conditions may change as IGT is updated. Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 25 +++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_drv.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 890e1e93a2227..8cf157ec66ba6 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -296,6 +296,9 @@ static const struct mtk_mmsys_driver_data mt8188_vdosys0_driver_data = { .conn_routes = mt8188_mtk_ddp_main_routes, .num_conn_routes = ARRAY_SIZE(mt8188_mtk_ddp_main_routes), .mmsys_dev_num = 2, + .max_pitch = GENMASK(15, 0), + .min_width = 1, + .min_height = 1, }; static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = { @@ -310,6 +313,9 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = { .main_path = mt8195_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8195_mtk_ddp_main), .mmsys_dev_num = 2, + .max_pitch = GENMASK(15, 0), + .min_width = 1, + .min_height = 1, }; static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = { @@ -317,6 +323,9 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = { .ext_len = ARRAY_SIZE(mt8195_mtk_ddp_ext), .mmsys_id = 1, .mmsys_dev_num = 2, + .max_pitch = GENMASK(15, 0), + .min_width = 2, /* 2-pixel align when ethdr is bypassed */ + .min_height = 1, }; static const struct of_device_id mtk_drm_of_ids[] = { @@ -495,6 +504,18 @@ static int mtk_drm_kms_init(struct drm_device *drm) for (j = 0; j < private->data->mmsys_dev_num; j++) { priv_n = private->all_drm_private[j]; + if (priv_n->data->max_pitch) { + /* Save 4 bytes for the color depth (pitch = width * bpp) */ + drm->mode_config.max_width = priv_n->data->max_pitch >> 2; + drm->mode_config.max_height = priv_n->data->max_pitch >> 2; + } + + if (priv_n->data->min_width) + drm->mode_config.min_width = priv_n->data->min_width; + + if (priv_n->data->min_height) + drm->mode_config.min_height = priv_n->data->min_height; + if (i == CRTC_MAIN && priv_n->data->main_len) { ret = mtk_drm_crtc_create(drm, priv_n->data->main_path, priv_n->data->main_len, j, @@ -522,6 +543,10 @@ static int mtk_drm_kms_init(struct drm_device *drm) } } + /* IGT will check if the cursor size is configured */ + drm->mode_config.cursor_width = drm->mode_config.max_width; + drm->mode_config.cursor_height = drm->mode_config.max_height; + /* Use OVL device for all DMA memory allocations */ crtc = drm_crtc_from_index(drm, 0); if (crtc) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index 33fadb08dc1c7..414764b4546ba 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -46,6 +46,9 @@ struct mtk_mmsys_driver_data { bool shadow_register; unsigned int mmsys_id; unsigned int mmsys_dev_num; + + u32 max_pitch; + int min_width, min_height; }; struct mtk_drm_private {