Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/mediatek: Set DRM mode configs accordingly

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.

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240620-igt-v3-10-a9d62d2e2c7e@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

authored by

Hsiao Chien Sung and committed by
Chun-Kuang Hu
a4c9410b 9f428b95

+26
+22
drivers/gpu/drm/mediatek/mtk_drm_drv.c
··· 294 294 .conn_routes = mt8188_mtk_ddp_main_routes, 295 295 .num_conn_routes = ARRAY_SIZE(mt8188_mtk_ddp_main_routes), 296 296 .mmsys_dev_num = 2, 297 + .max_width = 8191, 298 + .min_width = 1, 299 + .min_height = 1, 297 300 }; 298 301 299 302 static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = { ··· 311 308 .main_path = mt8195_mtk_ddp_main, 312 309 .main_len = ARRAY_SIZE(mt8195_mtk_ddp_main), 313 310 .mmsys_dev_num = 2, 311 + .max_width = 8191, 312 + .min_width = 1, 313 + .min_height = 1, 314 314 }; 315 315 316 316 static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = { ··· 321 315 .ext_len = ARRAY_SIZE(mt8195_mtk_ddp_ext), 322 316 .mmsys_id = 1, 323 317 .mmsys_dev_num = 2, 318 + .max_width = 8191, 319 + .min_width = 2, /* 2-pixel align when ethdr is bypassed */ 320 + .min_height = 1, 324 321 }; 325 322 326 323 static const struct of_device_id mtk_drm_of_ids[] = { ··· 502 493 for (j = 0; j < private->data->mmsys_dev_num; j++) { 503 494 priv_n = private->all_drm_private[j]; 504 495 496 + if (priv_n->data->max_width) 497 + drm->mode_config.max_width = priv_n->data->max_width; 498 + 499 + if (priv_n->data->min_width) 500 + drm->mode_config.min_width = priv_n->data->min_width; 501 + 502 + if (priv_n->data->min_height) 503 + drm->mode_config.min_height = priv_n->data->min_height; 504 + 505 505 if (i == CRTC_MAIN && priv_n->data->main_len) { 506 506 ret = mtk_crtc_create(drm, priv_n->data->main_path, 507 507 priv_n->data->main_len, j, ··· 537 519 } 538 520 } 539 521 } 522 + 523 + /* IGT will check if the cursor size is configured */ 524 + drm->mode_config.cursor_width = drm->mode_config.max_width; 525 + drm->mode_config.cursor_height = drm->mode_config.max_height; 540 526 541 527 /* Use OVL device for all DMA memory allocations */ 542 528 crtc = drm_crtc_from_index(drm, 0);
+4
drivers/gpu/drm/mediatek/mtk_drm_drv.h
··· 46 46 bool shadow_register; 47 47 unsigned int mmsys_id; 48 48 unsigned int mmsys_dev_num; 49 + 50 + u16 max_width; 51 + u16 min_width; 52 + u16 min_height; 49 53 }; 50 54 51 55 struct mtk_drm_private {