drm/msm: fold dpu_format into mdp_formats database
v2 cover drm/msm: fold dpu_format into mdp_formats database
During the review of [1] Abhinav pointed out that mdp_rgb_formats and mdp_rgb_yuv_formats arrays from patch 1 are directly based on the struct mdp_format formats array. This was true, because MDP4 / MDP5 drivers used their own (small) list of supported formats. The DPU driver, supporting more formats, had larger database of the formats and their properties. While we don't have plans to expand MDP5 formats support, it make sense to merge these two databases into a common dataset.
[1] https://patchwork.freedesktop.org/series/120377/
--
Changes in v2:
- Rebased on top of msm-next
- Moved all formats data to the new header mdp_formats.h (Abhinav)
- Dropped the alpha_enable flag changes (Abhinav)
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Dmitry Baryshkov (9):
drm/msm/dpu: use format-related definitions from mdp_common.xml.h drm/msm: add arrays listing formats supported by MDP4/MDP5 hardware drm/msm/dpu: in dpu_format replace bitmap with unsigned long field drm/msm/dpu: pull format flag definitions to mdp_format.h drm/msm: merge dpu_format and mdp_format in struct msm_format drm/msm: convert msm_format::unpack_tight to the flag drm/msm: convert msm_format::unpack_align_msb to the flag drm/msm: merge dpu format database to MDP formats drm/msm: drop msm_kms_funcs::get_format() callback
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 20 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 2 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 8 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 10 +- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 658 +-------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 27 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.h | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 16 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 124 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 40 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 14 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 22 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 75 +-- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 4 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 1 - drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 86 ++- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 7 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 1 - drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 95 +-- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 4 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h | 2 +- drivers/gpu/drm/msm/disp/mdp_format.c | 630 +++++++++++++++++--- drivers/gpu/drm/msm/disp/mdp_format.h | 77 +++ drivers/gpu/drm/msm/disp/mdp_kms.h | 18 +- drivers/gpu/drm/msm/msm_drv.h | 4 +- drivers/gpu/drm/msm/msm_fb.c | 2 +- drivers/gpu/drm/msm/msm_kms.h | 4 - 34 files changed, 913 insertions(+), 1075 deletions(-)
---
base-commit: a35e92ef04c07bd473404b9b73d489aea19a60a8
change-id: 20240420-dpu-format-d655c60875df
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>
PATCH v2 1/9 drm/msm/dpu: use format-related definitions from mdp_common.xml.h
Instead of having DPU-specific defines, switch to the definitions from the mdp_common.xml.h file. This is the preparation for merged of DPU and MDP format tables.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 8 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 290 ++++++++++----------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 64 +---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +- 8 files changed, 169 insertions(+), 219 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +4 -4
@@ -2223,19 +2223,19 @@ void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc,/* enable 10 bit logic */ switch (cdm_cfg->output_fmt->chroma_sample) { -case DPU_CHROMA_RGB : +case CHROMA_FULL : cdm_cfg->h_cdwn_type =CDM_CDWN_DISABLE ; cdm_cfg->v_cdwn_type =CDM_CDWN_DISABLE ;break ; -case DPU_CHROMA_H2V1 : +case CHROMA_H2V1 : cdm_cfg->h_cdwn_type =CDM_CDWN_COSITE ; cdm_cfg->v_cdwn_type =CDM_CDWN_DISABLE ;break ; -case DPU_CHROMA_420 : +case CHROMA_420 : cdm_cfg->h_cdwn_type =CDM_CDWN_COSITE ; cdm_cfg->v_cdwn_type =CDM_CDWN_OFFSITE ;break ; -case DPU_CHROMA_H1V2 : +case CHROMA_H1V2 :default :DPU_ERROR ("[enc:%d] unsupported chroma sampling type\n" ,DRMID (phys_enc->parent));
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +1 -1
@@ -594,7 +594,7 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc wb_cfg->dest.height = job->fb->height; wb_cfg->dest.num_planes = wb_cfg->dest.format->num_planes; -if ((wb_cfg->dest.format->fetch_planes ==DPU_PLANE_PLANAR ) && +if ((wb_cfg->dest.format->fetch_planes ==MDP_PLANE_PLANAR ) && (wb_cfg->dest.format->element[0 ] == C1_B_Cb))swap (wb_cfg->dest.plane_addr[1 ], wb_cfg->dest.plane_addr[2 ]);
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +145 -145
612 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c +1 -1
@@ -186,7 +186,7 @@ static int dpu_hw_cdm_enable(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *cdm)dpu_hw_cdm_setup_cdwn (ctx, cdm);if (cdm->output_type ==CDM_CDWN_OUTPUT_HDMI ) { -if (fmt->chroma_sample ==DPU_CHROMA_H1V2 ) +if (fmt->chroma_sample ==CHROMA_H1V2 )return -EINVAL ;/*unsupported format */ opmode =CDM_HDMI_PACK_OP_MODE_EN ; opmode |= (fmt->chroma_sample <<1 );
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +3 -3
@@ -201,9 +201,9 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, (0x21 << 8)); else/* Interface treats all the pixel data in RGB888 format */ - panel_format = (COLOR_8BIT | - (COLOR_8BIT <<2 ) | - (COLOR_8BIT <<4 ) | + panel_format = (BPC8 | + (BPC8 <<2 ) | + (BPC8 <<4 ) | (0x21 <<8 ));DPU_REG_WRITE (c,INTF_HSYNC_CTL , hsync_ctl);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +7 -57
99 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +6 -6
@@ -241,10 +241,10 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, chroma_samp = fmt->chroma_sample;if (flags &DPU_SSPP_SOURCE_ROTATED_90 ) { -if (chroma_samp ==DPU_CHROMA_H2V1 ) - chroma_samp =DPU_CHROMA_H1V2 ; -else if (chroma_samp ==DPU_CHROMA_H1V2 ) - chroma_samp =DPU_CHROMA_H2V1 ; +if (chroma_samp ==CHROMA_H2V1 ) + chroma_samp =CHROMA_H1V2 ; +else if (chroma_samp ==CHROMA_H1V2 ) + chroma_samp =CHROMA_H2V1 ; } src_format = (chroma_samp << 23) | (fmt->fetch_planes << 19) |
@@ -254,7 +254,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,if (flags &DPU_SSPP_ROT_90 ) src_format |=BIT (11 );/* ROT90 */ -if (fmt->alpha_enable && fmt->fetch_planes ==DPU_PLANE_INTERLEAVED ) +if (fmt->alpha_enable && fmt->fetch_planes ==MDP_PLANE_INTERLEAVED ) src_format |=BIT (8 );/* SRCC3_EN */ if (flags &DPU_SSPP_SOLID_FILL )
@@ -267,7 +267,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, (fmt->unpack_align_msb <<18 ) | ((fmt->bpp -1 ) <<9 ); -if (fmt->fetch_mode !=DPU_FETCH_LINEAR ) { +if (fmt->fetch_mode !=MDP_FETCH_LINEAR ) {if (DPU_FORMAT_IS_UBWC (fmt)) opmode |=MDSS_MDP_OP_BWC_EN ; src_format |= (fmt->fetch_mode &3 ) <<30 ;/*FRAME_FORMAT */
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2 -2
@@ -214,8 +214,8 @@ static int _dpu_plane_calc_fill_level(struct drm_plane *plane,/* FIXME: in multirect case account for the src_width of all the planes */ -if (fmt->fetch_planes ==DPU_PLANE_PSEUDO_PLANAR ) { -if (fmt->chroma_sample ==DPU_CHROMA_420 ) { +if (fmt->fetch_planes ==MDP_PLANE_PSEUDO_PLANAR ) { +if (fmt->chroma_sample ==CHROMA_420 ) {/* NV12 */ total_fl = (fixed_buff_size /2 ) / ((src_width +32 ) * fmt->bpp);
Signature · 1 line
2.39.2
PATCH v2 2/9 drm/msm: add arrays listing formats supported by MDP4/MDP5 hardware
In reply to Dmitry BaryshkovMDP4 and MDP5 drivers enumerate supported formats each time the plane is created. In preparation to merger of MDP DPU format databases, define precise formats list, so that changes to the database do not cause the driver to add unsupported format to the list.
--- drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 57 +++++++++++++++++++++++++++--- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 36 ++++++++++++++----- drivers/gpu/drm/msm/disp/mdp_format.c | 28 --------------- drivers/gpu/drm/msm/disp/mdp_kms.h | 1 - 4 files changed, 80 insertions(+), 42 deletions(-)
drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c +52 -5
@@ -371,6 +371,47 @@ static const uint64_t supported_format_modifiers[] = { DRM_FORMAT_MOD_INVALID }; +const uint32_t mdp4_rgb_formats[] = { +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_RGBA8888 , +DRM_FORMAT_BGRA8888 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_RGBX8888 , +DRM_FORMAT_BGRX8888 , +DRM_FORMAT_RGB888 , +DRM_FORMAT_BGR888 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_BGR565 , +}; + +const uint32_t mdp4_rgb_yuv_formats[] = { +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_RGBA8888 , +DRM_FORMAT_BGRA8888 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_RGBX8888 , +DRM_FORMAT_BGRX8888 , +DRM_FORMAT_RGB888 , +DRM_FORMAT_BGR888 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_BGR565 , + +DRM_FORMAT_NV12 , +DRM_FORMAT_NV21 , +DRM_FORMAT_NV16 , +DRM_FORMAT_NV61 , +DRM_FORMAT_VYUY , +DRM_FORMAT_UYVY , +DRM_FORMAT_YUYV , +DRM_FORMAT_YVYU , +DRM_FORMAT_YUV420 , +DRM_FORMAT_YVU420 , +}; +/* initialize plane */ struct drm_plane *mdp4_plane_init (struct drm_device *dev,enum mdp4_pipe pipe_id,bool private_plane)
@@ -379,6 +420,8 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,struct mdp4_plane *mdp4_plane;int ret;enum drm_plane_type type; +const uint32_t *formats; +unsigned int nformats; mdp4_plane =kzalloc (sizeof (*mdp4_plane),GFP_KERNEL );if (!mdp4_plane) {
@@ -392,13 +435,17 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev, mdp4_plane->name = pipe_names[pipe_id]; mdp4_plane->caps =mdp4_pipe_caps (pipe_id); - mdp4_plane->nformats =mdp_get_formats (mdp4_plane->formats, -ARRAY_SIZE (mdp4_plane->formats), - !pipe_supports_yuv (mdp4_plane->caps)); - type = private_plane ?DRM_PLANE_TYPE_PRIMARY :DRM_PLANE_TYPE_OVERLAY ; + +if (pipe_supports_yuv (mdp4_plane->caps)) { + formats = mdp4_rgb_yuv_formats; + nformats =ARRAY_SIZE (mdp4_rgb_yuv_formats); + }else { + formats = mdp4_rgb_formats; + nformats =ARRAY_SIZE (mdp4_rgb_formats); + } ret =drm_universal_plane_init (dev, plane,0xff , &mdp4_plane_funcs, - mdp4_plane->formats, mdp4_plane->nformats, + formats, nformats, supported_format_modifiers, type,NULL );if (ret) goto fail;
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +28 -8
@@ -17,9 +17,6 @@struct mdp5_plane {struct drm_plane base; - -uint32_t nformats; -uint32_t formats[32 ]; };#define to_mdp5_plane (x) container_of(x, struct mdp5_plane, base)
@@ -1007,6 +1004,32 @@ uint32_t mdp5_plane_get_flush(struct drm_plane *plane)return mask; } +const uint32_t mdp5_plane_formats[] = { +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_RGBA8888 , +DRM_FORMAT_BGRA8888 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_RGBX8888 , +DRM_FORMAT_BGRX8888 , +DRM_FORMAT_RGB888 , +DRM_FORMAT_BGR888 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_BGR565 , + +DRM_FORMAT_NV12 , +DRM_FORMAT_NV21 , +DRM_FORMAT_NV16 , +DRM_FORMAT_NV61 , +DRM_FORMAT_VYUY , +DRM_FORMAT_UYVY , +DRM_FORMAT_YUYV , +DRM_FORMAT_YVYU , +DRM_FORMAT_YUV420 , +DRM_FORMAT_YVU420 , +}; +/* initialize plane */ struct drm_plane *mdp5_plane_init (struct drm_device *dev,enum drm_plane_type type)
@@ -1023,12 +1046,9 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev, plane = &mdp5_plane->base; - mdp5_plane->nformats =mdp_get_formats (mdp5_plane->formats, -ARRAY_SIZE (mdp5_plane->formats), false); - ret =drm_universal_plane_init (dev, plane,0xff , &mdp5_plane_funcs, - mdp5_plane->formats, mdp5_plane->nformats, -NULL , type,NULL ); + mdp5_plane_formats,ARRAY_SIZE (mdp5_plane_formats), +NULL , type,NULL );if (ret) goto fail;
drivers/gpu/drm/msm/disp/mdp_format.c +0 -28
@@ -80,10 +80,6 @@ static struct csc_cfg csc_convert[CSC_MAX] = {#define BPC0A 0 -/* -* Note: Keep RGB formats 1st, followed by YUV formats to avoid breaking -* mdp_get_rgb_formats()'s implementation. -*/ static const struct mdp_format formats[] = {/* name a r g b e0 e1 e2 e3 alpha tight cpp cnt ... */ FMT(ARGB8888, 8, 8, 8, 8, 1, 0, 2, 3, true, true, 4, 4,
@@ -138,30 +134,6 @@ static const struct mdp_format formats[] = { MDP_PLANE_PLANAR, CHROMA_420, true), }; -/* -* Note: -* @rgb_only must be set to true, when requesting -* supported formats for RGB pipes. -*/ -uint32_t mdp_get_formats (uint32_t *pixel_formats,uint32_t max_formats, -bool rgb_only) -{ -uint32_t i; -for (i =0 ; i <ARRAY_SIZE (formats); i++) { -const struct mdp_format *f = &formats[i]; - -if (i == max_formats) -break ; - -if (rgb_only &&MDP_FORMAT_IS_YUV (f)) -break ; - - pixel_formats[i] = f->base.pixel_format; - } - -return i; -} -const struct msm_format *mdp_get_format (struct msm_kms *kms,uint32_t format,uint64_t modifier) {
drivers/gpu/drm/msm/disp/mdp_kms.h +0 -1
@@ -91,7 +91,6 @@ struct mdp_format {#define to_mdp_format (x) container_of(x, struct mdp_format, base)#define MDP_FORMAT_IS_YUV (mdp_format) ((mdp_format)->is_yuv) -uint32_t mdp_get_formats (uint32_t *formats,uint32_t max_formats,bool rgb_only);const struct msm_format *mdp_get_format (struct msm_kms *kms,uint32_t format,uint64_t modifier);/* MDP capabilities */
Signature · 1 line
2.39.2
PATCH v2 3/9 drm/msm/dpu: in dpu_format replace bitmap with unsigned long field
In reply to Dmitry BaryshkovUsing bitmap for the flags results in a clumsy syntax on test_bit, replace it with unsigned long type and simple binary ops.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 18 +++++++++--------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 16 +++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +9 -9
@@ -45,7 +45,7 @@ bp, flg, fm, np) \ .unpack_count = uc, \ .bpp = bp, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -64,7 +64,7 @@ alpha, bp, flg, fm, np, th) \ .unpack_count = uc, \ .bpp = bp, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -84,7 +84,7 @@ alpha, chroma, count, bp, flg, fm, np) \ .unpack_count = count, \ .bpp = bp, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -102,7 +102,7 @@ alpha, chroma, count, bp, flg, fm, np) \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -121,7 +121,7 @@ flg, fm, np, th) \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -139,7 +139,7 @@ flg, fm, np, th) \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -158,7 +158,7 @@ flg, fm, np, th) \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -178,7 +178,7 @@ flg, fm, np) \ .unpack_count = 1, \ .bpp = bp, \ .fetch_mode = fm, \ - .flag = {(flg)}, \ + .flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -1047,7 +1047,7 @@ const struct dpu_format *dpu_get_dpu_format_ext(DPU_ERROR ("unsupported fmt: %4.4s modifier 0x%llX\n" , (char *)&format, modifier); else - DRM_DEBUG_ATOMIC("fmt %4.4s mod 0x%llX ubwc %d yuv %d\n", + DRM_DEBUG_ATOMIC("fmt %4.4s mod 0x%llX ubwc %d yuv %ld\n", (char *)&format, modifier,DPU_FORMAT_IS_UBWC (fmt), DPU_FORMAT_IS_YUV(fmt));
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +7 -9
@@ -40,23 +40,21 @@ enum dpu_format_flags {DPU_FORMAT_FLAG_YUV_BIT ,DPU_FORMAT_FLAG_DX_BIT , DPU_FORMAT_FLAG_COMPRESSED_BIT, - DPU_FORMAT_FLAG_BIT_MAX, };#define DPU_FORMAT_FLAG_YUV BIT(DPU_FORMAT_FLAG_YUV_BIT)#define DPU_FORMAT_FLAG_DX BIT(DPU_FORMAT_FLAG_DX_BIT)#define DPU_FORMAT_FLAG_COMPRESSED BIT(DPU_FORMAT_FLAG_COMPRESSED_BIT) -#define DPU_FORMAT_IS_YUV (X ) \ - (test_bit(DPU_FORMAT_FLAG_YUV_BIT, (X)->flag)) -#define DPU_FORMAT_IS_DX (X ) \ - (test_bit(DPU_FORMAT_FLAG_DX_BIT, (X)->flag)) + +#define DPU_FORMAT_IS_YUV (X ) ((X)->flags & DPU_FORMAT_FLAG_YUV) +#define DPU_FORMAT_IS_DX (X ) ((X)->flags & DPU_FORMAT_FLAG_DX)#define DPU_FORMAT_IS_LINEAR (X ) ((X)->fetch_mode == MDP_FETCH_LINEAR)#define DPU_FORMAT_IS_TILE (X ) \ (((X)->fetch_mode == MDP_FETCH_UBWC) && \ - !test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) + !((X)->flags & DPU_FORMAT_FLAG_COMPRESSED))#define DPU_FORMAT_IS_UBWC (X ) \ (((X)->fetch_mode == MDP_FETCH_UBWC) && \ - test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) + ((X)->flags & DPU_FORMAT_FLAG_COMPRESSED))#define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0)#define DPU_BLEND_FG_ALPHA_BG_CONST (1 << 0)
@@ -334,7 +332,7 @@ enum dpu_3d_blend_mode {* @alpha_enable: whether the format has an alpha channel * @num_planes: number of planes (including meta data planes) * @fetch_mode: linear, tiled, or ubwc hw fetch behavior -* @flag: usage bit flags +* @flags: usage bit flags * @tile_width: format tile width * @tile_height: format tile height */
@@ -351,7 +349,7 @@ struct dpu_format {u8 alpha_enable;u8 num_planes;enum mdp_fetch_mode fetch_mode; -DECLARE_BITMAP (flag,DPU_FORMAT_FLAG_BIT_MAX ); +unsigned long flags;u16 tile_width;u16 tile_height; };
Signature · 1 line
2.39.2
PATCH v2 4/9 drm/msm/dpu: pull format flag definitions to mdp_format.h
In reply to Dmitry BaryshkovIn preparation to merger of formats databases, pull format flag definitions to mdp_format.h header, so that they are visibile to both dpu and mdp drivers.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 98 ++++++++++++++--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 31 +++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 8 +-- drivers/gpu/drm/msm/disp/mdp_format.c | 6 +- drivers/gpu/drm/msm/disp/mdp_format.h | 39 ++++++++++++ drivers/gpu/drm/msm/disp/mdp_kms.h | 4 +- drivers/gpu/drm/msm/msm_drv.h | 4 -- 9 files changed, 109 insertions(+), 89 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +49 -49
@@ -44,8 +44,8 @@ bp, flg, fm, np) \ .unpack_tight = 1, \ .unpack_count = uc, \ .bpp = bp, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -63,8 +63,8 @@ alpha, bp, flg, fm, np, th) \ .unpack_tight = 1, \ .unpack_count = uc, \ .bpp = bp, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -83,8 +83,8 @@ alpha, chroma, count, bp, flg, fm, np) \ .unpack_tight = 1, \ .unpack_count = count, \ .bpp = bp, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -101,8 +101,8 @@ alpha, chroma, count, bp, flg, fm, np) \ .unpack_tight = 1, \ .unpack_count = 2, \ .bpp = 2, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -120,8 +120,8 @@ flg, fm, np, th) \ .unpack_tight = 1, \ .unpack_count = 2, \ .bpp = 2, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -138,8 +138,8 @@ flg, fm, np, th) \ .unpack_tight = 0, \ .unpack_count = 2, \ .bpp = 2, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -157,8 +157,8 @@ flg, fm, np, th) \ .unpack_tight = 0, \ .unpack_count = 2, \ .bpp = 2, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -177,8 +177,8 @@ flg, fm, np) \ .unpack_tight = 1, \ .unpack_count = 1, \ .bpp = bp, \ - .fetch_mode = fm, \ - .flags = flg, \ + .base.fetch_mode = fm, \ + .base.flags = flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -365,115 +365,115 @@ static const struct dpu_format dpu_format_map[] = {INTERLEAVED_RGB_FMT (BGRA1010102 ,BPC8A ,BPC8 ,BPC8 ,BPC8 ,C3_ALPHA , C2_R_Cr,C0_G_Y , C1_B_Cb,4 , - true,4 ,DPU_FORMAT_FLAG_DX , + true,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (RGBA1010102 ,BPC8A ,BPC8 ,BPC8 ,BPC8 ,C3_ALPHA , C1_B_Cb,C0_G_Y , C2_R_Cr,4 , - true,4 ,DPU_FORMAT_FLAG_DX , + true,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (ABGR2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_DX , + true,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (ARGB2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb,C0_G_Y , C2_R_Cr,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_DX , + true,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (XRGB2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb,C0_G_Y , C2_R_Cr,C3_ALPHA ,4 , - false,4 ,DPU_FORMAT_FLAG_DX , + false,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (BGRX1010102 ,BPC8A ,BPC8 ,BPC8 ,BPC8 ,C3_ALPHA , C2_R_Cr,C0_G_Y , C1_B_Cb,4 , - false,4 ,DPU_FORMAT_FLAG_DX , + false,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (XBGR2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - false,4 ,DPU_FORMAT_FLAG_DX , + false,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),INTERLEAVED_RGB_FMT (RGBX1010102 ,BPC8A ,BPC8 ,BPC8 ,BPC8 ,C3_ALPHA , C1_B_Cb,C0_G_Y , C2_R_Cr,4 , - false,4 ,DPU_FORMAT_FLAG_DX , + false,4 ,MSM_FORMAT_FLAG_DX ,MDP_FETCH_LINEAR ,1 ),PSEUDO_YUV_FMT (NV12 ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb, C2_R_Cr, -CHROMA_420 ,DPU_FORMAT_FLAG_YUV , +CHROMA_420 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),PSEUDO_YUV_FMT (NV21 ,0 ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr, C1_B_Cb, -CHROMA_420 ,DPU_FORMAT_FLAG_YUV , +CHROMA_420 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),PSEUDO_YUV_FMT (NV16 ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb, C2_R_Cr, -CHROMA_H2V1 ,DPU_FORMAT_FLAG_YUV , +CHROMA_H2V1 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),PSEUDO_YUV_FMT (NV61 ,0 ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr, C1_B_Cb, -CHROMA_H2V1 ,DPU_FORMAT_FLAG_YUV , +CHROMA_H2V1 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),PSEUDO_YUV_FMT_LOOSE (P010 ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb, C2_R_Cr, -CHROMA_420 ,DPU_FORMAT_FLAG_DX |DPU_FORMAT_FLAG_YUV , +CHROMA_420 ,MSM_FORMAT_FLAG_DX |MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),INTERLEAVED_YUV_FMT (VYUY ,0 ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C0_G_Y , - false,CHROMA_H2V1 ,4 ,2 ,DPU_FORMAT_FLAG_YUV , + false,CHROMA_H2V1 ,4 ,2 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),INTERLEAVED_YUV_FMT (UYVY ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb,C0_G_Y , C2_R_Cr,C0_G_Y , - false,CHROMA_H2V1 ,4 ,2 ,DPU_FORMAT_FLAG_YUV , + false,CHROMA_H2V1 ,4 ,2 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),INTERLEAVED_YUV_FMT (YUYV ,0 ,BPC8 ,BPC8 ,BPC8 ,C0_G_Y , C1_B_Cb,C0_G_Y , C2_R_Cr, - false,CHROMA_H2V1 ,4 ,2 ,DPU_FORMAT_FLAG_YUV , + false,CHROMA_H2V1 ,4 ,2 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),INTERLEAVED_YUV_FMT (YVYU ,0 ,BPC8 ,BPC8 ,BPC8 ,C0_G_Y , C2_R_Cr,C0_G_Y , C1_B_Cb, - false,CHROMA_H2V1 ,4 ,2 ,DPU_FORMAT_FLAG_YUV , + false,CHROMA_H2V1 ,4 ,2 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,2 ),PLANAR_YUV_FMT (YUV420 ,0 ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr, C1_B_Cb,C0_G_Y , - false,CHROMA_420 ,1 ,DPU_FORMAT_FLAG_YUV , + false,CHROMA_420 ,1 ,MSM_FORMAT_FLAG_YUV ,MDP_FETCH_LINEAR ,3 ),PLANAR_YUV_FMT (YVU420 ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb, C2_R_Cr,C0_G_Y , - false,CHROMA_420 ,1 ,DPU_FORMAT_FLAG_YUV , + false,CHROMA_420 ,1 ,MSM_FORMAT_FLAG_YUV , MDP_FETCH_LINEAR, 3), };
@@ -487,13 +487,13 @@ static const struct dpu_format dpu_format_map_ubwc[] = {INTERLEAVED_RGB_FMT_TILED (BGR565 ,0 ,BPC5 ,BPC6 ,BPC5 , C2_R_Cr,C0_G_Y , C1_B_Cb,0 ,3 , - false,2 ,DPU_FORMAT_FLAG_COMPRESSED , + false,2 ,MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),INTERLEAVED_RGB_FMT_TILED (ABGR8888 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_COMPRESSED , + true,4 ,MSM_FORMAT_FLAG_COMPRESSED , MDP_FETCH_UBWC, 2, DPU_TILE_HEIGHT_UBWC),/* ARGB8888 and ABGR8888 purposely have the same color
@@ -503,37 +503,37 @@ static const struct dpu_format dpu_format_map_ubwc[] = {INTERLEAVED_RGB_FMT_TILED (ARGB8888 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_COMPRESSED , + true,4 ,MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),INTERLEAVED_RGB_FMT_TILED (XBGR8888 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - false,4 ,DPU_FORMAT_FLAG_COMPRESSED , + false,4 ,MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),INTERLEAVED_RGB_FMT_TILED (XRGB8888 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - false,4 ,DPU_FORMAT_FLAG_COMPRESSED , + false,4 ,MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),INTERLEAVED_RGB_FMT_TILED (ABGR2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_DX |DPU_FORMAT_FLAG_COMPRESSED , + true,4 ,MSM_FORMAT_FLAG_DX |MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),INTERLEAVED_RGB_FMT_TILED (XBGR2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_DX |DPU_FORMAT_FLAG_COMPRESSED , + true,4 ,MSM_FORMAT_FLAG_DX |MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),INTERLEAVED_RGB_FMT_TILED (XRGB2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_DX |DPU_FORMAT_FLAG_COMPRESSED , + true,4 ,MSM_FORMAT_FLAG_DX |MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),/* XRGB2101010 and ARGB2101010 purposely have the same color
@@ -543,22 +543,22 @@ static const struct dpu_format dpu_format_map_ubwc[] = {INTERLEAVED_RGB_FMT_TILED (ARGB2101010 ,BPC8A ,BPC8 ,BPC8 ,BPC8 , C2_R_Cr,C0_G_Y , C1_B_Cb,C3_ALPHA ,4 , - true,4 ,DPU_FORMAT_FLAG_DX |DPU_FORMAT_FLAG_COMPRESSED , + true,4 ,MSM_FORMAT_FLAG_DX |MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,2 ,DPU_TILE_HEIGHT_UBWC ),PSEUDO_YUV_FMT_TILED (NV12 ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb, C2_R_Cr, -CHROMA_420 ,DPU_FORMAT_FLAG_YUV | -DPU_FORMAT_FLAG_COMPRESSED , +CHROMA_420 ,MSM_FORMAT_FLAG_YUV | +MSM_FORMAT_FLAG_COMPRESSED ,MDP_FETCH_UBWC ,4 ,DPU_TILE_HEIGHT_NV12 ),PSEUDO_YUV_FMT_TILED (P010 ,0 ,BPC8 ,BPC8 ,BPC8 , C1_B_Cb, C2_R_Cr, -CHROMA_420 ,DPU_FORMAT_FLAG_DX | -DPU_FORMAT_FLAG_YUV | -DPU_FORMAT_FLAG_COMPRESSED , +CHROMA_420 ,MSM_FORMAT_FLAG_DX | +MSM_FORMAT_FLAG_YUV | +MSM_FORMAT_FLAG_COMPRESSED , MDP_FETCH_UBWC, 4, DPU_TILE_HEIGHT_UBWC), };
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +7 -24
@@ -9,7 +9,8 @@#include <linux/err.h> #include "msm_drv.h" -#include "mdp_common.xml.h" + +#include "disp/mdp_format.h" #define DPU_DBG_NAME "dpu"
@@ -36,25 +37,11 @@#define DPU_MAX_DE_CURVES 3#endif -enum dpu_format_flags { -DPU_FORMAT_FLAG_YUV_BIT , -DPU_FORMAT_FLAG_DX_BIT , -DPU_FORMAT_FLAG_COMPRESSED_BIT , -}; - -#define DPU_FORMAT_FLAG_YUV BIT(DPU_FORMAT_FLAG_YUV_BIT) -#define DPU_FORMAT_FLAG_DX BIT(DPU_FORMAT_FLAG_DX_BIT) -#define DPU_FORMAT_FLAG_COMPRESSED BIT(DPU_FORMAT_FLAG_COMPRESSED_BIT) - -#define DPU_FORMAT_IS_YUV (X ) ((X)->flags & DPU_FORMAT_FLAG_YUV) -#define DPU_FORMAT_IS_DX (X ) ((X)->flags & DPU_FORMAT_FLAG_DX) -#define DPU_FORMAT_IS_LINEAR (X ) ((X)->fetch_mode == MDP_FETCH_LINEAR) -#define DPU_FORMAT_IS_TILE (X ) \ - (((X)->fetch_mode == MDP_FETCH_UBWC) && \ - !((X)->flags & DPU_FORMAT_FLAG_COMPRESSED)) -#define DPU_FORMAT_IS_UBWC (X ) \ - (((X)->fetch_mode == MDP_FETCH_UBWC) && \ - ((X)->flags & DPU_FORMAT_FLAG_COMPRESSED)) +#define DPU_FORMAT_IS_YUV (X ) MSM_FORMAT_IS_YUV(&(X)->base) +#define DPU_FORMAT_IS_DX (X ) MSM_FORMAT_IS_DX(&(X)->base) +#define DPU_FORMAT_IS_LINEAR (X ) MSM_FORMAT_IS_LINEAR(&(X)->base) +#define DPU_FORMAT_IS_TILE (X ) MSM_FORMAT_IS_TILE(&(X)->base) +#define DPU_FORMAT_IS_UBWC (X ) MSM_FORMAT_IS_UBWC(&(X)->base)#define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0)#define DPU_BLEND_FG_ALPHA_BG_CONST (1 << 0)
@@ -331,8 +318,6 @@ enum dpu_3d_blend_mode {* @bpp: bytes per pixel * @alpha_enable: whether the format has an alpha channel * @num_planes: number of planes (including meta data planes) -* @fetch_mode: linear, tiled, or ubwc hw fetch behavior -* @flags: usage bit flags * @tile_width: format tile width * @tile_height: format tile height */
@@ -348,8 +333,6 @@ struct dpu_format {u8 bpp;u8 alpha_enable;u8 num_planes; -enum mdp_fetch_mode fetch_mode; -unsigned long flags;u16 tile_width;u16 tile_height; };
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +2 -2
@@ -267,10 +267,10 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, (fmt->unpack_align_msb <<18 ) | ((fmt->bpp -1 ) <<9 ); -if (fmt->fetch_mode !=MDP_FETCH_LINEAR ) { +if (!DPU_FORMAT_IS_LINEAR (fmt)) {if (DPU_FORMAT_IS_UBWC (fmt)) opmode |=MDSS_MDP_OP_BWC_EN ; - src_format |= (fmt->fetch_mode &3 ) <<30 ;/*FRAME_FORMAT */ + src_format |= (fmt->base.fetch_mode &3 ) <<30 ;/*FRAME_FORMAT */ DPU_REG_WRITE (c,SSPP_FETCH_CONFIG ,DPU_FETCH_CONFIG_RESET_VALUE | ctx->ubwc->highest_bank_bit <<18 );
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2 -2
@@ -294,14 +294,14 @@ static void _dpu_plane_set_qos_lut(struct drm_plane *plane,trace_dpu_perf_set_danger_luts (pdpu->pipe -SSPP_VIG0 , (fmt) ? fmt->base.pixel_format :0 , - (fmt) ? fmt->fetch_mode :0 , + (fmt) ? fmt->base.fetch_mode :0 , cfg.danger_lut, cfg.safe_lut);DPU_DEBUG_PLANE (pdpu,"pnum:%d fmt: %p4cc mode:%d luts[0x%x, 0x%x]\n" , pdpu->pipe -SSPP_VIG0 , fmt ? &fmt->base.pixel_format :NULL , - fmt ? fmt->fetch_mode :-1 , + fmt ? fmt->base.fetch_mode :-1 , cfg.danger_lut, cfg.safe_lut);
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +4 -4
@@ -634,10 +634,10 @@ static uint32_t get_scale_config(const struct mdp_format *format, uint32_t src, uint32_t dst, bool horz) {const struct drm_format_info *info =drm_format_info (format->base.pixel_format); -bool scaling = format->is_yuv ? true : (src != dst); +bool yuv =MDP_FORMAT_IS_YUV (format); +bool scaling = yuv ? true : (src != dst);uint32_t sub;uint32_t ya_filter, uv_filter; -bool yuv = format->is_yuv;if (!scaling)return 0 ;
@@ -666,7 +666,7 @@ static void calc_pixel_ext(const struct mdp_format *format, int pix_ext_edge1[COMP_MAX], int pix_ext_edge2[COMP_MAX], bool horz) { - bool scaling = format->is_yuv ? true : (src != dst); + bool scaling = MDP_FORMAT_IS_YUV(format) ? true : (src != dst);int i;/*
@@ -696,7 +696,7 @@ static void mdp5_write_pixel_ext(struct mdp5_kms *mdp5_kms, enum mdp5_pipe pipe,uint32_t roi_w = src_w;uint32_t roi_h = src_h; -if (format->is_yuv && i ==COMP_1_2 ) { +if (MDP_FORMAT_IS_YUV (format) && i ==COMP_1_2 ) { roi_w /= info->hsub; roi_h /= info->vsub; }
drivers/gpu/drm/msm/disp/mdp_format.c +4 -2
@@ -63,7 +63,10 @@ static struct csc_cfg csc_convert[CSC_MAX] = { };#define FMT (name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt, fp, cs, yuv) { \ - .base = { .pixel_format = DRM_FORMAT_ ## name }, \ + .base = { \ + .pixel_format = DRM_FORMAT_ ## name, \ + .flags = yuv ? MSM_FORMAT_FLAG_YUV : 0, \ + }, \ .bpc_a = BPC ## a ## A, \ .bpc_r = BPC ## r, \ .bpc_g = BPC ## g, \
@@ -75,7 +78,6 @@ static struct csc_cfg csc_convert[CSC_MAX] = { .unpack_count = cnt, \ .fetch_type = fp, \ .chroma_sample = cs, \ - .is_yuv = yuv, \ }#define BPC0A 0
drivers/gpu/drm/msm/disp/mdp_format.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. +* Copyright (C) 2013 Red Hat +* Author: Rob Clark <[email protected]> +*/ + +#ifndef __MSM_FORMAT_H__ +#define __MSM_FORMAT_H__ + +#include "mdp_common.xml.h" + +enum msm_format_flags { +MSM_FORMAT_FLAG_YUV_BIT , +MSM_FORMAT_FLAG_DX_BIT , +MSM_FORMAT_FLAG_COMPRESSED_BIT , +}; + +#define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT) +#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT) +#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT) + +struct msm_format { +uint32_t pixel_format; +unsigned long flags; +enum mdp_fetch_mode fetch_mode; +}; + +#define MSM_FORMAT_IS_YUV (X ) ((X)->flags & MSM_FORMAT_FLAG_YUV) +#define MSM_FORMAT_IS_DX (X ) ((X)->flags & MSM_FORMAT_FLAG_DX) +#define MSM_FORMAT_IS_LINEAR (X ) ((X)->fetch_mode == MDP_FETCH_LINEAR) +#define MSM_FORMAT_IS_TILE (X ) \ + (((X)->fetch_mode == MDP_FETCH_UBWC) && \ + !((X)->flags & MSM_FORMAT_FLAG_COMPRESSED)) +#define MSM_FORMAT_IS_UBWC (X ) \ + (((X)->fetch_mode == MDP_FETCH_UBWC) && \ + ((X)->flags & MSM_FORMAT_FLAG_COMPRESSED)) + +#endif
drivers/gpu/drm/msm/disp/mdp_kms.h +2 -2
@@ -11,6 +11,7 @@#include <linux/platform_device.h> #include <linux/regulator/consumer.h> +#include "mdp_format.h" #include "msm_drv.h" #include "msm_kms.h" #include "mdp_common.xml.h"
@@ -86,10 +87,9 @@ struct mdp_format {uint8_t cpp, unpack_count;enum mdp_fetch_type fetch_type;enum mdp_chroma_samp_type chroma_sample; -bool is_yuv; };#define to_mdp_format (x) container_of(x, struct mdp_format, base) -#define MDP_FORMAT_IS_YUV (mdp_format) ((mdp_format)->is_yuv) +#define MDP_FORMAT_IS_YUV (mdp_format) (MSM_FORMAT_IS_YUV(&(mdp_format)->base))const struct msm_format *mdp_get_format (struct msm_kms *kms,uint32_t format,uint64_t modifier);
drivers/gpu/drm/msm/msm_drv.h +0 -4
@@ -239,10 +239,6 @@ struct msm_drm_private {bool disable_err_irq; }; -struct msm_format { -uint32_t pixel_format; -}; -struct msm_pending_timer ; int msm_atomic_init_pending_timer(struct msm_pending_timer *timer,
Signature · 1 line
2.39.2
Re: [PATCH v2 4/9] drm/msm/dpu: pull format flag definitions to mdp_format.h
Quoted 5 lines · Dmitry Baryshkov
In preparation to merger of formats databases, pull format flag definitions to
mdp_format.hheader, so that they are visibile to both dpu and mdp drivers.Signed-off-by Dmitry Baryshkov <[email protected]>
Quoted 12 lines
--- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 98 ++++++++++++++--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 31 +++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 8 +-- drivers/gpu/drm/msm/disp/mdp_format.c | 6 +- drivers/gpu/drm/msm/disp/mdp_format.h | 39 ++++++++++++ drivers/gpu/drm/msm/disp/mdp_kms.h | 4 +- drivers/gpu/drm/msm/msm_drv.h | 4 -- 9 files changed, 109 insertions(+), 89 deletions(-)
PATCH v2 5/9 drm/msm: merge dpu_format and mdp_format in struct msm_format
In reply to Dmitry BaryshkovStructures dpu_format and mdp_format are largely the same structures. In order to remove duplication between format databases, merge these two stucture definitions into the global struct msm_format.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 2 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 4 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 184 +++++++++++---------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 8 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.h | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 10 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 41 +---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 30 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 14 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 18 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 74 ++++----- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 4 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 26 +-- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 7 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 54 +++--- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 4 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h | 2 +- drivers/gpu/drm/msm/disp/mdp_format.c | 28 ++-- drivers/gpu/drm/msm/disp/mdp_format.h | 28 ++++ drivers/gpu/drm/msm/disp/mdp_kms.h | 13 -- 28 files changed, 296 insertions(+), 305 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +6 -6
@@ -320,7 +320,7 @@ static bool dpu_crtc_get_scanout_position(struct drm_crtc *crtc, }static void _dpu_crtc_setup_blend_cfg (struct dpu_crtc_mixer *mixer, -struct dpu_plane_state *pstate,struct dpu_format *format) +struct dpu_plane_state *pstate,const struct msm_format *format) {struct dpu_hw_mixer *lm = mixer->hw_lm;uint32_t blend_op;
@@ -363,7 +363,7 @@ static void _dpu_crtc_setup_blend_cfg(struct dpu_crtc_mixer *mixer, fg_alpha, bg_alpha, blend_op);DRM_DEBUG_ATOMIC ("format:%p4cc, alpha_en:%u blend_op:0x%x\n" , - &format->base.pixel_format, format->alpha_enable, blend_op); + &format->pixel_format, format->alpha_enable, blend_op); }static void _dpu_crtc_program_lm_output_roi (struct drm_crtc *crtc)
@@ -395,7 +395,7 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc,struct dpu_crtc_mixer *mixer, u32 num_mixers, enum dpu_stage stage, - struct dpu_format *format, + const struct msm_format *format, uint64_t modifier, struct dpu_sw_pipe *pipe, unsigned int stage_idx,
@@ -412,7 +412,7 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc,trace_dpu_crtc_setup_mixer (DRMID (crtc),DRMID (plane), state,to_dpu_plane_state (state), stage_idx, - format->base.pixel_format, + format->pixel_format, modifier); DRM_DEBUG_ATOMIC("crtc %d stage:%d - plane %d sspp %d fb %d multirect_idx %d\n",
@@ -440,7 +440,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,struct drm_plane_state *state;struct dpu_crtc_state *cstate =to_dpu_crtc_state (crtc->state);struct dpu_plane_state *pstate =NULL ; -struct dpu_format *format; +const struct msm_format *format;struct dpu_hw_ctl *ctl = mixer->lm_ctl;uint32_t lm_idx;
@@ -459,7 +459,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, pstate =to_dpu_plane_state (state); fb = state->fb; - format =to_dpu_format (msm_framebuffer_format (pstate->base.fb)); + format =msm_framebuffer_format (pstate->base.fb);if (pstate->stage ==DPU_STAGE_BASE && format->alpha_enable) bg_alpha_enable = true;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +6 -6
@@ -675,7 +675,7 @@ static int dpu_encoder_virt_atomic_check(if (disp_info->intf_type ==INTF_WB && conn_state->writeback_job) { fb = conn_state->writeback_job->fb; -if (fb &&DPU_FORMAT_IS_YUV (to_dpu_format (msm_framebuffer_format (fb)))) +if (fb &&MSM_FORMAT_IS_YUV (msm_framebuffer_format (fb))) topology.needs_cdm = true; }else if (disp_info->intf_type ==INTF_DP ) {if (msm_dp_is_yuv_420_enabled (priv->dp[disp_info->h_tile_instance[0 ]], adj_mode))
@@ -2184,7 +2184,7 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc) }void dpu_encoder_helper_phys_setup_cdm (struct dpu_encoder_phys *phys_enc, -const struct dpu_format *dpu_fmt, +const struct msm_format *dpu_fmt,u32 output_type) {struct dpu_hw_cdm *hw_cdm;
@@ -2202,9 +2202,9 @@ void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc,if (!hw_cdm)return ; -if (!DPU_FORMAT_IS_YUV (dpu_fmt)) { +if (!MSM_FORMAT_IS_YUV (dpu_fmt)) {DPU_DEBUG ("[enc:%d] cdm_disable fmt:%p4cc\n" ,DRMID (phys_enc->parent), - &dpu_fmt->base.pixel_format); + &dpu_fmt->pixel_format);if (hw_cdm->ops.bind_pingpong_blk) hw_cdm->ops.bind_pingpong_blk (hw_cdm,PINGPONG_NONE );
@@ -2217,7 +2217,7 @@ void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc, cdm_cfg->output_height = phys_enc->cached_mode.vdisplay; cdm_cfg->output_fmt = dpu_fmt; cdm_cfg->output_type = output_type; - cdm_cfg->output_bit_depth =DPU_FORMAT_IS_DX (dpu_fmt) ? + cdm_cfg->output_bit_depth =MSM_FORMAT_IS_DX (dpu_fmt) ?CDM_CDWN_OUTPUT_10BIT :CDM_CDWN_OUTPUT_8BIT ; cdm_cfg->csc_cfg = &dpu_csc10_rgb2yuv_601l;
@@ -2246,7 +2246,7 @@ void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc,DPU_DEBUG ("[enc:%d] cdm_enable:%d,%d,%p4cc,%d,%d,%d,%d]\n" ,DRMID (phys_enc->parent), cdm_cfg->output_width, - cdm_cfg->output_height, &cdm_cfg->output_fmt->base.pixel_format, + cdm_cfg->output_height, &cdm_cfg->output_fmt->pixel_format, cdm_cfg->output_type, cdm_cfg->output_bit_depth, cdm_cfg->h_cdwn_type, cdm_cfg->v_cdwn_type);
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +1 -1
@@ -393,7 +393,7 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc);* @output_type: HDMI/WB */ void dpu_encoder_helper_phys_setup_cdm (struct dpu_encoder_phys *phys_enc, -const struct dpu_format *dpu_fmt, +const struct msm_format *dpu_fmt,u32 output_type);/**
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +2 -2
@@ -235,7 +235,7 @@ static void dpu_encoder_phys_vid_setup_timing_engine( {struct drm_display_mode mode;struct dpu_hw_intf_timing_params timing_params = {0 }; -const struct dpu_format *fmt =NULL ; +const struct msm_format *fmt =NULL ;u32 fmt_fourcc;unsigned long lock_flags;struct dpu_hw_intf_cfg intf_cfg = {0 };
@@ -409,7 +409,7 @@ static int dpu_encoder_phys_vid_control_vblank_irq(static void dpu_encoder_phys_vid_enable (struct dpu_encoder_phys *phys_enc) {struct dpu_hw_ctl *ctl; -const struct dpu_format *fmt; +const struct msm_format *fmt;u32 fmt_fourcc; ctl = phys_enc->hw_ctl;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +2 -2
@@ -322,7 +322,7 @@ static void dpu_encoder_phys_wb_setup(struct dpu_encoder_phys_wb *wb_enc =to_dpu_encoder_phys_wb (phys_enc);struct drm_writeback_job *wb_job;const struct msm_format *format; -const struct dpu_format *dpu_fmt; +const struct msm_format *dpu_fmt; wb_job = wb_enc->wb_job; format =msm_framebuffer_format (wb_enc->wb_job->fb);
@@ -594,7 +594,7 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc wb_cfg->dest.height = job->fb->height; wb_cfg->dest.num_planes = wb_cfg->dest.format->num_planes; -if ((wb_cfg->dest.format->fetch_planes ==MDP_PLANE_PLANAR ) && +if ((wb_cfg->dest.format->fetch_type ==MDP_PLANE_PLANAR ) && (wb_cfg->dest.format->element[0 ] == C1_B_Cb))swap (wb_cfg->dest.plane_addr[1 ], wb_cfg->dest.plane_addr[2 ]);
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +101 -83
435 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h +4 -4
@@ -14,7 +14,7 @@* @format: DRM FourCC Code * @modifiers: format modifier array from client, one per plane */ -const struct dpu_format *dpu_get_dpu_format_ext ( +const struct msm_format *dpu_get_dpu_format_ext (const uint32_t format,const uint64_t modifier);
@@ -43,7 +43,7 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats, }/** -* dpu_get_msm_format - get an dpu_format by its msm_format base +* dpu_get_msm_format - get an msm_format by its msm_format base * callback function registers with the msm_kms layer * @kms: kms driver * @format: DRM FourCC Code
@@ -58,7 +58,7 @@ const struct msm_format *dpu_get_msm_format(* dpu_format_check_modified_format - validate format and buffers for * dpu non-standard, i.e. modified format * @kms: kms driver -* @msm_fmt: pointer to the msm_fmt base pointer of an dpu_format +* @msm_fmt: pointer to the msm_fmt base pointer of an msm_format * @cmd: fb_cmd2 structure user request * @bos: gem buffer object list *
@@ -85,4 +85,4 @@ int dpu_format_populate_layout(struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *fmtl); -#endif /*_DPU_FORMATS_H */ +#endif /*_MSM_FORMATS_H */
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c +2 -2
@@ -170,7 +170,7 @@ static int dpu_hw_cdm_setup_cdwn(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *static int dpu_hw_cdm_enable (struct dpu_hw_cdm *ctx,struct dpu_hw_cdm_cfg *cdm) {struct dpu_hw_blk_reg_map *c = &ctx->hw; -const struct dpu_format *fmt; +const struct msm_format *fmt;u32 opmode =0 ;u32 csc =0 ;
@@ -179,7 +179,7 @@ static int dpu_hw_cdm_enable(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *cdm) fmt = cdm->output_fmt; -if (!DPU_FORMAT_IS_YUV (fmt)) +if (!MSM_FORMAT_IS_YUV (fmt))return -EINVAL ;dpu_hw_csc_setup (&ctx->hw,CDM_CSC_10_MATRIX_COEFF_0 , cdm->csc_cfg, true);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.h +2 -2
@@ -19,7 +19,7 @@ struct dpu_hw_cdm;* @output_bit_depth: output bit-depth of CDM block * @h_cdwn_type: downsample type used for horizontal pixels * @v_cdwn_type: downsample type used for vertical pixels -* @output_fmt: handle to dpu_format of CDM block +* @output_fmt: handle to msm_format of CDM block * @csc_cfg: handle to CSC matrix programmed for CDM block * @output_type: interface to which CDM is paired (HDMI/WB) * @pp_id: ping-pong block to which CDM is bound to
@@ -30,7 +30,7 @@ struct dpu_hw_cdm_cfg {u32 output_bit_depth;u32 h_cdwn_type;u32 v_cdwn_type; -const struct dpu_format *output_fmt; +const struct msm_format *output_fmt;const struct dpu_csc_cfg *csc_cfg;u32 output_type;int pp_id;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +5 -5
@@ -98,7 +98,7 @@static void dpu_hw_intf_setup_timing_engine (struct dpu_hw_intf *ctx,const struct dpu_hw_intf_timing_params *p, -const struct dpu_format *fmt) +const struct msm_format *fmt) {struct dpu_hw_blk_reg_map *c = &ctx->hw;u32 hsync_period, vsync_period;
@@ -194,10 +194,10 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, (p->vsync_polarity <<1 ) |/* VSYNC Polarity */ (p->hsync_polarity <<0 );/* HSYNC Polarity */ -if (!DPU_FORMAT_IS_YUV (fmt)) - panel_format = (fmt->bits[C0_G_Y ] | - (fmt->bits[C1_B_Cb] <<2 ) | - (fmt->bits[C2_R_Cr] <<4 ) | +if (!MSM_FORMAT_IS_YUV (fmt)) + panel_format = (fmt->bpc_g_y | + (fmt->bpc_b_cb <<2 ) | + (fmt->bpc_r_cr <<4 ) | (0x21 <<8 ));else /* Interface treats all the pixel data in RGB888 format */
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +1 -1
@@ -81,7 +81,7 @@ struct dpu_hw_intf_cmd_mode_cfg {struct dpu_hw_intf_ops {void (*setup_timing_gen)(struct dpu_hw_intf *intf,const struct dpu_hw_intf_timing_params *p, -const struct dpu_format *fmt); +const struct msm_format *fmt);void (*setup_prg_fetch)(struct dpu_hw_intf *intf,const struct dpu_hw_intf_prog_fetch *fetch);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +1 -40
59 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +15 -15
@@ -206,7 +206,7 @@ static void _sspp_setup_csc10_opmode(struct dpu_hw_sspp *ctx,* Setup source pixel format, flip, */ static void dpu_hw_sspp_setup_format (struct dpu_sw_pipe *pipe, -const struct dpu_format *fmt,u32 flags) +const struct msm_format *fmt,u32 flags) {struct dpu_hw_sspp *ctx = pipe->sspp;struct dpu_hw_blk_reg_map *c;
@@ -247,14 +247,14 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, chroma_samp =CHROMA_H2V1 ; } - src_format = (chroma_samp <<23 ) | (fmt->fetch_planes <<19 ) | - (fmt->bits[C3_ALPHA ] <<6 ) | (fmt->bits[C2_R_Cr] <<4 ) | - (fmt->bits[C1_B_Cb] <<2 ) | (fmt->bits[C0_G_Y ] <<0 ); + src_format = (chroma_samp <<23 ) | (fmt->fetch_type <<19 ) | + (fmt->bpc_a <<6 ) | (fmt->bpc_r_cr <<4 ) | + (fmt->bpc_b_cb <<2 ) | (fmt->bpc_g_y <<0 );if (flags &DPU_SSPP_ROT_90 ) src_format |=BIT (11 );/* ROT90 */ -if (fmt->alpha_enable && fmt->fetch_planes ==MDP_PLANE_INTERLEAVED ) +if (fmt->alpha_enable && fmt->fetch_type ==MDP_PLANE_INTERLEAVED ) src_format |=BIT (8 );/* SRCC3_EN */ if (flags &DPU_SSPP_SOLID_FILL )
@@ -267,10 +267,10 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, (fmt->unpack_align_msb <<18 ) | ((fmt->bpp -1 ) <<9 ); -if (!DPU_FORMAT_IS_LINEAR (fmt)) { -if (DPU_FORMAT_IS_UBWC (fmt)) +if (fmt->fetch_mode !=MDP_FETCH_LINEAR ) { +if (MSM_FORMAT_IS_UBWC (fmt)) opmode |=MDSS_MDP_OP_BWC_EN ; - src_format |= (fmt->base.fetch_mode &3 ) <<30 ;/*FRAME_FORMAT */ + src_format |= (fmt->fetch_mode &3 ) <<30 ;/*FRAME_FORMAT */ DPU_REG_WRITE (c,SSPP_FETCH_CONFIG ,DPU_FETCH_CONFIG_RESET_VALUE | ctx->ubwc->highest_bank_bit <<18 );
@@ -295,7 +295,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,break ;case UBWC_4_0 :DPU_REG_WRITE (c,SSPP_UBWC_STATIC_CTRL , -DPU_FORMAT_IS_YUV (fmt) ?0 :BIT (30 )); +MSM_FORMAT_IS_YUV (fmt) ?0 :BIT (30 ));break ; } }
@@ -303,20 +303,20 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, opmode |=MDSS_MDP_OP_PE_OVERRIDE ;/* if this is YUV pixel format, enable CSC */ -if (DPU_FORMAT_IS_YUV (fmt)) +if (MSM_FORMAT_IS_YUV (fmt)) src_format |=BIT (15 ); -if (DPU_FORMAT_IS_DX (fmt)) +if (MSM_FORMAT_IS_DX (fmt)) src_format |=BIT (14 );/* update scaler opmode, if appropriate */ if (test_bit (DPU_SSPP_CSC , &ctx->cap->features))_sspp_setup_opmode (ctx,VIG_OP_CSC_EN |VIG_OP_CSC_SRC_DATAFMT , -DPU_FORMAT_IS_YUV (fmt)); +MSM_FORMAT_IS_YUV (fmt));else if (test_bit (DPU_SSPP_CSC_10BIT , &ctx->cap->features))_sspp_setup_csc10_opmode (ctx,VIG_CSC_10_EN |VIG_CSC_10_SRC_DATAFMT , -DPU_FORMAT_IS_YUV (fmt)); +MSM_FORMAT_IS_YUV (fmt));DPU_REG_WRITE (c, format_off, src_format);DPU_REG_WRITE (c, unpack_pat_off, unpack);
@@ -385,7 +385,7 @@ static void dpu_hw_sspp_setup_pe_config(struct dpu_hw_sspp *ctx,static void _dpu_hw_sspp_setup_scaler3 (struct dpu_hw_sspp *ctx,struct dpu_hw_scaler3_cfg *scaler3_cfg, -const struct dpu_format *format) +const struct msm_format *format) {if (!ctx || !scaler3_cfg)return ;
@@ -556,7 +556,7 @@ static void dpu_hw_sspp_setup_qos_ctrl(struct dpu_hw_sspp *ctx, }static void dpu_hw_sspp_setup_cdp (struct dpu_sw_pipe *pipe, -const struct dpu_format *fmt, +const struct msm_format *fmt,bool enable) {struct dpu_hw_sspp *ctx = pipe->sspp;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +3 -3
@@ -183,7 +183,7 @@ struct dpu_hw_sspp_ops {* @flags: Extra flags for format config */ void (*setup_format)(struct dpu_sw_pipe *pipe, -const struct dpu_format *fmt,u32 flags); +const struct msm_format *fmt,u32 flags);/** * setup_rects - setup pipe ROI rectangles
@@ -279,7 +279,7 @@ struct dpu_hw_sspp_ops {*/ void (*setup_scaler)(struct dpu_hw_sspp *ctx,struct dpu_hw_scaler3_cfg *scaler3_cfg, -const struct dpu_format *format); +const struct msm_format *format);/** * setup_cdp - setup client driven prefetch
@@ -288,7 +288,7 @@ struct dpu_hw_sspp_ops {* @enable: whether the CDP should be enabled for this pipe */ void (*setup_cdp)(struct dpu_sw_pipe *pipe, -const struct dpu_format *fmt, +const struct msm_format *fmt,bool enable); };
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c +7 -7
@@ -282,7 +282,7 @@ static void _dpu_hw_setup_scaler3_de(struct dpu_hw_blk_reg_map *c,void dpu_hw_setup_scaler3 (struct dpu_hw_blk_reg_map *c,struct dpu_hw_scaler3_cfg *scaler3_cfg,u32 scaler_offset,u32 scaler_version, -const struct dpu_format *format) +const struct msm_format *format) {u32 op_mode =0 ;u32 phase_init, preload, src_y_rgb, src_uv, dst;
@@ -293,7 +293,7 @@ void dpu_hw_setup_scaler3(struct dpu_hw_blk_reg_map *c, op_mode |=BIT (0 ); op_mode |= (scaler3_cfg->y_rgb_filter_cfg &0x3 ) <<16 ; -if (format &&DPU_FORMAT_IS_YUV (format)) { +if (format &&MSM_FORMAT_IS_YUV (format)) { op_mode |=BIT (12 ); op_mode |= (scaler3_cfg->uv_filter_cfg &0x3 ) <<24 ; }
@@ -367,7 +367,7 @@ void dpu_hw_setup_scaler3(struct dpu_hw_blk_reg_map *c,DPU_REG_WRITE (c,QSEED3_DST_SIZE + scaler_offset, dst); end: -if (format && !DPU_FORMAT_IS_DX (format)) +if (format && !MSM_FORMAT_IS_DX (format)) op_mode |=BIT (14 );if (format && format->alpha_enable) {
@@ -522,16 +522,16 @@ int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,#define CDP_PRELOAD_AHEAD_64 BIT(3)void dpu_setup_cdp (struct dpu_hw_blk_reg_map *c,u32 offset, -const struct dpu_format *fmt,bool enable) +const struct msm_format *fmt,bool enable) {u32 cdp_cntl =CDP_PRELOAD_AHEAD_64 ;if (enable) cdp_cntl |=CDP_ENABLE ; -if (DPU_FORMAT_IS_UBWC (fmt)) +if (MSM_FORMAT_IS_UBWC (fmt)) cdp_cntl |=CDP_UBWC_META_ENABLE ; -if (DPU_FORMAT_IS_UBWC (fmt) || -DPU_FORMAT_IS_TILE (fmt)) +if (MSM_FORMAT_IS_UBWC (fmt) || +MSM_FORMAT_IS_TILE (fmt)) cdp_cntl |=CDP_TILE_AMORTIZE_ENABLE ;DPU_REG_WRITE (c, offset, cdp_cntl);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h +2 -2
@@ -344,14 +344,14 @@ void *dpu_hw_util_get_dir(void);void dpu_hw_setup_scaler3 (struct dpu_hw_blk_reg_map *c,struct dpu_hw_scaler3_cfg *scaler3_cfg,u32 scaler_offset,u32 scaler_version, -const struct dpu_format *format); +const struct msm_format *format);void dpu_hw_csc_setup (struct dpu_hw_blk_reg_map *c,u32 csc_reg_off,const struct dpu_csc_cfg *data,bool csc10);void dpu_setup_cdp (struct dpu_hw_blk_reg_map *c,u32 offset, -const struct dpu_format *fmt,bool enable); +const struct msm_format *fmt,bool enable);u64 _dpu_hw_get_qos_lut (const struct dpu_qos_lut_tbl *tbl,u32 total_fl);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +9 -9
@@ -67,7 +67,7 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, struct dpu_hw_wb_cfg *data) {struct dpu_hw_blk_reg_map *c = &ctx->hw; -const struct dpu_format *fmt = data->dest.format; +const struct msm_format *fmt = data->dest.format;u32 dst_format, pattern, ystride0, ystride1, outsize, chroma_samp;u32 write_config =0 ;u32 opmode =0 ;
@@ -76,20 +76,20 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, chroma_samp = fmt->chroma_sample; dst_format = (chroma_samp <<23 ) | - (fmt->fetch_planes <<19 ) | - (fmt->bits[C3_ALPHA ] <<6 ) | - (fmt->bits[C2_R_Cr] <<4 ) | - (fmt->bits[C1_B_Cb] <<2 ) | - (fmt->bits[C0_G_Y ] <<0 ); + (fmt->fetch_type <<19 ) | + (fmt->bpc_a <<6 ) | + (fmt->bpc_r_cr <<4 ) | + (fmt->bpc_b_cb <<2 ) | + (fmt->bpc_g_y <<0 ); -if (fmt->bits[C3_ALPHA ] || fmt->alpha_enable) { +if (fmt->bpc_a || fmt->alpha_enable) { dst_format |=BIT (8 );/* DSTC3_EN */ if (!fmt->alpha_enable || !(ctx->caps->features &BIT (DPU_WB_PIPE_ALPHA ))) dst_format |=BIT (14 );/* DST_ALPHA_X */ } -if (DPU_FORMAT_IS_YUV (fmt)) +if (MSM_FORMAT_IS_YUV (fmt)) dst_format |=BIT (15 ); pattern = (fmt->element[3] << 24) |
@@ -149,7 +149,7 @@ static void dpu_hw_wb_setup_qos_lut(struct dpu_hw_wb *ctx, }static void dpu_hw_wb_setup_cdp (struct dpu_hw_wb *ctx, -const struct dpu_format *fmt, +const struct msm_format *fmt,bool enable) {if (!ctx)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h +1 -1
@@ -46,7 +46,7 @@ struct dpu_hw_wb_ops { struct dpu_hw_qos_cfg *cfg);void (*setup_cdp)(struct dpu_hw_wb *ctx, -const struct dpu_format *fmt, +const struct msm_format *fmt,bool enable); bool (*setup_clk_force_ctrl)(struct dpu_hw_wb *ctx,
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +37 -37
249 lines not on this page · raw message
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +2 -2
@@ -182,8 +182,8 @@ static void blend_setup(struct drm_crtc *crtc)enum mdp4_pipe pipe_id =mdp4_plane_pipe (plane);int idx = idxs[pipe_id];if (idx >0 ) { -const struct mdp_format *format = -to_mdp_format (msm_framebuffer_format (plane->state->fb)); +const struct msm_format *format = +msm_framebuffer_format (plane->state->fb); alpha[idx-1 ] = format->alpha_enable; } }
drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c +13 -13
@@ -218,7 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,struct mdp4_plane *mdp4_plane =to_mdp4_plane (plane);struct mdp4_kms *mdp4_kms =get_kms (plane);enum mdp4_pipe pipe = mdp4_plane->pipe; -const struct mdp_format *format; +const struct msm_format *format;uint32_t op_mode =0 ;uint32_t phasex_step =MDP4_VG_PHASE_STEP_DEFAULT ;uint32_t phasey_step =MDP4_VG_PHASE_STEP_DEFAULT ;
@@ -241,7 +241,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane, fb->base.id, src_x, src_y, src_w, src_h, crtc->base.id, crtc_x, crtc_y, crtc_w, crtc_h); - format =to_mdp_format (msm_framebuffer_format (fb)); + format =msm_framebuffer_format (fb);if (src_w > (crtc_w *DOWN_SCALE_MAX )) {DRM_DEV_ERROR (dev->dev,"Width down scaling exceeds limits!\n" );
@@ -267,7 +267,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,uint32_t sel_unit =SCALE_FIR ; op_mode |=MDP4_PIPE_OP_MODE_SCALEX_EN ; -if (MDP_FORMAT_IS_YUV (format)) { +if (MSM_FORMAT_IS_YUV (format)) {if (crtc_w > src_w) sel_unit =SCALE_PIXEL_RPT ;else if (crtc_w <= (src_w /4 ))
@@ -283,7 +283,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,uint32_t sel_unit =SCALE_FIR ; op_mode |=MDP4_PIPE_OP_MODE_SCALEY_EN ; -if (MDP_FORMAT_IS_YUV (format)) { +if (MSM_FORMAT_IS_YUV (format)) {if (crtc_h > src_h) sel_unit =SCALE_PIXEL_RPT ;
@@ -316,11 +316,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane, mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_FORMAT(pipe), MDP4_PIPE_SRC_FORMAT_A_BPC(format->bpc_a) | - MDP4_PIPE_SRC_FORMAT_R_BPC(format->bpc_r) | - MDP4_PIPE_SRC_FORMAT_G_BPC(format->bpc_g) | - MDP4_PIPE_SRC_FORMAT_B_BPC(format->bpc_b) | + MDP4_PIPE_SRC_FORMAT_R_BPC(format->bpc_r_cr) | + MDP4_PIPE_SRC_FORMAT_G_BPC(format->bpc_g_y) | + MDP4_PIPE_SRC_FORMAT_B_BPC(format->bpc_b_cb) | COND(format->alpha_enable, MDP4_PIPE_SRC_FORMAT_ALPHA_ENABLE) | - MDP4_PIPE_SRC_FORMAT_CPP(format->cpp - 1) | + MDP4_PIPE_SRC_FORMAT_CPP(format->bpp - 1) | MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) | MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) | MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
@@ -328,12 +328,12 @@ static int mdp4_plane_mode_set(struct drm_plane *plane, COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));mdp4_write (mdp4_kms,REG_MDP4_PIPE_SRC_UNPACK (pipe), -MDP4_PIPE_SRC_UNPACK_ELEM0 (format->unpack[0 ]) | -MDP4_PIPE_SRC_UNPACK_ELEM1 (format->unpack[1 ]) | -MDP4_PIPE_SRC_UNPACK_ELEM2 (format->unpack[2 ]) | -MDP4_PIPE_SRC_UNPACK_ELEM3 (format->unpack[3 ])); +MDP4_PIPE_SRC_UNPACK_ELEM0 (format->element[0 ]) | +MDP4_PIPE_SRC_UNPACK_ELEM1 (format->element[1 ]) | +MDP4_PIPE_SRC_UNPACK_ELEM2 (format->element[2 ]) | +MDP4_PIPE_SRC_UNPACK_ELEM3 (format->element[3 ])); -if (MDP_FORMAT_IS_YUV (format)) { +if (MSM_FORMAT_IS_YUV (format)) {struct csc_cfg *csc =mdp_get_default_csc_cfg (CSC_YUV2RGB ); op_mode |=MDP4_PIPE_OP_MODE_SRC_YCBCR ;
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +3 -4
@@ -216,7 +216,7 @@ static void blend_setup(struct drm_crtc *crtc)struct mdp5_kms *mdp5_kms =get_kms (crtc);struct drm_plane *plane;struct mdp5_plane_state *pstate, *pstates[STAGE_MAX +1 ] = {NULL }; -const struct mdp_format *format; +const struct msm_format *format;struct mdp5_hw_mixer *mixer = pipeline->mixer;uint32_t lm = mixer->lm;struct mdp5_hw_mixer *r_mixer = pipeline->r_mixer;
@@ -274,7 +274,7 @@ static void blend_setup(struct drm_crtc *crtc) ctl_blend_flags |=MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT ;DBG ("Border Color is enabled" ); }else if (plane_cnt) { - format =to_mdp_format (msm_framebuffer_format (pstates[STAGE_BASE ]->base.fb)); + format =msm_framebuffer_format (pstates[STAGE_BASE ]->base.fb);if (format->alpha_enable) bg_alpha_enabled = true;
@@ -285,8 +285,7 @@ static void blend_setup(struct drm_crtc *crtc)if (!pstates[i])continue ; - format =to_mdp_format ( -msm_framebuffer_format (pstates[i]->base.fb)); + format =msm_framebuffer_format (pstates[i]->base.fb); plane = pstates[i]->base.plane; blend_op =MDP5_LM_BLEND_OP_MODE_FG_ALPHA (FG_CONST ) |MDP5_LM_BLEND_OP_MODE_BG_ALPHA (BG_CONST );
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +27 -27
139 lines not on this page · raw message
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +2 -2
@@ -114,10 +114,10 @@ static void set_fifo_thresholds(struct mdp5_smp *smp,* presumably happens during the dma from scanout buffer). */ uint32_t mdp5_smp_calculate (struct mdp5_smp *smp, -const struct mdp_format *format, +const struct msm_format *format,u32 width,bool hdecim) { -const struct drm_format_info *info =drm_format_info (format->base.pixel_format); +const struct drm_format_info *info =drm_format_info (format->pixel_format);struct mdp5_kms *mdp5_kms =get_kms (smp);int rev =mdp5_cfg_get_hw_rev (mdp5_kms->cfg);int i, hsub, nplanes, nlines;
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h +1 -1
@@ -74,7 +74,7 @@ void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p, struct mdp5_global_state *global_state);uint32_t mdp5_smp_calculate (struct mdp5_smp *smp, -const struct mdp_format *format, +const struct msm_format *format,u32 width,bool hdecim); int mdp5_smp_assign(struct mdp5_smp *smp, struct mdp5_smp_state *state,
drivers/gpu/drm/msm/disp/mdp_format.c +13 -15
@@ -63,26 +63,24 @@ static struct csc_cfg csc_convert[CSC_MAX] = { };#define FMT (name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt, fp, cs, yuv) { \ - .base = { \ - .pixel_format = DRM_FORMAT_ ## name, \ - .flags = yuv ? MSM_FORMAT_FLAG_YUV : 0, \ - }, \ + .pixel_format = DRM_FORMAT_ ## name, \ .bpc_a = BPC ## a ## A, \ - .bpc_r = BPC ## r, \ - .bpc_g = BPC ## g, \ - .bpc_b = BPC ## b, \ - .unpack = { e0, e1, e2, e3 }, \ + .bpc_r_cr = BPC ## r, \ + .bpc_g_y = BPC ## g, \ + .bpc_b_cb = BPC ## b, \ + .element = { e0, e1, e2, e3 }, \ + .fetch_type = fp, \ + .chroma_sample = cs, \ .alpha_enable = alpha, \ .unpack_tight = tight, \ - .cpp = c, \ .unpack_count = cnt, \ - .fetch_type = fp, \ - .chroma_sample = cs, \ + .bpp = c, \ + .flags = yuv ? MSM_FORMAT_FLAG_YUV : 0, \ }#define BPC0A 0 -static const struct mdp_format formats[] = { +static const struct msm_format formats[] = {/* name a r g b e0 e1 e2 e3 alpha tight cpp cnt ... */ FMT (ARGB8888 ,8 ,8 ,8 ,8 ,1 ,0 ,2 ,3 , true, true,4 ,4 ,MDP_PLANE_INTERLEAVED ,CHROMA_FULL , false),
@@ -141,9 +139,9 @@ const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format, {int i;for (i =0 ; i <ARRAY_SIZE (formats); i++) { -const struct mdp_format *f = &formats[i]; -if (f->base.pixel_format == format) -return &f->base; +const struct msm_format *f = &formats[i]; +if (f->pixel_format == format) +return f; }return NULL ; }
drivers/gpu/drm/msm/disp/mdp_format.h +28 -0
@@ -20,10 +20,38 @@ enum msm_format_flags {#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT) +/** +* struct msm_format: defines the format configuration +* @pixel_format: format fourcc +* @element: element color ordering +* @fetch_type: how the color components are packed in pixel format +* @chroma_sample: chroma sub-samplng type +* @alpha_enable: whether the format has an alpha channel +* @unpack_tight: whether to use tight or loose unpack +* @unpack_align_msb: unpack aligned to LSB or MSB +* @unpack_count: number of the components to unpack +* @bpp: bytes per pixel +* @flags: usage bit flags +* @num_planes: number of planes (including meta data planes) +* @fetch_mode: linear, tiled, or ubwc hw fetch behavior +* @tile_height: format tile height +*/ struct msm_format {uint32_t pixel_format; +enum mdp_bpc bpc_g_y, bpc_b_cb, bpc_r_cr; +enum mdp_bpc_alpha bpc_a; +u8 element[4 ]; +enum mdp_fetch_type fetch_type; +enum mdp_chroma_samp_type chroma_sample; +bool alpha_enable; +u8 unpack_tight; +u8 unpack_align_msb; +u8 unpack_count; +u8 bpp;unsigned long flags; +u8 num_planes;enum mdp_fetch_mode fetch_mode; +u16 tile_height; };#define MSM_FORMAT_IS_YUV (X ) ((X)->flags & MSM_FORMAT_FLAG_YUV)
drivers/gpu/drm/msm/disp/mdp_kms.h +0 -13
@@ -78,19 +78,6 @@ void mdp_irq_update(struct mdp_kms *mdp_kms);* pixel format helpers: */ -struct mdp_format { -struct msm_format base; -enum mdp_bpc bpc_r, bpc_g, bpc_b; -enum mdp_bpc_alpha bpc_a; -uint8_t unpack[4 ]; -bool alpha_enable, unpack_tight; -uint8_t cpp, unpack_count; -enum mdp_fetch_type fetch_type; -enum mdp_chroma_samp_type chroma_sample; -}; -#define to_mdp_format (x) container_of(x, struct mdp_format, base) -#define MDP_FORMAT_IS_YUV (mdp_format) (MSM_FORMAT_IS_YUV(&(mdp_format)->base)) -const struct msm_format *mdp_get_format (struct msm_kms *kms,uint32_t format,uint64_t modifier);/* MDP capabilities */
Signature · 1 line
2.39.2
PATCH v2 6/9 drm/msm: convert msm_format::unpack_tight to the flag
In reply to Dmitry BaryshkovInstead of having a u8 or bool field unpack_tight, convert it to the flag, this save space in the tables and allows us to handle all booleans in the same way.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 22 ++++-------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 3 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +- drivers/gpu/drm/msm/disp/mdp_format.c | 52 ++++++++++++++--------------- drivers/gpu/drm/msm/disp/mdp_format.h | 4 +-- 7 files changed, 41 insertions(+), 47 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +7 -15
@@ -44,11 +44,10 @@ bp, flg, fm, np) \ .bpc_a = a, \ .chroma_sample = CHROMA_FULL, \ .unpack_align_msb = 0, \ - .unpack_tight = 1, \ .unpack_count = uc, \ .bpp = bp, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -66,11 +65,10 @@ alpha, bp, flg, fm, np, th) \ .bpc_a = a, \ .chroma_sample = CHROMA_FULL, \ .unpack_align_msb = 0, \ - .unpack_tight = 1, \ .unpack_count = uc, \ .bpp = bp, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -89,11 +87,10 @@ alpha, chroma, count, bp, flg, fm, np) \ .bpc_a = a, \ .chroma_sample = chroma, \ .unpack_align_msb = 0, \ - .unpack_tight = 1, \ .unpack_count = count, \ .bpp = bp, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -110,11 +107,10 @@ alpha, chroma, count, bp, flg, fm, np) \ .bpc_a = a, \ .chroma_sample = chroma, \ .unpack_align_msb = 0, \ - .unpack_tight = 1, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -132,11 +128,10 @@ flg, fm, np, th) \ .bpc_a = a, \ .chroma_sample = chroma, \ .unpack_align_msb = 0, \ - .unpack_tight = 1, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -153,7 +148,6 @@ flg, fm, np, th) \ .bpc_a = a, \ .chroma_sample = chroma, \ .unpack_align_msb = 1, \ - .unpack_tight = 0, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \
@@ -175,7 +169,6 @@ flg, fm, np, th) \ .bpc_a = a, \ .chroma_sample = chroma, \ .unpack_align_msb = 1, \ - .unpack_tight = 0, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \
@@ -198,11 +191,10 @@ flg, fm, np) \ .bpc_a = a, \ .chroma_sample = chroma, \ .unpack_align_msb = 0, \ - .unpack_tight = 1, \ .unpack_count = 1, \ .bpp = bp, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -636,7 +628,7 @@ static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt)if (fmt->pixel_format ==DRM_FORMAT_NV12 || fmt->pixel_format ==DRM_FORMAT_P010 ) {if (MSM_FORMAT_IS_DX (fmt)) { -if (fmt->unpack_tight) +if (fmt->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT ) color_fmt =COLOR_FMT_NV12_BPP10_UBWC ;else color_fmt =COLOR_FMT_P010_UBWC ;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +1 -1
@@ -263,7 +263,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, unpack = (fmt->element[3 ] <<24 ) | (fmt->element[2 ] <<16 ) | (fmt->element[1 ] <<8 ) | (fmt->element[0 ] <<0 ); src_format |= ((fmt->unpack_count -1 ) <<12 ) | - (fmt->unpack_tight <<17 ) | + ((fmt->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT ?1 :0 ) <<17 ) | (fmt->unpack_align_msb <<18 ) | ((fmt->bpp -1 ) <<9 );
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +1 -1
@@ -98,7 +98,7 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, (fmt->element[0 ] <<0 ); dst_format |= (fmt->unpack_align_msb <<18 ) | - (fmt->unpack_tight <<17 ) | + ((fmt->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT ?1 :0 ) <<17 ) | ((fmt->unpack_count -1 ) <<12 ) | ((fmt->bpp -1 ) <<9 );
drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c +2 -1
@@ -325,7 +325,8 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,MDP4_PIPE_SRC_FORMAT_FETCH_PLANES (format->fetch_type) |MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP (format->chroma_sample) |MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT (frame_type) | - COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT)); +COND (format->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT , + MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT)); mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe), MDP4_PIPE_SRC_UNPACK_ELEM0(format->element[0]) |
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +2 -1
@@ -801,7 +801,8 @@ static void mdp5_hwpipe_mode_set(struct mdp5_kms *mdp5_kms,COND (format->alpha_enable,MDP5_PIPE_SRC_FORMAT_ALPHA_ENABLE ) |MDP5_PIPE_SRC_FORMAT_CPP (format->bpp -1 ) |MDP5_PIPE_SRC_FORMAT_UNPACK_COUNT (format->unpack_count -1 ) | -COND (format->unpack_tight,MDP5_PIPE_SRC_FORMAT_UNPACK_TIGHT ) | +COND (format->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT , +MDP5_PIPE_SRC_FORMAT_UNPACK_TIGHT ) |MDP5_PIPE_SRC_FORMAT_FETCH_TYPE (format->fetch_type) | MDP5_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample));
drivers/gpu/drm/msm/disp/mdp_format.c +26 -26
98 lines not on this page · raw message
drivers/gpu/drm/msm/disp/mdp_format.h +2 -2
@@ -14,11 +14,13 @@ enum msm_format_flags {MSM_FORMAT_FLAG_YUV_BIT ,MSM_FORMAT_FLAG_DX_BIT ,MSM_FORMAT_FLAG_COMPRESSED_BIT , + MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT, };#define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT)#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT) +#define MSM_FORMAT_FLAG_UNPACK_TIGHT BIT(MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT)/** * struct msm_format: defines the format configuration
@@ -27,7 +29,6 @@ enum msm_format_flags {* @fetch_type: how the color components are packed in pixel format * @chroma_sample: chroma sub-samplng type * @alpha_enable: whether the format has an alpha channel -* @unpack_tight: whether to use tight or loose unpack * @unpack_align_msb: unpack aligned to LSB or MSB * @unpack_count: number of the components to unpack * @bpp: bytes per pixel
@@ -44,7 +45,6 @@ struct msm_format {enum mdp_fetch_type fetch_type;enum mdp_chroma_samp_type chroma_sample;bool alpha_enable; -u8 unpack_tight;u8 unpack_align_msb;u8 unpack_count;u8 bpp;
Signature · 1 line
2.39.2
PATCH v2 7/9 drm/msm: convert msm_format::unpack_align_msb to the flag
In reply to Dmitry BaryshkovInstead of having a u8 or bool field unpack_align_msb, convert it to the flag, this save space in the tables and allows us to handle all booleans in the same way.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 12 ++---------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 2 +- drivers/gpu/drm/msm/disp/mdp_format.h | 4 ++-- 4 files changed, 6 insertions(+), 14 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +2 -10
@@ -43,7 +43,6 @@ bp, flg, fm, np) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = CHROMA_FULL, \ - .unpack_align_msb = 0, \ .unpack_count = uc, \ .bpp = bp, \ .fetch_mode = fm, \
@@ -64,7 +63,6 @@ alpha, bp, flg, fm, np, th) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = CHROMA_FULL, \ - .unpack_align_msb = 0, \ .unpack_count = uc, \ .bpp = bp, \ .fetch_mode = fm, \
@@ -86,7 +84,6 @@ alpha, chroma, count, bp, flg, fm, np) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = chroma, \ - .unpack_align_msb = 0, \ .unpack_count = count, \ .bpp = bp, \ .fetch_mode = fm, \
@@ -106,7 +103,6 @@ alpha, chroma, count, bp, flg, fm, np) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = chroma, \ - .unpack_align_msb = 0, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \
@@ -127,7 +123,6 @@ flg, fm, np, th) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = chroma, \ - .unpack_align_msb = 0, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \
@@ -147,11 +142,10 @@ flg, fm, np, th) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = chroma, \ - .unpack_align_msb = 1, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \ .num_planes = np, \ .tile_height = DPU_TILE_HEIGHT_DEFAULT \ }
@@ -168,11 +162,10 @@ flg, fm, np, th) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = chroma, \ - .unpack_align_msb = 1, \ .unpack_count = 2, \ .bpp = 2, \ .fetch_mode = fm, \ - .flags = flg, \ + .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \ .num_planes = np, \ .tile_height = th \ }
@@ -190,7 +183,6 @@ flg, fm, np) \ .bpc_r_cr = r, \ .bpc_a = a, \ .chroma_sample = chroma, \ - .unpack_align_msb = 0, \ .unpack_count = 1, \ .bpp = bp, \ .fetch_mode = fm, \
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +1 -1
@@ -264,7 +264,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, (fmt->element[1 ] <<8 ) | (fmt->element[0 ] <<0 ); src_format |= ((fmt->unpack_count -1 ) <<12 ) | ((fmt->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT ?1 :0 ) <<17 ) | - (fmt->unpack_align_msb <<18 ) | + ((fmt->flags &MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ?1 :0 ) <<18 ) | ((fmt->bpp -1 ) <<9 );if (fmt->fetch_mode !=MDP_FETCH_LINEAR ) {
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +1 -1
@@ -97,7 +97,7 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, (fmt->element[1 ] <<8 ) | (fmt->element[0 ] <<0 ); - dst_format |= (fmt->unpack_align_msb <<18 ) | + dst_format |= ((fmt->flags &MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ?1 :0 ) <<18 ) | ((fmt->flags &MSM_FORMAT_FLAG_UNPACK_TIGHT ?1 :0 ) <<17 ) | ((fmt->unpack_count -1 ) <<12 ) | ((fmt->bpp -1 ) <<9 );
drivers/gpu/drm/msm/disp/mdp_format.h +2 -2
@@ -15,12 +15,14 @@ enum msm_format_flags {MSM_FORMAT_FLAG_DX_BIT ,MSM_FORMAT_FLAG_COMPRESSED_BIT ,MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT , + MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT, };#define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT)#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT)#define MSM_FORMAT_FLAG_UNPACK_TIGHT BIT(MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT) +#define MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB BIT(MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT)/** * struct msm_format: defines the format configuration
@@ -29,7 +31,6 @@ enum msm_format_flags {* @fetch_type: how the color components are packed in pixel format * @chroma_sample: chroma sub-samplng type * @alpha_enable: whether the format has an alpha channel -* @unpack_align_msb: unpack aligned to LSB or MSB * @unpack_count: number of the components to unpack * @bpp: bytes per pixel * @flags: usage bit flags
@@ -45,7 +46,6 @@ struct msm_format {enum mdp_fetch_type fetch_type;enum mdp_chroma_samp_type chroma_sample;bool alpha_enable; -u8 unpack_align_msb;u8 unpack_count;u8 bpp;unsigned long flags;
Signature · 1 line
2.39.2
PATCH v2 8/9 drm/msm: merge dpu format database to MDP formats
In reply to Dmitry BaryshkovFinally remove duplication between DPU and generic MDP code by merging DPU format lists to the MDP format database.
--- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 4 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 602 -------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 23 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 10 - drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +- drivers/gpu/drm/msm/disp/mdp_format.c | 614 ++++++++++++++++++--- drivers/gpu/drm/msm/disp/mdp_format.h | 10 + drivers/gpu/drm/msm/disp/mdp_kms.h | 2 - drivers/gpu/drm/msm/msm_drv.h | 2 + 11 files changed, 571 insertions(+), 708 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +2 -2
@@ -274,7 +274,7 @@ static void dpu_encoder_phys_vid_setup_timing_engine(drm_mode_to_intf_timing_params (phys_enc, &mode, &timing_params); - fmt =dpu_get_dpu_format (fmt_fourcc); + fmt = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, fmt_fourcc,0 );DPU_DEBUG_VIDENC (phys_enc,"fmt_fourcc 0x%X\n" , fmt_fourcc);if (phys_enc->hw_cdm)
@@ -414,7 +414,7 @@ static void dpu_encoder_phys_vid_enable(struct dpu_encoder_phys *phys_enc) ctl = phys_enc->hw_ctl; fmt_fourcc =dpu_encoder_get_drm_fmt (phys_enc); - fmt =dpu_get_dpu_format (fmt_fourcc); + fmt = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, fmt_fourcc,0 );DPU_DEBUG_VIDENC (phys_enc,"\n" );
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +4 -3
@@ -326,7 +326,8 @@ static void dpu_encoder_phys_wb_setup( wb_job = wb_enc->wb_job; format =msm_framebuffer_format (wb_enc->wb_job->fb); - dpu_fmt =dpu_get_dpu_format_ext (format->pixel_format, wb_job->fb->modifier); + dpu_fmt = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, + format->pixel_format, wb_job->fb->modifier); DPU_DEBUG("[mode_set:%d, \"%s\",%d,%d]\n", hw_wb->idx - WB_0, mode.name,
@@ -576,8 +577,8 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc format =msm_framebuffer_format (job->fb); - wb_cfg->dest.format =dpu_get_dpu_format_ext ( - format->pixel_format, job->fb->modifier); + wb_cfg->dest.format = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, + format->pixel_format, job->fb->modifier);if (!wb_cfg->dest.format) {/* this error should be detected during atomic_check */ DPU_ERROR ("failed to get format %p4cc\n" , &format->pixel_format);
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +0 -602
622 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h +0 -23
@@ -9,17 +9,6 @@#include "msm_gem.h" #include "dpu_hw_mdss.h" -/** -* dpu_get_dpu_format_ext() - Returns dpu format structure pointer. -* @format: DRM FourCC Code -* @modifiers: format modifier array from client, one per plane -*/ -const struct msm_format *dpu_get_dpu_format_ext ( -const uint32_t format, -const uint64_t modifier); - -#define dpu_get_dpu_format (f) dpu_get_dpu_format_ext(f, 0) -/** * dpu_find_format - validate if the pixel format is supported * @format: dpu format
@@ -42,18 +31,6 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats,return false; } -/** -* dpu_get_msm_format - get an msm_format by its msm_format base -* callback function registers with the msm_kms layer -* @kms: kms driver -* @format: DRM FourCC Code -* @modifiers: data layout modifier -*/ -const struct msm_format *dpu_get_msm_format ( -struct msm_kms *kms, -const uint32_t format, -const uint64_t modifiers); -/** * dpu_format_check_modified_format - validate format and buffers for * dpu non-standard, i.e. modified format
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +0 -10
@@ -270,16 +270,6 @@ enum dpu_vbif { VBIF_MAX, }; -/** -* DPU HW,Component order color map -*/ -enum { -C0_G_Y =0 , - C1_B_Cb =1 , - C2_R_Cr =2 , -C3_ALPHA =3 -}; -/** * enum dpu_3d_blend_mode * Desribes how the 3d data is blended
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -1
@@ -982,7 +982,7 @@ static const struct msm_kms_funcs kms_funcs = { .enable_vblank = dpu_kms_enable_vblank, .disable_vblank = dpu_kms_disable_vblank, .check_modified_format = dpu_format_check_modified_format, - .get_format = dpu_get_msm_format, + .get_format = mdp_get_format, .destroy = dpu_kms_destroy, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2 -1
@@ -617,6 +617,7 @@ static void _dpu_plane_color_fill(struct dpu_plane *pdpu, {const struct msm_format *fmt;const struct drm_plane *plane = &pdpu->base; +struct msm_drm_private *priv = plane->dev->dev_private;struct dpu_plane_state *pstate =to_dpu_plane_state (plane->state);u32 fill_color = (color &0xFFFFFF ) | ((alpha &0xFF ) <<24 );
@@ -626,7 +627,7 @@ static void _dpu_plane_color_fill(struct dpu_plane *pdpu,* select fill format to match user property expectation, * h/w only supports RGB variants */ - fmt =dpu_get_dpu_format (DRM_FORMAT_ABGR8888 ); + fmt = priv->kms->funcs->get_format (priv->kms,DRM_FORMAT_ABGR8888 ,0 );/* should not happen ever */ if (!fmt)return ;
drivers/gpu/drm/msm/disp/mdp_format.c +550 -64
637 lines not on this page · raw message
drivers/gpu/drm/msm/disp/mdp_format.h +10 -0
@@ -24,6 +24,16 @@ enum msm_format_flags {#define MSM_FORMAT_FLAG_UNPACK_TIGHT BIT(MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT)#define MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB BIT(MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT) +/** +* DPU HW,Component order color map +*/ +enum { +C0_G_Y =0 , + C1_B_Cb =1 , + C2_R_Cr =2 , +C3_ALPHA =3 +}; +/** * struct msm_format: defines the format configuration * @pixel_format: format fourcc
drivers/gpu/drm/msm/disp/mdp_kms.h +0 -2
@@ -78,8 +78,6 @@ void mdp_irq_update(struct mdp_kms *mdp_kms);* pixel format helpers: */ -const struct msm_format *mdp_get_format (struct msm_kms *kms,uint32_t format,uint64_t modifier); -/* MDP capabilities */ #define MDP_CAP_SMP BIT(0)/* Shared Memory Pool */ #define MDP_CAP_DSC BIT(1)/* VESA Display Stream Compression */
drivers/gpu/drm/msm/msm_drv.h +2 -0
@@ -239,6 +239,8 @@ struct msm_drm_private {bool disable_err_irq; }; +const struct msm_format *mdp_get_format (struct msm_kms *kms,uint32_t format,uint64_t modifier); +struct msm_pending_timer ; int msm_atomic_init_pending_timer(struct msm_pending_timer *timer,
Signature · 1 line
2.39.2
Re: [PATCH v2 8/9] drm/msm: merge dpu format database to MDP formats
Quoted 4 lines · Dmitry Baryshkov
Finally remove duplication between DPU and generic MDP code by merging DPU format lists to the MDP format database.
Signed-off-by Dmitry Baryshkov <[email protected]>
Quoted 14 lines
--- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 4 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 602 -------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 23 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 10 - drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +- drivers/gpu/drm/msm/disp/mdp_format.c | 614 ++++++++++++++++++--- drivers/gpu/drm/msm/disp/mdp_format.h | 10 + drivers/gpu/drm/msm/disp/mdp_kms.h | 2 - drivers/gpu/drm/msm/msm_drv.h | 2 + 11 files changed, 571 insertions(+), 708 deletions(-)
PATCH v2 9/9 drm/msm: drop msm_kms_funcs::get_format() callback
In reply to Dmitry BaryshkovNow as all subdrivers were converted to use common database of formats, drop the get_format() callback and use mdp_get_format() directly.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 5 ++--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 1 - drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 1 - drivers/gpu/drm/msm/msm_fb.c | 2 +- drivers/gpu/drm/msm/msm_kms.h | 4 ---- 8 files changed, 6 insertions(+), 14 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +2 -2
@@ -274,7 +274,7 @@ static void dpu_encoder_phys_vid_setup_timing_engine(drm_mode_to_intf_timing_params (phys_enc, &mode, &timing_params); - fmt = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, fmt_fourcc,0 ); + fmt =mdp_get_format (&phys_enc->dpu_kms->base, fmt_fourcc,0 );DPU_DEBUG_VIDENC (phys_enc,"fmt_fourcc 0x%X\n" , fmt_fourcc);if (phys_enc->hw_cdm)
@@ -414,7 +414,7 @@ static void dpu_encoder_phys_vid_enable(struct dpu_encoder_phys *phys_enc) ctl = phys_enc->hw_ctl; fmt_fourcc =dpu_encoder_get_drm_fmt (phys_enc); - fmt = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, fmt_fourcc,0 ); + fmt =mdp_get_format (&phys_enc->dpu_kms->base, fmt_fourcc,0 );DPU_DEBUG_VIDENC (phys_enc,"\n" );
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +2 -3
@@ -326,8 +326,7 @@ static void dpu_encoder_phys_wb_setup( wb_job = wb_enc->wb_job; format =msm_framebuffer_format (wb_enc->wb_job->fb); - dpu_fmt = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, - format->pixel_format, wb_job->fb->modifier); + dpu_fmt =mdp_get_format (&phys_enc->dpu_kms->base, format->pixel_format, wb_job->fb->modifier); DPU_DEBUG("[mode_set:%d, \"%s\",%d,%d]\n", hw_wb->idx - WB_0, mode.name,
@@ -577,7 +576,7 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc format =msm_framebuffer_format (job->fb); - wb_cfg->dest.format = phys_enc->dpu_kms->base.funcs->get_format (&phys_enc->dpu_kms->base, + wb_cfg->dest.format =mdp_get_format (&phys_enc->dpu_kms->base, format->pixel_format, job->fb->modifier);if (!wb_cfg->dest.format) {/* this error should be detected during atomic_check */
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -1
@@ -982,7 +982,6 @@ static const struct msm_kms_funcs kms_funcs = { .enable_vblank = dpu_kms_enable_vblank, .disable_vblank = dpu_kms_disable_vblank, .check_modified_format = dpu_format_check_modified_format, - .get_format = mdp_get_format, .destroy = dpu_kms_destroy, .snapshot = dpu_kms_mdp_snapshot,#ifdef CONFIG_DEBUG_FS
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
@@ -627,7 +627,7 @@ static void _dpu_plane_color_fill(struct dpu_plane *pdpu,* select fill format to match user property expectation, * h/w only supports RGB variants */ - fmt = priv->kms->funcs->get_format (priv->kms,DRM_FORMAT_ABGR8888 ,0 ); + fmt =mdp_get_format (priv->kms,DRM_FORMAT_ABGR8888 ,0 );/* should not happen ever */ if (!fmt)return ;
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +0 -1
@@ -151,7 +151,6 @@ static const struct mdp_kms_funcs kms_funcs = { .flush_commit = mdp4_flush_commit, .wait_flush = mdp4_wait_flush, .complete_commit = mdp4_complete_commit, - .get_format = mdp_get_format, .round_pixclk = mdp4_round_pixclk, .destroy = mdp4_destroy, },
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +0 -1
@@ -224,7 +224,6 @@ static const struct mdp_kms_funcs kms_funcs = { .prepare_commit = mdp5_prepare_commit, .wait_flush = mdp5_wait_flush, .complete_commit = mdp5_complete_commit, - .get_format = mdp_get_format, .destroy = mdp5_kms_destroy, }, .set_irqmask = mdp5_set_irqmask,
drivers/gpu/drm/msm/msm_fb.c +1 -1
@@ -181,7 +181,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, &mode_cmd->pixel_format); n = info->num_planes; - format = kms->funcs->get_format (kms, mode_cmd->pixel_format, + format =mdp_get_format (kms, mode_cmd->pixel_format, mode_cmd->modifier[0 ]);if (!format) { DRM_DEV_ERROR(dev->dev, "unsupported pixel format: %p4cc\n",
drivers/gpu/drm/msm/msm_kms.h +0 -4
@@ -92,10 +92,6 @@ struct msm_kms_funcs {* Format handling: */ -/* get msm_format w/ optional format modifiers from drm_mode_fb_cmd2 */ -const struct msm_format *(*get_format)(struct msm_kms *kms, -const uint32_t format, -const uint64_t modifiers);/* do format checking on format modified through fb_cmd2 modifiers */ int (*check_modified_format)(const struct msm_kms *kms, const struct msm_format *msm_fmt,
Signature · 1 line
2.39.2