Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp356697rdb; Thu, 15 Feb 2024 02:12:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9ta60cr3lGTbhb0/2JFJpbcIEcBVQxiwySG2s7VnVeaBTAOTMOurxQ6T37cgROilaIdTJ3mp+55YlPobeURsS+ia5TC9C3ReMC9E3XQ== X-Google-Smtp-Source: AGHT+IEA5k/tV5OV5maHCsKbYfL5YtBiiTqGsGHTjpkTUTU/1/+nJ6AoD+zFXECUYdy79U29usJM X-Received: by 2002:a05:622a:3cb:b0:42d:bf4f:8453 with SMTP id k11-20020a05622a03cb00b0042dbf4f8453mr1603056qtx.58.1707991927653; Thu, 15 Feb 2024 02:12:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707991927; cv=pass; d=google.com; s=arc-20160816; b=eDYagfdWmMJRL5X39/zORVFuigUsTJFrhbMwsrTFW+TPnKAGmYbH7OFV+emCSKea4Y VVyR70LgBhEDHhpddV4KWNcOmclGBV2of3VAJorgu2SIYebFxrWJnJWykwVGIincWJQo 45UELclBxyejyWlrbYGxS2E73NtJcXJpyZSfq+rKcm5bO/mlTJUC2MWJUloKeJ8cbaKO 0hAesJcJI369GhFAqxTm5o2WJHQ6ndvax6e2SjcelmciggebKFDYqVrnAKx/pR7MAlZM +FjkAbX1guBEEypo5ybXzyML5jCG07VQ0xGOXoxTZMndsqN/1n4K9hha/3lEcwY1MiTK 2gTQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66598-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 q7-20020a05620a0c8700b007854460daaasi1076486qki.729.2024.02.15.02.12.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:12:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66598-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=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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66598-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 5AD5A1C21D8A for ; Thu, 15 Feb 2024 10:12:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B32E69DED; Thu, 15 Feb 2024 10:11:31 +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 Content-Type: text/plain X-MTK: N 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 { -- 2.18.0