[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ceb353983d48c5a0a967de7ea256dbe6a5de6bed.camel@mediatek.com>
Date: Wed, 29 Mar 2023 08:15:22 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
Nancy Lin (林欣螢) <Nancy.Lin@...iatek.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>
CC: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Shawn Sung (宋孝謙)
<Shawn.Sung@...iatek.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
Singo Chang (張興國)
<Singo.Chang@...iatek.com>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2] drm/mediatek: Add ovl_adaptor get format function
Hi, Nancy:
On Wed, 2023-03-29 at 09:59 +0800, Nancy.Lin wrote:
> Add ovl_adaptor get_format and get_num_formats component function.
> The two functions are need for getting the supported format in
> mtk_plane_init().
>
> Signed-off-by: Nancy.Lin <nancy.lin@...iatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 ++
> .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 24
> +++++++++++++++++++
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 ++
> 3 files changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> index 0d28b2e2069c..da2de17b84e9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> @@ -124,6 +124,8 @@ void mtk_ovl_adaptor_start(struct device *dev);
> void mtk_ovl_adaptor_stop(struct device *dev);
> unsigned int mtk_ovl_adaptor_layer_nr(struct device *dev);
> struct device *mtk_ovl_adaptor_dma_dev_get(struct device *dev);
> +const u32 *mtk_ovl_adaptor_get_formats(struct device *dev);
> +size_t mtk_ovl_adaptor_get_num_formats(struct device *dev);
>
> void mtk_rdma_bypass_shadow(struct device *dev);
> int mtk_rdma_clk_enable(struct device *dev);
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> index 046217828ab3..b5d28c392c57 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> @@ -25,6 +25,20 @@
> #define MTK_OVL_ADAPTOR_RDMA_MAX_WIDTH 1920
> #define MTK_OVL_ADAPTOR_LAYER_NUM 4
>
> +static const u32 formats[] = {
> + DRM_FORMAT_XRGB8888,
> + DRM_FORMAT_ARGB8888,
> + DRM_FORMAT_BGRX8888,
> + DRM_FORMAT_BGRA8888,
> + DRM_FORMAT_ABGR8888,
> + DRM_FORMAT_XBGR8888,
> + DRM_FORMAT_RGB888,
> + DRM_FORMAT_BGR888,
> + DRM_FORMAT_RGB565,
> + DRM_FORMAT_UYVY,
> + DRM_FORMAT_YUYV,
> +};
> +
> enum mtk_ovl_adaptor_comp_type {
> OVL_ADAPTOR_TYPE_RDMA = 0,
> OVL_ADAPTOR_TYPE_MERGE,
> @@ -297,6 +311,16 @@ void mtk_ovl_adaptor_disable_vblank(struct
> device *dev)
> mtk_ethdr_disable_vblank(ovl_adaptor-
> >ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]);
> }
>
> +const u32 *mtk_ovl_adaptor_get_formats(struct device *dev)
> +{
> + return formats;
The supported formats depend on the mdp-rdma hardware capability, so
get formats from mdp-rdma driver.
Regards,
CK
> +}
> +
> +size_t mtk_ovl_adaptor_get_num_formats(struct device *dev)
> +{
> + return ARRAY_SIZE(formats);
> +}
> +
> void mtk_ovl_adaptor_add_comp(struct device *dev, struct mtk_mutex
> *mutex)
> {
> mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA0);
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 1a0c4f7e352a..f114da4d36a9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -410,6 +410,8 @@ static const struct mtk_ddp_comp_funcs
> ddp_ovl_adaptor = {
> .disconnect = mtk_ovl_adaptor_disconnect,
> .add = mtk_ovl_adaptor_add_comp,
> .remove = mtk_ovl_adaptor_remove_comp,
> + .get_formats = mtk_ovl_adaptor_get_formats,
> + .get_num_formats = mtk_ovl_adaptor_get_num_formats,
> };
>
> static const char * const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX] =
> {
Powered by blists - more mailing lists