Hi, Paul: On Fri, 2025-01-10 at 20:34 +0800,paul-pl.chen wrote: > > > From: "Nancy.Lin" <nancy.lin@xxxxxxxxxxxx> > > > > > > EXDMA is a DMA engine for reading data from DRAM with > > > various DRAM footprints and data formats. For input > > > sources in certain color formats and color domains, > > > EXDMA also includes a color transfer function to > > > process pixels into a consistent color domain. > > > > > > Signed-off-by: Nancy.Lin <nancy.lin@xxxxxxxxxxxx> > > > Signed-off-by: Paul-pl.Chen <paul-pl.chen@xxxxxxxxxxxx> > > > --- > > > > [snip] > > > > > +#define DISP_REG_OVL_L0_CLRFMT 0x050 > > > +#define OVL_CON_FLD_CLRFMT GENMASK(3, 0) > > > +#define OVL_CON_CLRFMT_MAN BIT(4) > > > +#define OVL_CON_FLD_CLRFMT_NB GENMASK(9, 8) > > > +#define OVL_CON_CLRFMT_NB_10_BIT BIT(8) > > > +#define OVL_CON_BYTE_SWAP BIT(16) > > > +#define OVL_CON_RGB_SWAP BIT(17) > > > +#define OVL_CON_CLRFMT_RGB565 0x000 > > > +#define OVL_CON_CLRFMT_BGR888 0x001 > > > +#define OVL_CON_CLRFMT_BGRA8888 0x002 > > > +#define OVL_CON_CLRFMT_ABGRB8888 0x003 > > > +#define OVL_CON_CLRFMT_UYVY 0x004 > > > +#define OVL_CON_CLRFMT_YUYV 0x005 > > > +#define OVL_CON_CLRFMT_BGR565 (0x000 | OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_RGB888 (0x001 | OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_RGBA8888 (0x002 | OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_ARGB8888 (0x003 | OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_VYUY (0x004 | OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_YVYU (0x005 | OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_PBGRA8888 (0x003 | OVL_CON_CLRFMT_MAN) > > > +#define OVL_CON_CLRFMT_PARGB8888 (OVL_CON_CLRFMT_PBGRA8888 | \ > > > + OVL_CON_BYTE_SWAP) > > > +#define OVL_CON_CLRFMT_PRGBA8888 (OVL_CON_CLRFMT_PBGRA8888 | \ > > > + OVL_CON_RGB_SWAP) > > > +#define OVL_CON_CLRFMT_PABGR8888 (OVL_CON_CLRFMT_PBGRA8888 | \ > > > + OVL_CON_RGB_SWAP | \ > > > + OVL_CON_BYTE_SWAP) > > > > The color format definition is identical with ovl driver. Try to merge them. > > > > > +#define DISP_REG_OVL_RDMA0_CTRL 0x100 > > > +#define DISP_RDMA0_EN BIT(0) > > > +#define DISP_REG_OVL_RDMA_BURST_CON1 0x1f4 > > > +#define DISP_RDMA_BURST_CON1_BURST16_EN BIT(28) > > > +#define DISP_RDMA_BURST_CON1_DDR_EN BIT(30) > > > +#define DISP_RDMA_BURST_CON1_DDR_ACK_EN BIT(31) > > > +#define DISP_REG_OVL_DUMMY_REG 0x200 > > > +#define DISP_OVL_EXT_DDR_EN_OPT BIT(2) > > > +#define DISP_OVL_FORCE_EXT_DDR_EN BIT(3) > > > +#define DISP_REG_OVL_GDRDY_PRD 0x208 > > > > [snip] > > > > > + > > > +static const u32 formats[] = { > > > > This array is identical with mt8195_formats[], try to merge them. > > > > > + DRM_FORMAT_XRGB8888, > > > + DRM_FORMAT_ARGB8888, > > > + DRM_FORMAT_BGRX8888, > > > + DRM_FORMAT_BGRA8888, > > > + DRM_FORMAT_ABGR8888, > > > + DRM_FORMAT_XBGR8888, > > > + DRM_FORMAT_RGBX8888, > > > + DRM_FORMAT_RGBA8888, > > > + DRM_FORMAT_RGB888, > > > + DRM_FORMAT_BGR888, > > > + DRM_FORMAT_RGB565, > > > + DRM_FORMAT_UYVY, > > > + DRM_FORMAT_YUYV, > > > + DRM_FORMAT_XRGB2101010, > > > + DRM_FORMAT_ARGB2101010, > > > + DRM_FORMAT_RGBX1010102, > > > + DRM_FORMAT_RGBA1010102, > > > + DRM_FORMAT_XBGR2101010, > > > + DRM_FORMAT_ABGR2101010, > > > + DRM_FORMAT_BGRX1010102, > > > + DRM_FORMAT_BGRA1010102, > > > +}; > > > + > > > > [snip] > > > > > + > > > +static unsigned int mtk_disp_exdma_fmt_convert(unsigned int fmt, unsigned int blend_mode) > > > > This function is almost the same as mtk_ovl_fmt_convert(), try to merge them. > > > > Regards, > > CK > > > > > +{ > > > + /* > > > + * DRM_FORMAT: bit 32->0, OVL_FMT: bit 0->32, > > > + * so DRM_FORMAT_RGB888 = OVL_CON_CLRFMT_BGR888 > > > + */ > > > + switch (fmt) { > > > + default: > > > + case DRM_FORMAT_BGR565: > > > + return OVL_CON_CLRFMT_RGB565; > > > + case DRM_FORMAT_RGB565: > > > + return OVL_CON_CLRFMT_BGR565; > > > + case DRM_FORMAT_RGB888: > > > + return OVL_CON_CLRFMT_BGR888; > > > + case DRM_FORMAT_BGR888: > > > + return OVL_CON_CLRFMT_RGB888; > > > + case DRM_FORMAT_RGBX8888: > > > + case DRM_FORMAT_RGBA8888: > > > + case DRM_FORMAT_RGBA1010102: > > > + case DRM_FORMAT_RGBX1010102: > > > + return ((blend_mode == DRM_MODE_BLEND_PREMULTI) ? > > > + OVL_CON_CLRFMT_PABGR8888 : OVL_CON_CLRFMT_ABGRB8888) | > > > + (is_10bit_rgb(fmt) ? OVL_CON_CLRFMT_NB_10_BIT : 0); > > > + case DRM_FORMAT_BGRX8888: > > > + case DRM_FORMAT_BGRA8888: > > > + case DRM_FORMAT_BGRA1010102: > > > + case DRM_FORMAT_BGRX1010102: > > > + return ((blend_mode == DRM_MODE_BLEND_PREMULTI) ? > > > + OVL_CON_CLRFMT_PARGB8888 : OVL_CON_CLRFMT_ARGB8888) | > > > + (is_10bit_rgb(fmt) ? OVL_CON_CLRFMT_NB_10_BIT : 0); > > > + case DRM_FORMAT_XRGB8888: > > > + case DRM_FORMAT_ARGB8888: > > > + case DRM_FORMAT_ARGB2101010: > > > + case DRM_FORMAT_XRGB2101010: > > > + return ((blend_mode == DRM_MODE_BLEND_PREMULTI) ? > > > + OVL_CON_CLRFMT_PBGRA8888 : OVL_CON_CLRFMT_BGRA8888) | > > > + (is_10bit_rgb(fmt) ? OVL_CON_CLRFMT_NB_10_BIT : 0); > > > + case DRM_FORMAT_XBGR8888: > > > + case DRM_FORMAT_ABGR8888: > > > + case DRM_FORMAT_ABGR2101010: > > > + case DRM_FORMAT_XBGR2101010: > > > + return ((blend_mode == DRM_MODE_BLEND_PREMULTI) ? > > > + OVL_CON_CLRFMT_PRGBA8888 : OVL_CON_CLRFMT_RGBA8888) | > > > + (is_10bit_rgb(fmt) ? OVL_CON_CLRFMT_NB_10_BIT : 0); > > > + case DRM_FORMAT_UYVY: > > > + return OVL_CON_CLRFMT_UYVY; > > > + case DRM_FORMAT_YUYV: > > > + return OVL_CON_CLRFMT_YUYV; > > > + } > > > +} > > > + >