[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c6780d849b205fc84969463240cf1cdf74bd80d.camel@mediatek.com>
Date: Mon, 18 Nov 2024 07:00:02 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: Jason-JH Lin (林睿祥) <Jason-JH.Lin@...iatek.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>
CC: "linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
Singo Chang (張興國) <Singo.Chang@...iatek.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Shawn Sung (宋孝謙) <Shawn.Sung@...iatek.com>,
Nancy Lin (林欣螢) <Nancy.Lin@...iatek.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "fshao@...omium.org"
<fshao@...omium.org>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
Subject: Re: [PATCH] drm/mediatek: Add support for 180-degree rotation in the
display driver
Hi, Jason:
On Mon, 2024-11-18 at 10:51 +0800, Jason-JH.Lin wrote:
> mediatek-drm driver reported the capability of 180-degree rotation by
> adding `DRM_MODE_ROTATE_180` to the plane property, as flip-x combined
> with flip-y equals a 180-degree rotation. However, we did not handle
> the rotation property in the driver and lead to rotation issues.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Fixes: 74608d8feefd ("drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property")
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@...iatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index e0c0bb01f65a..cc825c4f2e09 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -472,6 +472,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
> unsigned int hdr_pitch = pending->hdr_pitch;
> unsigned int fmt = pending->format;
> unsigned int offset = (pending->y << 16) | pending->x;
> + unsigned int rotation = pending->rotation;
> unsigned int src_size = (pending->height << 16) | pending->width;
> unsigned int blend_mode = state->base.pixel_blend_mode;
> unsigned int ignore_pixel_alpha = 0;
> @@ -513,12 +514,19 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
> ignore_pixel_alpha = OVL_CONST_BLEND;
> }
>
> - if (pending->rotation & DRM_MODE_REFLECT_Y) {
> + /*
> + * Treat rotate 180 as flip x + flip y, and XOR the original rotation value
> + * to flip x + flip y to support both in the same time.
> + */
> + if (rotation & DRM_MODE_ROTATE_180)
> + rotation ^= DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
> +
> + if (rotation & DRM_MODE_REFLECT_Y) {
> con |= OVL_CON_VIRT_FLIP;
> addr += (pending->height - 1) * pending->pitch;
> }
>
> - if (pending->rotation & DRM_MODE_REFLECT_X) {
> + if (rotation & DRM_MODE_REFLECT_X) {
> con |= OVL_CON_HORZ_FLIP;
> addr += pending->pitch - 1;
> }
Powered by blists - more mailing lists