diff mbox series

drm/mediatek: Add ovl_adaptor get format function

Message ID 20230328025126.30341-1-nancy.lin@mediatek.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Add ovl_adaptor get format function | expand

Commit Message

Nancy Lin (林欣螢) March 28, 2023, 2:51 a.m. UTC
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@mediatek.com>
Change-Id: Ia8e9f6cabcc71b262155a022b103ae81d1616b8f
---
 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(+)

Comments

AngeloGioacchino Del Regno March 28, 2023, 3:28 p.m. UTC | #1
Il 28/03/23 04:51, Nancy.Lin ha scritto:
> 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@mediatek.com>
> Change-Id: Ia8e9f6cabcc71b262155a022b103ae81d1616b8f

The code looks good to me, but please drop that Change-Id tag (which has no
meaning upstream) and resend.

Thanks,
Angelo
Nancy Lin (林欣螢) March 29, 2023, 1:52 a.m. UTC | #2
Hi Angelo,

On Tue, 2023-03-28 at 17:28 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 28/03/23 04:51, Nancy.Lin ha scritto:
> > 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@mediatek.com>
> > Change-Id: Ia8e9f6cabcc71b262155a022b103ae81d1616b8f
> 
> The code looks good to me, but please drop that Change-Id tag (which
> has no
> meaning upstream) and resend.
> 
> Thanks,
> Angelo
> 
Sorry, I forgot remove change-id, will resend soon.

Regards,
Nancy
diff mbox series

Patch

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;
+}
+
+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] = {