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

drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property

Always add DRM_MODE_ROTATE_0 to rotation property to meet
IGT's (Intel GPU Tools) requirement.

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-8-a9d62d2e2c7e@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

authored by

Hsiao Chien Sung and committed by
Chun-Kuang Hu
74608d8f 6fb7a098

+11 -14
+5 -1
drivers/gpu/drm/mediatek/mtk_ddp_comp.h
··· 192 192 if (comp->funcs && comp->funcs->supported_rotations) 193 193 return comp->funcs->supported_rotations(comp->dev); 194 194 195 - return 0; 195 + /* 196 + * In order to pass IGT tests, DRM_MODE_ROTATE_0 is required when 197 + * rotation is not supported. 198 + */ 199 + return DRM_MODE_ROTATE_0; 196 200 } 197 201 198 202 static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp)
+5 -12
drivers/gpu/drm/mediatek/mtk_disp_ovl.c
··· 305 305 struct mtk_plane_state *mtk_state) 306 306 { 307 307 struct drm_plane_state *state = &mtk_state->base; 308 - unsigned int rotation = 0; 309 308 310 - rotation = drm_rotation_simplify(state->rotation, 311 - DRM_MODE_ROTATE_0 | 312 - DRM_MODE_REFLECT_X | 313 - DRM_MODE_REFLECT_Y); 314 - rotation &= ~DRM_MODE_ROTATE_0; 315 - 316 - /* We can only do reflection, not rotation */ 317 - if ((rotation & DRM_MODE_ROTATE_MASK) != 0) 309 + /* check if any unsupported rotation is set */ 310 + if (state->rotation & ~mtk_ovl_supported_rotations(dev)) 318 311 return -EINVAL; 319 312 320 313 /* 321 314 * TODO: Rotating/reflecting YUV buffers is not supported at this time. 322 315 * Only RGB[AX] variants are supported. 316 + * Since DRM_MODE_ROTATE_0 means "no rotation", we should not 317 + * reject layers with this property. 323 318 */ 324 - if (state->fb->format->is_yuv && rotation != 0) 319 + if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0)) 325 320 return -EINVAL; 326 - 327 - state->rotation = rotation; 328 321 329 322 return 0; 330 323 }
+1 -1
drivers/gpu/drm/mediatek/mtk_plane.c
··· 338 338 return err; 339 339 } 340 340 341 - if (supported_rotations & ~DRM_MODE_ROTATE_0) { 341 + if (supported_rotations) { 342 342 err = drm_plane_create_rotation_property(plane, 343 343 DRM_MODE_ROTATE_0, 344 344 supported_rotations);