On Wed, Nov 20, 2024 at 02:18:43PM +0800, keith zhao wrote: > This commit introduces hardware-based APIs for > the VS DRM related to the DC8200 This doesn't describe anything. I've asked to describe the hardware. Also please don't use phrases as "This commit does this and this". See Documentation/process/submitting-patches.rst > > Signed-off-by: keith zhao <keith.zhao@xxxxxxxxxxxxxxxx> > --- > MAINTAINERS | 1 + > drivers/gpu/drm/Kconfig | 2 + > drivers/gpu/drm/Makefile | 1 + > drivers/gpu/drm/verisilicon/Kconfig | 13 + > drivers/gpu/drm/verisilicon/Makefile | 5 + > drivers/gpu/drm/verisilicon/vs_dc_hw.c | 1104 ++++++++++++++++++++++++ > drivers/gpu/drm/verisilicon/vs_dc_hw.h | 492 +++++++++++ > drivers/gpu/drm/verisilicon/vs_type.h | 54 ++ > 8 files changed, 1672 insertions(+) > create mode 100644 drivers/gpu/drm/verisilicon/Kconfig > create mode 100644 drivers/gpu/drm/verisilicon/Makefile > create mode 100644 drivers/gpu/drm/verisilicon/vs_dc_hw.c > create mode 100644 drivers/gpu/drm/verisilicon/vs_dc_hw.h > create mode 100644 drivers/gpu/drm/verisilicon/vs_type.h > [...] > + > +struct dc_hw { > + enum dc_hw_out out[DC_DISPLAY_NUM]; > + void __iomem *hi_base; > + void __iomem *reg_base; > + struct dc_hw_plane_reg reg[DC_LAYER_NUM]; > + > + struct dc_hw_gamma gamma[DC_DISPLAY_NUM]; > + struct vs_dc_info *info; > +}; > + > +struct vs_dc_plane { > + enum dc_hw_plane_id id; > + u32 offset; > +}; > + > +struct vs_dc { > + struct vs_crtc *crtc[DC_DISPLAY_NUM]; "Not defined here. Please drop and add when it is actually defined.", this was in v4. > + struct dc_hw hw; > + > + struct vs_dc_plane planes[PLANE_NUM]; > +}; > + > +int dc_hw_init(struct vs_dc *dc); > +void dc_hw_disable_plane(struct vs_dc *dc, u8 id); > +void dc_hw_update_cursor(struct dc_hw *hw, u8 id, dma_addr_t dma_addr, > + u32 crtc_w, u32 crtc_x, u32 crtc_y, > + s32 hotspot_x, int32_t hotspot_y); > +void dc_hw_disable_cursor(struct dc_hw *hw, u8 id); > +void dc_hw_update_gamma(struct dc_hw *hw, u8 id, u16 index, > + u16 r, u16 g, u16 b); > +void dc_hw_enable_gamma(struct dc_hw *hw, u8 id, bool enable); > +void dc_hw_enable(struct dc_hw *hw, int id, struct drm_display_mode *mode, > + u8 encoder_type, u32 output_fmt); > +void dc_hw_disable(struct dc_hw *hw, int id); > +void dc_hw_enable_interrupt(struct dc_hw *hw); > +void dc_hw_disable_interrupt(struct dc_hw *hw); > +void dc_hw_get_interrupt(struct dc_hw *hw, u8 *status); > +void dc_hw_enable_shadow_register(struct vs_dc *dc, bool enable); > +void dc_hw_set_out(struct dc_hw *hw, enum dc_hw_out out, u8 id); > +void dc_hw_commit(struct dc_hw *hw); > +void dc_plane_hw_update_format_colorspace(struct vs_dc *dc, u32 format, > + enum drm_color_encoding encoding, u8 id, bool is_yuv); > +void dc_plane_hw_update_address(struct vs_dc *dc, u8 id, u32 format, dma_addr_t *dma_addr, > + struct drm_framebuffer *drm_fb, struct drm_rect *src); > +void dc_plane_hw_update_format(struct vs_dc *dc, u32 format, enum drm_color_encoding encoding, > + unsigned int rotation, bool visible, unsigned int zpos, > + u8 id, u8 display_id); > +void dc_plane_hw_update_scale(struct vs_dc *dc, struct drm_rect *src, struct drm_rect *dst, > + u8 id, u8 display_id, unsigned int rotation); > +void dc_plane_hw_update_blend(struct vs_dc *dc, u16 alpha, u16 pixel_blend_mode, > + u8 id, u8 display_id); > + > +#endif /* __VS_DC_HW_H__ */ > diff --git a/drivers/gpu/drm/verisilicon/vs_type.h b/drivers/gpu/drm/verisilicon/vs_type.h > new file mode 100644 > index 000000000000..e9c4ef3cacd6 > --- /dev/null > +++ b/drivers/gpu/drm/verisilicon/vs_type.h > @@ -0,0 +1,54 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) VeriSilicon Holdings Co., Ltd. > + */ > + > +#ifndef __VS_TYPE_H__ > +#define __VS_TYPE_H__ > + > +enum drm_plane_type; > + > +struct vs_plane_data { > + unsigned int num_formats; > + const u32 *formats; > + u8 num_modifiers; > + const u64 *modifiers; > + unsigned int min_width; > + unsigned int min_height; > + unsigned int max_width; > + unsigned int max_height; > + unsigned int rotation; > + unsigned int blend_mode; > + unsigned int color_encoding; > + int min_scale; /* 16.16 fixed point */ > + int max_scale; /* 16.16 fixed point */ > + u8 zpos; > +}; Doesn't seem to be used in this patch. I think in v4 I've already asked to drop everything (data types, fields, defines) that are not used by _this_ patch. Readd them later, as required. > + > +struct vs_plane_info { > + u32 id; > + const struct vs_plane_data *data; > + enum drm_plane_type type; > +}; > + > +struct vs_dc_info { > + const char *name; > + > + u8 panel_num; > + > + /* planes */ > + u8 plane_num; > + > + u8 layer_num; > + u8 primary_num; > + u8 overlay_num; > + u8 cursor_num; > + const struct vs_plane_info *info; > + /* 0 means no gamma LUT */ > + u16 gamma_size; > + u8 gamma_bits; > + > + u16 pitch_alignment; > +}; > + > +#endif /* __VS_TYPE_H__ */ > -- > 2.34.1 > -- With best wishes Dmitry