[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5b00d343b922e726476e4b3c1973d44a05aacb3.camel@mediatek.com>
Date: Fri, 22 Mar 2024 09:02:58 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: Shawn Sung (宋孝謙) <Shawn.Sung@...iatek.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>
CC: "linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Bibby Hsieh (謝濟遠) <Bibby.Hsieh@...iatek.com>,
"jason-ch.chen@...iatek.corp-partner.google.com"
<jason-ch.chen@...iatek.corp-partner.google.com>,
Nancy Lin (林欣螢) <Nancy.Lin@...iatek.com>,
"daniel@...ll.ch" <daniel@...ll.ch>, "p.zabel@...gutronix.de"
<p.zabel@...gutronix.de>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, "airlied@...il.com" <airlied@...il.com>,
"sean@...rly.run" <sean@...rly.run>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "fshao@...omium.org" <fshao@...omium.org>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v6 04/14] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation
property
Hi, Shawn:
On Fri, 2024-03-22 at 13:28 +0800, Shawn Sung wrote:
> From: Hsiao Chien Sung <shawn.sung@...iatek.com>
>
> Always add DRM_MODE_ROTATE_0 to rotation property to meet
> IGT's (Intel GPU Tools) requirement.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@...iatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 6 +++++-
> drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 21 +++++++++------------
> drivers/gpu/drm/mediatek/mtk_plane.c | 2 +-
> 3 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
> b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
> index 26236691ce4c2..f7fe2e08dc8e2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
> +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
> @@ -192,7 +192,11 @@ unsigned int
> mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp)
> if (comp->funcs && comp->funcs->supported_rotations)
> 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)
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 0ebeaf9830d83..2a767a823c83a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -288,6 +288,10 @@ unsigned int mtk_ovl_layer_nr(struct device
> *dev)
>
> unsigned int mtk_ovl_supported_rotations(struct device *dev)
> {
> + /*
> + * although currently OVL can only do reflection,
> + * reflect x + reflect y = rotate 180
> + */
> return DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 |
> DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
> }
> @@ -296,27 +300,20 @@ int mtk_ovl_layer_check(struct device *dev,
> unsigned int idx,
> struct mtk_plane_state *mtk_state)
> {
> struct drm_plane_state *state = &mtk_state->base;
> - unsigned int rotation = 0;
>
> - rotation = drm_rotation_simplify(state->rotation,
> - DRM_MODE_ROTATE_0 |
> - 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)
> + /* check if any unsupported rotation is set */
> + if (state->rotation & ~mtk_ovl_supported_rotations(dev))
> return -EINVAL;
>
> /*
> * TODO: Rotating/reflecting YUV buffers is not supported at
> this time.
> * 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;
>
> - state->rotation = rotation;
> -
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c
> b/drivers/gpu/drm/mediatek/mtk_plane.c
> index a74b26d359857..1723d4333f371 100644
> --- a/drivers/gpu/drm/mediatek/mtk_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_plane.c
> @@ -338,7 +338,7 @@ int mtk_plane_init(struct drm_device *dev, struct
> drm_plane *plane,
> return err;
> }
>
> - if (supported_rotations & ~DRM_MODE_ROTATE_0) {
> + if (supported_rotations) {
> err = drm_plane_create_rotation_property(plane,
> DRM_MODE_ROTAT
> E_0,
> supported_rota
> tions);
Powered by blists - more mailing lists