Message ID | 20240926083526.24629-3-jason-jh.lin@mediatek.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Fix degradation problem of alpha blending series | expand |
Hi, Jason: On Thu, 2024-09-26 at 16:35 +0800, Jason-JH.Lin wrote: > Since some SoCs support premultiplied pixel formats but some do not, > the blend_modes parameter is added to mtk_plane_init(), which is > obtained from the mtk_ddp_comp_get_blend_modes function implemented > in different blending supported components. > > The blending supported components can use driver data to set the > blend mode capabilities for different SoCs. Reviewed-by: CK Hu <ck.hu@mediatek.com> > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > --- > drivers/gpu/drm/mediatek/mtk_crtc.c | 1 + > drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 2 ++ > drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 10 ++++++++++ > drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 ++ > drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 7 +++++++ > drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 7 +++++++ > drivers/gpu/drm/mediatek/mtk_ethdr.c | 7 +++++++ > drivers/gpu/drm/mediatek/mtk_ethdr.h | 1 + > drivers/gpu/drm/mediatek/mtk_plane.c | 15 +++++++-------- > drivers/gpu/drm/mediatek/mtk_plane.h | 4 ++-- > 10 files changed, 46 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c > index 175b00e5a253..b65f196f2015 100644 > --- a/drivers/gpu/drm/mediatek/mtk_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c > @@ -913,6 +913,7 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev, > BIT(pipe), > mtk_crtc_plane_type(mtk_crtc->layer_nr, num_planes), > mtk_ddp_comp_supported_rotations(comp), > + mtk_ddp_comp_get_blend_modes(comp), > mtk_ddp_comp_get_formats(comp), > mtk_ddp_comp_get_num_formats(comp), i); > if (ret) > diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c > index be66d94be361..edc6417639e6 100644 > --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c > +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c > @@ -363,6 +363,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl = { > .layer_config = mtk_ovl_layer_config, > .bgclr_in_on = mtk_ovl_bgclr_in_on, > .bgclr_in_off = mtk_ovl_bgclr_in_off, > + .get_blend_modes = mtk_ovl_get_blend_modes, > .get_formats = mtk_ovl_get_formats, > .get_num_formats = mtk_ovl_get_num_formats, > }; > @@ -416,6 +417,7 @@ 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_blend_modes = mtk_ovl_adaptor_get_blend_modes, > .get_formats = mtk_ovl_adaptor_get_formats, > .get_num_formats = mtk_ovl_adaptor_get_num_formats, > .mode_valid = mtk_ovl_adaptor_mode_valid, > diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h > index ecf6dc283cd7..79562af1180f 100644 > --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h > +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h > @@ -80,6 +80,7 @@ struct mtk_ddp_comp_funcs { > void (*ctm_set)(struct device *dev, > struct drm_crtc_state *state); > struct device * (*dma_dev_get)(struct device *dev); > + const u32 (*get_blend_modes)(struct device *dev); > const u32 *(*get_formats)(struct device *dev); > size_t (*get_num_formats)(struct device *dev); > void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next); > @@ -266,6 +267,15 @@ static inline struct device *mtk_ddp_comp_dma_dev_get(struct mtk_ddp_comp *comp) > return comp->dev; > } > > +static inline > +const u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) > +{ > + if (comp->funcs && comp->funcs->get_blend_modes) > + return comp->funcs->get_blend_modes(comp->dev); > + > + return 0; > +} > + > static inline > const u32 *mtk_ddp_comp_get_formats(struct mtk_ddp_comp *comp) > { > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h > index 082ac18fe04a..defa500cd64f 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h > +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h > @@ -103,6 +103,7 @@ void mtk_ovl_register_vblank_cb(struct device *dev, > void mtk_ovl_unregister_vblank_cb(struct device *dev); > void mtk_ovl_enable_vblank(struct device *dev); > void mtk_ovl_disable_vblank(struct device *dev); > +const u32 mtk_ovl_get_blend_modes(struct device *dev); > const u32 *mtk_ovl_get_formats(struct device *dev); > size_t mtk_ovl_get_num_formats(struct device *dev); > > @@ -131,6 +132,7 @@ 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_blend_modes(struct device *dev); > const u32 *mtk_ovl_adaptor_get_formats(struct device *dev); > size_t mtk_ovl_adaptor_get_num_formats(struct device *dev); > enum drm_mode_status mtk_ovl_adaptor_mode_valid(struct device *dev, > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > index 0cf7b80f612e..8592c6078bb1 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > @@ -215,6 +215,13 @@ void mtk_ovl_disable_vblank(struct device *dev) > writel_relaxed(0x0, ovl->regs + DISP_REG_OVL_INTEN); > } > > +const u32 mtk_ovl_get_blend_modes(struct device *dev) > +{ > + struct mtk_disp_ovl *ovl = dev_get_drvdata(dev); > + > + return ovl->data->blend_modes; > +} > + > const u32 *mtk_ovl_get_formats(struct device *dev) > { > struct mtk_disp_ovl *ovl = dev_get_drvdata(dev); > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > index c6768210b08b..93dc9c200705 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > @@ -400,6 +400,13 @@ 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_blend_modes(struct device *dev) > +{ > + struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); > + > + return mtk_ethdr_get_blend_modes(ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]); > +} > + > const u32 *mtk_ovl_adaptor_get_formats(struct device *dev) > { > struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); > diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c > index d1d9cf8b10e1..5532740e17ba 100644 > --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c > +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c > @@ -145,6 +145,13 @@ static irqreturn_t mtk_ethdr_irq_handler(int irq, void *dev_id) > return IRQ_HANDLED; > } > > +const u32 mtk_ethdr_get_blend_modes(struct device *dev) > +{ > + return BIT(DRM_MODE_BLEND_PREMULTI) | > + BIT(DRM_MODE_BLEND_COVERAGE) | > + BIT(DRM_MODE_BLEND_PIXEL_NONE); > +} > + > void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, > struct mtk_plane_state *state, > struct cmdq_pkt *cmdq_pkt) > diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.h b/drivers/gpu/drm/mediatek/mtk_ethdr.h > index 81af9edea3f7..c2c7d56fb429 100644 > --- a/drivers/gpu/drm/mediatek/mtk_ethdr.h > +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.h > @@ -13,6 +13,7 @@ void mtk_ethdr_clk_disable(struct device *dev); > void mtk_ethdr_config(struct device *dev, unsigned int w, > unsigned int h, unsigned int vrefresh, > unsigned int bpc, struct cmdq_pkt *cmdq_pkt); > +const u32 mtk_ethdr_get_blend_modes(struct device *dev); > void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, > struct mtk_plane_state *state, > struct cmdq_pkt *cmdq_pkt); > diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c > index 7d2cb4e0fafa..8a48b3b0a956 100644 > --- a/drivers/gpu/drm/mediatek/mtk_plane.c > +++ b/drivers/gpu/drm/mediatek/mtk_plane.c > @@ -320,8 +320,8 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { > > int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, > unsigned long possible_crtcs, enum drm_plane_type type, > - unsigned int supported_rotations, const u32 *formats, > - size_t num_formats, unsigned int plane_idx) > + unsigned int supported_rotations, const u32 blend_modes, > + const u32 *formats, size_t num_formats, unsigned int plane_idx) > { > int err; > > @@ -366,12 +366,11 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, > if (err) > DRM_ERROR("failed to create property: alpha\n"); > > - err = drm_plane_create_blend_mode_property(plane, > - BIT(DRM_MODE_BLEND_PREMULTI) | > - BIT(DRM_MODE_BLEND_COVERAGE) | > - BIT(DRM_MODE_BLEND_PIXEL_NONE)); > - if (err) > - DRM_ERROR("failed to create property: blend_mode\n"); > + if (blend_modes) { > + err = drm_plane_create_blend_mode_property(plane, blend_modes); > + if (err) > + DRM_ERROR("failed to create property: blend_mode\n"); > + } > > drm_plane_helper_add(plane, &mtk_plane_helper_funcs); > > diff --git a/drivers/gpu/drm/mediatek/mtk_plane.h b/drivers/gpu/drm/mediatek/mtk_plane.h > index 5b177eac67b7..3b13b89989c7 100644 > --- a/drivers/gpu/drm/mediatek/mtk_plane.h > +++ b/drivers/gpu/drm/mediatek/mtk_plane.h > @@ -48,6 +48,6 @@ to_mtk_plane_state(struct drm_plane_state *state) > > int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, > unsigned long possible_crtcs, enum drm_plane_type type, > - unsigned int supported_rotations, const u32 *formats, > - size_t num_formats, unsigned int plane_idx); > + unsigned int supported_rotations, const u32 blend_modes, > + const u32 *formats, size_t num_formats, unsigned int plane_idx); > #endif
Il 26/09/24 10:35, Jason-JH.Lin ha scritto: > Since some SoCs support premultiplied pixel formats but some do not, > the blend_modes parameter is added to mtk_plane_init(), which is > obtained from the mtk_ddp_comp_get_blend_modes function implemented > in different blending supported components. > > The blending supported components can use driver data to set the > blend mode capabilities for different SoCs. > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Hi Jason-JH.Lin, kernel test robot noticed the following build errors: [auto build test ERROR on drm/drm-next] [also build test ERROR on linus/master next-20240927] [cannot apply to v6.11] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jason-JH-Lin/drm-mediatek-ovl-Add-blend_modes-to-driver-data/20240926-163734 base: git://anongit.freedesktop.org/drm/drm drm-next patch link: https://lore.kernel.org/r/20240926083526.24629-3-jason-jh.lin%40mediatek.com patch subject: [PATCH v6 2/2] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs config: arm-randconfig-002-20240929 (https://download.01.org/0day-ci/archive/20240929/202409290616.inw9UGyc-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409290616.inw9UGyc-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202409290616.inw9UGyc-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/gpu/drm/mediatek/mtk_crtc.h:10, from drivers/gpu/drm/mediatek/mtk_ethdr.c:18: drivers/gpu/drm/mediatek/mtk_ddp_comp.h:83:9: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 83 | const u32 (*get_blend_modes)(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_ddp_comp.h:271:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 271 | const u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) | ^~~~~ In file included from drivers/gpu/drm/mediatek/mtk_ethdr.c:21: >> drivers/gpu/drm/mediatek/mtk_ethdr.h:16:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 16 | const u32 mtk_ethdr_get_blend_modes(struct device *dev); | ^~~~~ >> drivers/gpu/drm/mediatek/mtk_ethdr.c:148:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 148 | const u32 mtk_ethdr_get_blend_modes(struct device *dev) | ^~~~~ cc1: all warnings being treated as errors -- In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:20: drivers/gpu/drm/mediatek/mtk_ddp_comp.h:83:9: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 83 | const u32 (*get_blend_modes)(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_ddp_comp.h:271:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 271 | const u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) | ^~~~~ In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:21: drivers/gpu/drm/mediatek/mtk_disp_drv.h:106:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 106 | const u32 mtk_ovl_get_blend_modes(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_disp_drv.h:135:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 135 | const u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev); | ^~~~~ In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:23: >> drivers/gpu/drm/mediatek/mtk_ethdr.h:16:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 16 | const u32 mtk_ethdr_get_blend_modes(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:403:1: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] 403 | const u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev) | ^~~~~ cc1: all warnings being treated as errors vim +16 drivers/gpu/drm/mediatek/mtk_ethdr.h 8 9 void mtk_ethdr_start(struct device *dev); 10 void mtk_ethdr_stop(struct device *dev); 11 int mtk_ethdr_clk_enable(struct device *dev); 12 void mtk_ethdr_clk_disable(struct device *dev); 13 void mtk_ethdr_config(struct device *dev, unsigned int w, 14 unsigned int h, unsigned int vrefresh, 15 unsigned int bpc, struct cmdq_pkt *cmdq_pkt); > 16 const u32 mtk_ethdr_get_blend_modes(struct device *dev);
Hi Jason-JH.Lin, kernel test robot noticed the following build warnings: [auto build test WARNING on drm/drm-next] [also build test WARNING on linus/master next-20240927] [cannot apply to v6.11] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jason-JH-Lin/drm-mediatek-ovl-Add-blend_modes-to-driver-data/20240926-163734 base: git://anongit.freedesktop.org/drm/drm drm-next patch link: https://lore.kernel.org/r/20240926083526.24629-3-jason-jh.lin%40mediatek.com patch subject: [PATCH v6 2/2] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs config: arm64-randconfig-001-20240929 (https://download.01.org/0day-ci/archive/20240929/202409290651.YLKsl39c-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 7773243d9916f98ba0ffce0c3a960e4aa9f03e81) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409290651.YLKsl39c-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202409290651.YLKsl39c-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from drivers/gpu/drm/mediatek/mtk_ethdr.c:18: In file included from drivers/gpu/drm/mediatek/mtk_crtc.h:9: In file included from include/drm/drm_crtc.h:32: In file included from include/drm/drm_modes.h:33: In file included from include/drm/drm_connector.h:32: In file included from include/drm/drm_util.h:36: In file included from include/linux/kgdb.h:19: In file included from include/linux/kprobes.h:28: In file included from include/linux/ftrace.h:13: In file included from include/linux/kallsyms.h:13: In file included from include/linux/mm.h:2232: include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 517 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ In file included from drivers/gpu/drm/mediatek/mtk_ethdr.c:18: In file included from drivers/gpu/drm/mediatek/mtk_crtc.h:10: drivers/gpu/drm/mediatek/mtk_ddp_comp.h:83:2: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 83 | const u32 (*get_blend_modes)(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_ddp_comp.h:271:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 271 | const u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) | ^~~~~ In file included from drivers/gpu/drm/mediatek/mtk_ethdr.c:21: >> drivers/gpu/drm/mediatek/mtk_ethdr.h:16:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 16 | const u32 mtk_ethdr_get_blend_modes(struct device *dev); | ^~~~~ >> drivers/gpu/drm/mediatek/mtk_ethdr.c:148:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 148 | const u32 mtk_ethdr_get_blend_modes(struct device *dev) | ^~~~~ 5 warnings generated. -- In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:7: In file included from include/drm/drm_of.h:8: In file included from include/drm/drm_bridge.h:30: In file included from include/drm/drm_atomic.h:31: In file included from include/drm/drm_crtc.h:32: In file included from include/drm/drm_modes.h:33: In file included from include/drm/drm_connector.h:32: In file included from include/drm/drm_util.h:36: In file included from include/linux/kgdb.h:19: In file included from include/linux/kprobes.h:28: In file included from include/linux/ftrace.h:13: In file included from include/linux/kallsyms.h:13: In file included from include/linux/mm.h:2232: include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 517 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:20: drivers/gpu/drm/mediatek/mtk_ddp_comp.h:83:2: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 83 | const u32 (*get_blend_modes)(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_ddp_comp.h:271:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 271 | const u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) | ^~~~~ In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:21: drivers/gpu/drm/mediatek/mtk_disp_drv.h:106:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 106 | const u32 mtk_ovl_get_blend_modes(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_disp_drv.h:135:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 135 | const u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev); | ^~~~~ In file included from drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:23: >> drivers/gpu/drm/mediatek/mtk_ethdr.h:16:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 16 | const u32 mtk_ethdr_get_blend_modes(struct device *dev); | ^~~~~ drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:403:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] 403 | const u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev) | ^~~~~ 7 warnings generated. vim +/const +16 drivers/gpu/drm/mediatek/mtk_ethdr.h 8 9 void mtk_ethdr_start(struct device *dev); 10 void mtk_ethdr_stop(struct device *dev); 11 int mtk_ethdr_clk_enable(struct device *dev); 12 void mtk_ethdr_clk_disable(struct device *dev); 13 void mtk_ethdr_config(struct device *dev, unsigned int w, 14 unsigned int h, unsigned int vrefresh, 15 unsigned int bpc, struct cmdq_pkt *cmdq_pkt); > 16 const u32 mtk_ethdr_get_blend_modes(struct device *dev);
diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c index 175b00e5a253..b65f196f2015 100644 --- a/drivers/gpu/drm/mediatek/mtk_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c @@ -913,6 +913,7 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev, BIT(pipe), mtk_crtc_plane_type(mtk_crtc->layer_nr, num_planes), mtk_ddp_comp_supported_rotations(comp), + mtk_ddp_comp_get_blend_modes(comp), mtk_ddp_comp_get_formats(comp), mtk_ddp_comp_get_num_formats(comp), i); if (ret) diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c index be66d94be361..edc6417639e6 100644 --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c @@ -363,6 +363,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl = { .layer_config = mtk_ovl_layer_config, .bgclr_in_on = mtk_ovl_bgclr_in_on, .bgclr_in_off = mtk_ovl_bgclr_in_off, + .get_blend_modes = mtk_ovl_get_blend_modes, .get_formats = mtk_ovl_get_formats, .get_num_formats = mtk_ovl_get_num_formats, }; @@ -416,6 +417,7 @@ 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_blend_modes = mtk_ovl_adaptor_get_blend_modes, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, .mode_valid = mtk_ovl_adaptor_mode_valid, diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h index ecf6dc283cd7..79562af1180f 100644 --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h @@ -80,6 +80,7 @@ struct mtk_ddp_comp_funcs { void (*ctm_set)(struct device *dev, struct drm_crtc_state *state); struct device * (*dma_dev_get)(struct device *dev); + const u32 (*get_blend_modes)(struct device *dev); const u32 *(*get_formats)(struct device *dev); size_t (*get_num_formats)(struct device *dev); void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next); @@ -266,6 +267,15 @@ static inline struct device *mtk_ddp_comp_dma_dev_get(struct mtk_ddp_comp *comp) return comp->dev; } +static inline +const u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) +{ + if (comp->funcs && comp->funcs->get_blend_modes) + return comp->funcs->get_blend_modes(comp->dev); + + return 0; +} + static inline const u32 *mtk_ddp_comp_get_formats(struct mtk_ddp_comp *comp) { diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h index 082ac18fe04a..defa500cd64f 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -103,6 +103,7 @@ void mtk_ovl_register_vblank_cb(struct device *dev, void mtk_ovl_unregister_vblank_cb(struct device *dev); void mtk_ovl_enable_vblank(struct device *dev); void mtk_ovl_disable_vblank(struct device *dev); +const u32 mtk_ovl_get_blend_modes(struct device *dev); const u32 *mtk_ovl_get_formats(struct device *dev); size_t mtk_ovl_get_num_formats(struct device *dev); @@ -131,6 +132,7 @@ 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_blend_modes(struct device *dev); const u32 *mtk_ovl_adaptor_get_formats(struct device *dev); size_t mtk_ovl_adaptor_get_num_formats(struct device *dev); enum drm_mode_status mtk_ovl_adaptor_mode_valid(struct device *dev, diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 0cf7b80f612e..8592c6078bb1 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -215,6 +215,13 @@ void mtk_ovl_disable_vblank(struct device *dev) writel_relaxed(0x0, ovl->regs + DISP_REG_OVL_INTEN); } +const u32 mtk_ovl_get_blend_modes(struct device *dev) +{ + struct mtk_disp_ovl *ovl = dev_get_drvdata(dev); + + return ovl->data->blend_modes; +} + const u32 *mtk_ovl_get_formats(struct device *dev) { struct mtk_disp_ovl *ovl = dev_get_drvdata(dev); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index c6768210b08b..93dc9c200705 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -400,6 +400,13 @@ 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_blend_modes(struct device *dev) +{ + struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); + + return mtk_ethdr_get_blend_modes(ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]); +} + const u32 *mtk_ovl_adaptor_get_formats(struct device *dev) { struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c index d1d9cf8b10e1..5532740e17ba 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c @@ -145,6 +145,13 @@ static irqreturn_t mtk_ethdr_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } +const u32 mtk_ethdr_get_blend_modes(struct device *dev) +{ + return BIT(DRM_MODE_BLEND_PREMULTI) | + BIT(DRM_MODE_BLEND_COVERAGE) | + BIT(DRM_MODE_BLEND_PIXEL_NONE); +} + void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, struct mtk_plane_state *state, struct cmdq_pkt *cmdq_pkt) diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.h b/drivers/gpu/drm/mediatek/mtk_ethdr.h index 81af9edea3f7..c2c7d56fb429 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.h +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.h @@ -13,6 +13,7 @@ void mtk_ethdr_clk_disable(struct device *dev); void mtk_ethdr_config(struct device *dev, unsigned int w, unsigned int h, unsigned int vrefresh, unsigned int bpc, struct cmdq_pkt *cmdq_pkt); +const u32 mtk_ethdr_get_blend_modes(struct device *dev); void mtk_ethdr_layer_config(struct device *dev, unsigned int idx, struct mtk_plane_state *state, struct cmdq_pkt *cmdq_pkt); diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c index 7d2cb4e0fafa..8a48b3b0a956 100644 --- a/drivers/gpu/drm/mediatek/mtk_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_plane.c @@ -320,8 +320,8 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, enum drm_plane_type type, - unsigned int supported_rotations, const u32 *formats, - size_t num_formats, unsigned int plane_idx) + unsigned int supported_rotations, const u32 blend_modes, + const u32 *formats, size_t num_formats, unsigned int plane_idx) { int err; @@ -366,12 +366,11 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, if (err) DRM_ERROR("failed to create property: alpha\n"); - err = drm_plane_create_blend_mode_property(plane, - BIT(DRM_MODE_BLEND_PREMULTI) | - BIT(DRM_MODE_BLEND_COVERAGE) | - BIT(DRM_MODE_BLEND_PIXEL_NONE)); - if (err) - DRM_ERROR("failed to create property: blend_mode\n"); + if (blend_modes) { + err = drm_plane_create_blend_mode_property(plane, blend_modes); + if (err) + DRM_ERROR("failed to create property: blend_mode\n"); + } drm_plane_helper_add(plane, &mtk_plane_helper_funcs); diff --git a/drivers/gpu/drm/mediatek/mtk_plane.h b/drivers/gpu/drm/mediatek/mtk_plane.h index 5b177eac67b7..3b13b89989c7 100644 --- a/drivers/gpu/drm/mediatek/mtk_plane.h +++ b/drivers/gpu/drm/mediatek/mtk_plane.h @@ -48,6 +48,6 @@ to_mtk_plane_state(struct drm_plane_state *state) int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, enum drm_plane_type type, - unsigned int supported_rotations, const u32 *formats, - size_t num_formats, unsigned int plane_idx); + unsigned int supported_rotations, const u32 blend_modes, + const u32 *formats, size_t num_formats, unsigned int plane_idx); #endif
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver data to set the blend mode capabilities for different SoCs. Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> --- drivers/gpu/drm/mediatek/mtk_crtc.c | 1 + drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 2 ++ drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 10 ++++++++++ drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 ++ drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 7 +++++++ drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 7 +++++++ drivers/gpu/drm/mediatek/mtk_ethdr.c | 7 +++++++ drivers/gpu/drm/mediatek/mtk_ethdr.h | 1 + drivers/gpu/drm/mediatek/mtk_plane.c | 15 +++++++-------- drivers/gpu/drm/mediatek/mtk_plane.h | 4 ++-- 10 files changed, 46 insertions(+), 10 deletions(-)