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: 119f517362 ("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>
This commit is contained in:
Hsiao Chien Sung 2024-06-20 00:38:48 +08:00 committed by Chun-Kuang Hu
parent 6fb7a0985f
commit 74608d8fee
3 changed files with 11 additions and 14 deletions

View File

@ -192,7 +192,11 @@ unsigned int mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp)
if (comp->funcs && comp->funcs->supported_rotations) if (comp->funcs && comp->funcs->supported_rotations)
return comp->funcs->supported_rotations(comp->dev); return comp->funcs->supported_rotations(comp->dev);
return 0; /*
* In order to pass IGT tests, DRM_MODE_ROTATE_0 is required when
* rotation is not supported.
*/
return DRM_MODE_ROTATE_0;
} }
static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp) static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp)

View File

@ -305,27 +305,20 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
struct mtk_plane_state *mtk_state) struct mtk_plane_state *mtk_state)
{ {
struct drm_plane_state *state = &mtk_state->base; struct drm_plane_state *state = &mtk_state->base;
unsigned int rotation = 0;
rotation = drm_rotation_simplify(state->rotation, /* check if any unsupported rotation is set */
DRM_MODE_ROTATE_0 | if (state->rotation & ~mtk_ovl_supported_rotations(dev))
DRM_MODE_REFLECT_X |
DRM_MODE_REFLECT_Y);
rotation &= ~DRM_MODE_ROTATE_0;
/* We can only do reflection, not rotation */
if ((rotation & DRM_MODE_ROTATE_MASK) != 0)
return -EINVAL; return -EINVAL;
/* /*
* TODO: Rotating/reflecting YUV buffers is not supported at this time. * TODO: Rotating/reflecting YUV buffers is not supported at this time.
* Only RGB[AX] variants are supported. * Only RGB[AX] variants are supported.
* Since DRM_MODE_ROTATE_0 means "no rotation", we should not
* reject layers with this property.
*/ */
if (state->fb->format->is_yuv && rotation != 0) if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0))
return -EINVAL; return -EINVAL;
state->rotation = rotation;
return 0; return 0;
} }

View File

@ -338,7 +338,7 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
return err; return err;
} }
if (supported_rotations & ~DRM_MODE_ROTATE_0) { if (supported_rotations) {
err = drm_plane_create_rotation_property(plane, err = drm_plane_create_rotation_property(plane,
DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0,
supported_rotations); supported_rotations);