Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: Set sensible cursor width/height values to fix crash
@ 2024-07-18  8:24 AngeloGioacchino Del Regno
  2024-07-18  8:49 ` Chen-Yu Tsai
  0 siblings, 1 reply; 9+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-07-18  8:24 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, daniel, matthias.bgg, angelogioacchino.delregno,
	shawn.sung, ck.hu, dri-devel, linux-mediatek, linux-kernel,
	linux-arm-kernel, kernel

Hardware-speaking, there is no feature-reduced cursor specific
plane, so this driver reserves the last all Overlay plane as a
Cursor plane, but sets the maximum cursor width/height to the
maximum value that the full overlay plane can use.

While this could be ok, it raises issues with common userspace
using libdrm (especially Mutter, but other compositors too) which
will crash upon performing allocations and/or using said cursor
plane.

Reduce the maximum width/height for the cursor to 512x512 pixels,
value taken from IGT's maximum cursor size test, which succeeds.

Fixes: a4c9410b31ca ("drm/mediatek: Set DRM mode configs accordingly")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 6f0b415a978d..b96763664c4f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -540,8 +540,8 @@ 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;
+	drm->mode_config.cursor_width = 512;
+	drm->mode_config.cursor_height = 512;
 
 	/* Use OVL device for all DMA memory allocations */
 	crtc = drm_crtc_from_index(drm, 0);
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-07-19  9:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-18  8:24 [PATCH] drm/mediatek: Set sensible cursor width/height values to fix crash AngeloGioacchino Del Regno
2024-07-18  8:49 ` Chen-Yu Tsai
2024-07-18  9:18   ` Shawn Sung (宋孝謙)
2024-07-18  9:27   ` Fei Shao
2024-07-18 10:24     ` AngeloGioacchino Del Regno
2024-07-18 11:10       ` Daniel Stone
2024-07-18 11:23         ` AngeloGioacchino Del Regno
2024-07-19  8:42           ` CK Hu (胡俊光)
2024-07-19  9:20             ` AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox