* [PATCH 01/12] drm/msm/disp: set num_planes to 1 for interleaved YUV formats
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 18:39 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 02/12] drm/msm/disp: set num_planes and fetch_mode in INTERLEAVED_RGB_FMT Dmitry Baryshkov
` (10 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Interleaved YUV formats use only one plane for all pixel data. Specify
num_planes = 1 for those formats. This was left unnoticed since
_dpu_format_populate_plane_sizes_linear() overrides layout->num_planes.
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index 426782d50cb49d57a0db0cff3a4bb50c5a0b3d1a..eebedb1a2636e76996cf82847b7d391cb67b0941 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -479,25 +479,25 @@ static const struct msm_format mdp_formats[] = {
0, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C0_G_Y,
false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ MDP_FETCH_LINEAR, 1),
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, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ MDP_FETCH_LINEAR, 1),
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, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ MDP_FETCH_LINEAR, 1),
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, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ MDP_FETCH_LINEAR, 1),
/* 3 plane YUV */
PLANAR_YUV_FMT(YUV420,
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 01/12] drm/msm/disp: set num_planes to 1 for interleaved YUV formats
2025-07-05 2:47 ` [PATCH 01/12] drm/msm/disp: set num_planes to 1 for interleaved YUV formats Dmitry Baryshkov
@ 2025-09-04 18:39 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 18:39 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Interleaved YUV formats use only one plane for all pixel data. Specify
> num_planes = 1 for those formats. This was left unnoticed since
> _dpu_format_populate_plane_sizes_linear() overrides layout->num_planes.
>
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index 426782d50cb49d57a0db0cff3a4bb50c5a0b3d1a..eebedb1a2636e76996cf82847b7d391cb67b0941 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -479,25 +479,25 @@ static const struct msm_format mdp_formats[] = {
> 0, BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C0_G_Y,
> false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + MDP_FETCH_LINEAR, 1),
>
> 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, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + MDP_FETCH_LINEAR, 1),
>
> 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, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + MDP_FETCH_LINEAR, 1),
>
> 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, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + MDP_FETCH_LINEAR, 1),
>
> /* 3 plane YUV */
> PLANAR_YUV_FMT(YUV420,
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 02/12] drm/msm/disp: set num_planes and fetch_mode in INTERLEAVED_RGB_FMT
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 01/12] drm/msm/disp: set num_planes to 1 for interleaved YUV formats Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 21:35 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 03/12] drm/msm/disp: set num_planes, fetch_mode and tile_height in INTERLEAVED_RGB_FMT_TILED Dmitry Baryshkov
` (9 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
All interleaved RGB formats use only 1 plane and MDP_FETCH_LINEAR.
Specify num_planes and fetch_mode directly in the macro and remove
unused parameters.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 114 ++++++++++++----------------------
1 file changed, 39 insertions(+), 75 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index eebedb1a2636e76996cf82847b7d391cb67b0941..26be35572fd2ee7456401aa525cc36025bc52ee4 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -67,7 +67,7 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
#define MDP_TILE_HEIGHT_NV12 8
#define INTERLEAVED_RGB_FMT(fmt, a, r, g, b, e0, e1, e2, e3, uc, alpha, \
-bp, flg, fm, np) \
+bp, flg) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_INTERLEAVED, \
@@ -80,9 +80,9 @@ bp, flg, fm, np) \
.chroma_sample = CHROMA_FULL, \
.unpack_count = uc, \
.bpp = bp, \
- .fetch_mode = fm, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
- .num_planes = np, \
+ .num_planes = 1, \
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
@@ -228,218 +228,182 @@ static const struct msm_format mdp_formats[] = {
INTERLEAVED_RGB_FMT(ARGB8888,
BPC8A, BPC8, BPC8, BPC8,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 4, 0),
INTERLEAVED_RGB_FMT(ABGR8888,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 4, 0),
INTERLEAVED_RGB_FMT(XBGR8888,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 4, 0),
INTERLEAVED_RGB_FMT(RGBA8888,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 4, 0),
INTERLEAVED_RGB_FMT(BGRA8888,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 4, 0),
INTERLEAVED_RGB_FMT(BGRX8888,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 4, 0),
INTERLEAVED_RGB_FMT(XRGB8888,
BPC8A, BPC8, BPC8, BPC8,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 4, 0),
INTERLEAVED_RGB_FMT(RGBX8888,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 4, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 4, 0),
INTERLEAVED_RGB_FMT(RGB888,
0, BPC8, BPC8, BPC8,
C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
- false, 3, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 3, 0),
INTERLEAVED_RGB_FMT(BGR888,
0, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
- false, 3, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 3, 0),
INTERLEAVED_RGB_FMT(RGB565,
0, BPC5, BPC6, BPC5,
C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(BGR565,
0, BPC5, BPC6, BPC5,
C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(ARGB1555,
BPC1A, BPC5, BPC5, BPC5,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(ABGR1555,
BPC1A, BPC5, BPC5, BPC5,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(RGBA5551,
BPC1A, BPC5, BPC5, BPC5,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(BGRA5551,
BPC1A, BPC5, BPC5, BPC5,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(XRGB1555,
BPC1A, BPC5, BPC5, BPC5,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(XBGR1555,
BPC1A, BPC5, BPC5, BPC5,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(RGBX5551,
BPC1A, BPC5, BPC5, BPC5,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(BGRX5551,
BPC1A, BPC5, BPC5, BPC5,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(ARGB4444,
BPC4A, BPC4, BPC4, BPC4,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(ABGR4444,
BPC4A, BPC4, BPC4, BPC4,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(RGBA4444,
BPC4A, BPC4, BPC4, BPC4,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(BGRA4444,
BPC4A, BPC4, BPC4, BPC4,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ true, 2, 0),
INTERLEAVED_RGB_FMT(XRGB4444,
BPC4A, BPC4, BPC4, BPC4,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(XBGR4444,
BPC4A, BPC4, BPC4, BPC4,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(RGBX4444,
BPC4A, BPC4, BPC4, BPC4,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(BGRX4444,
BPC4A, BPC4, BPC4, BPC4,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 2, 0,
- MDP_FETCH_LINEAR, 1),
+ false, 2, 0),
INTERLEAVED_RGB_FMT(BGRA1010102,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ true, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(RGBA1010102,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ true, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(ABGR2101010,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ true, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(ARGB2101010,
BPC8A, BPC8, BPC8, BPC8,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ true, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(XRGB2101010,
BPC8A, BPC8, BPC8, BPC8,
C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ false, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(BGRX1010102,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ false, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(XBGR2101010,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ false, 4, MSM_FORMAT_FLAG_DX),
INTERLEAVED_RGB_FMT(RGBX1010102,
BPC8A, BPC8, BPC8, BPC8,
C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 4, MSM_FORMAT_FLAG_DX,
- MDP_FETCH_LINEAR, 1),
+ false, 4, MSM_FORMAT_FLAG_DX),
/* --- RGB formats above / YUV formats below this line --- */
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 02/12] drm/msm/disp: set num_planes and fetch_mode in INTERLEAVED_RGB_FMT
2025-07-05 2:47 ` [PATCH 02/12] drm/msm/disp: set num_planes and fetch_mode in INTERLEAVED_RGB_FMT Dmitry Baryshkov
@ 2025-09-04 21:35 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 21:35 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> All interleaved RGB formats use only 1 plane and MDP_FETCH_LINEAR.
> Specify num_planes and fetch_mode directly in the macro and remove
> unused parameters.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 114 ++++++++++++----------------------
> 1 file changed, 39 insertions(+), 75 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index eebedb1a2636e76996cf82847b7d391cb67b0941..26be35572fd2ee7456401aa525cc36025bc52ee4 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -67,7 +67,7 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> #define MDP_TILE_HEIGHT_NV12 8
>
> #define INTERLEAVED_RGB_FMT(fmt, a, r, g, b, e0, e1, e2, e3, uc, alpha, \
> -bp, flg, fm, np) \
> +bp, flg) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_INTERLEAVED, \
> @@ -80,9 +80,9 @@ bp, flg, fm, np) \
> .chroma_sample = CHROMA_FULL, \
> .unpack_count = uc, \
> .bpp = bp, \
> - .fetch_mode = fm, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> - .num_planes = np, \
> + .num_planes = 1, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> @@ -228,218 +228,182 @@ static const struct msm_format mdp_formats[] = {
> INTERLEAVED_RGB_FMT(ARGB8888,
> BPC8A, BPC8, BPC8, BPC8,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, 0),
>
> INTERLEAVED_RGB_FMT(ABGR8888,
> BPC8A, BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, 0),
>
> INTERLEAVED_RGB_FMT(XBGR8888,
> BPC8A, BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, 0),
>
> INTERLEAVED_RGB_FMT(RGBA8888,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, 0),
>
> INTERLEAVED_RGB_FMT(BGRA8888,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, 0),
>
> INTERLEAVED_RGB_FMT(BGRX8888,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, 0),
>
> INTERLEAVED_RGB_FMT(XRGB8888,
> BPC8A, BPC8, BPC8, BPC8,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, 0),
>
> INTERLEAVED_RGB_FMT(RGBX8888,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 4, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, 0),
>
> INTERLEAVED_RGB_FMT(RGB888,
> 0, BPC8, BPC8, BPC8,
> C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
> - false, 3, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 3, 0),
>
> INTERLEAVED_RGB_FMT(BGR888,
> 0, BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 3, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 3, 0),
>
> INTERLEAVED_RGB_FMT(RGB565,
> 0, BPC5, BPC6, BPC5,
> C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(BGR565,
> 0, BPC5, BPC6, BPC5,
> C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(ARGB1555,
> BPC1A, BPC5, BPC5, BPC5,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(ABGR1555,
> BPC1A, BPC5, BPC5, BPC5,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(RGBA5551,
> BPC1A, BPC5, BPC5, BPC5,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(BGRA5551,
> BPC1A, BPC5, BPC5, BPC5,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(XRGB1555,
> BPC1A, BPC5, BPC5, BPC5,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(XBGR1555,
> BPC1A, BPC5, BPC5, BPC5,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(RGBX5551,
> BPC1A, BPC5, BPC5, BPC5,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(BGRX5551,
> BPC1A, BPC5, BPC5, BPC5,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(ARGB4444,
> BPC4A, BPC4, BPC4, BPC4,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(ABGR4444,
> BPC4A, BPC4, BPC4, BPC4,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(RGBA4444,
> BPC4A, BPC4, BPC4, BPC4,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(BGRA4444,
> BPC4A, BPC4, BPC4, BPC4,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + true, 2, 0),
>
> INTERLEAVED_RGB_FMT(XRGB4444,
> BPC4A, BPC4, BPC4, BPC4,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(XBGR4444,
> BPC4A, BPC4, BPC4, BPC4,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(RGBX4444,
> BPC4A, BPC4, BPC4, BPC4,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(BGRX4444,
> BPC4A, BPC4, BPC4, BPC4,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 2, 0,
> - MDP_FETCH_LINEAR, 1),
> + false, 2, 0),
>
> INTERLEAVED_RGB_FMT(BGRA1010102,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(RGBA1010102,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(ABGR2101010,
> BPC8A, BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(ARGB2101010,
> BPC8A, BPC8, BPC8, BPC8,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + true, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(XRGB2101010,
> BPC8A, BPC8, BPC8, BPC8,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(BGRX1010102,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(XBGR2101010,
> BPC8A, BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, MSM_FORMAT_FLAG_DX),
>
> INTERLEAVED_RGB_FMT(RGBX1010102,
> BPC8A, BPC8, BPC8, BPC8,
> C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 4, MSM_FORMAT_FLAG_DX,
> - MDP_FETCH_LINEAR, 1),
> + false, 4, MSM_FORMAT_FLAG_DX),
>
> /* --- RGB formats above / YUV formats below this line --- */
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 03/12] drm/msm/disp: set num_planes, fetch_mode and tile_height in INTERLEAVED_RGB_FMT_TILED
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 01/12] drm/msm/disp: set num_planes to 1 for interleaved YUV formats Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 02/12] drm/msm/disp: set num_planes and fetch_mode in INTERLEAVED_RGB_FMT Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions Dmitry Baryshkov
` (8 subsequent siblings)
11 siblings, 0 replies; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
All interleaved compressed RGB formats use only 2 planes,
MDP_FETCH_LINEAR and MDP_TILE_HEIGHT_UBWC. Specify num_planes,
fetch_mode and tile_height directly in the macro and remove unused
parameters.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index 26be35572fd2ee7456401aa525cc36025bc52ee4..09a5bffd838b8a4fd3c22622e82dcf9fb99b5117 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -87,7 +87,7 @@ bp, flg) \
}
#define INTERLEAVED_RGB_FMT_TILED(fmt, a, r, g, b, e0, e1, e2, e3, uc, \
-alpha, bp, flg, fm, np, th) \
+alpha, bp, flg) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_INTERLEAVED, \
@@ -100,10 +100,10 @@ alpha, bp, flg, fm, np, th) \
.chroma_sample = CHROMA_FULL, \
.unpack_count = uc, \
.bpp = bp, \
- .fetch_mode = fm, \
+ .fetch_mode = MDP_FETCH_UBWC, \
.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
- .num_planes = np, \
- .tile_height = th \
+ .num_planes = 2, \
+ .tile_height = MDP_TILE_HEIGHT_UBWC, \
}
#define INTERLEAVED_YUV_FMT(fmt, a, r, g, b, e0, e1, e2, e3, \
@@ -487,14 +487,12 @@ static const struct msm_format mdp_formats_ubwc[] = {
INTERLEAVED_RGB_FMT_TILED(BGR565,
0, BPC5, BPC6, BPC5,
C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
- false, 2, MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ false, 2, MSM_FORMAT_FLAG_COMPRESSED),
INTERLEAVED_RGB_FMT_TILED(ABGR8888,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ true, 4, MSM_FORMAT_FLAG_COMPRESSED),
/* ARGB8888 and ABGR8888 purposely have the same color
* ordering. The hardware only supports ABGR8888 UBWC
@@ -503,38 +501,32 @@ static const struct msm_format mdp_formats_ubwc[] = {
INTERLEAVED_RGB_FMT_TILED(ARGB8888,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ true, 4, MSM_FORMAT_FLAG_COMPRESSED),
INTERLEAVED_RGB_FMT_TILED(XBGR8888,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ false, 4, MSM_FORMAT_FLAG_COMPRESSED),
INTERLEAVED_RGB_FMT_TILED(XRGB8888,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ false, 4, MSM_FORMAT_FLAG_COMPRESSED),
INTERLEAVED_RGB_FMT_TILED(ABGR2101010,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
INTERLEAVED_RGB_FMT_TILED(XBGR2101010,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
INTERLEAVED_RGB_FMT_TILED(XRGB2101010,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
/* XRGB2101010 and ARGB2101010 purposely have the same color
* ordering. The hardware only supports ARGB2101010 UBWC
@@ -543,8 +535,7 @@ static const struct msm_format mdp_formats_ubwc[] = {
INTERLEAVED_RGB_FMT_TILED(ARGB2101010,
BPC8A, BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 2, MDP_TILE_HEIGHT_UBWC),
+ true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
PSEUDO_YUV_FMT_TILED(NV12,
0, BPC8, BPC8, BPC8,
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (2 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 03/12] drm/msm/disp: set num_planes, fetch_mode and tile_height in INTERLEAVED_RGB_FMT_TILED Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 23:05 ` Jessica Zhang
2025-09-04 23:06 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 05/12] drm/msm/disp: simplify tiled " Dmitry Baryshkov
` (7 subsequent siblings)
11 siblings, 2 replies; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Define several additional macros, capturing RGB format classes, in order
to simplify defining particular RGB* format.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 275 +++++++++++++++++++---------------
1 file changed, 158 insertions(+), 117 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index 09a5bffd838b8a4fd3c22622e82dcf9fb99b5117..28cef986f2d662484afd47440a79393c48256ff5 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -66,22 +66,99 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
#define MDP_TILE_HEIGHT_UBWC 4
#define MDP_TILE_HEIGHT_NV12 8
-#define INTERLEAVED_RGB_FMT(fmt, a, r, g, b, e0, e1, e2, e3, uc, alpha, \
-bp, flg) \
+#define INTERLEAVED_RGB_FMT(fmt, bp, r, g, b, e0, e1, e2) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_INTERLEAVED, \
- .alpha_enable = alpha, \
+ .alpha_enable = false, \
+ .element = { (e0), (e1), (e2), 0 }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = 0, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 3, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
+ .num_planes = 1, \
+ .tile_height = MDP_TILE_HEIGHT_DEFAULT \
+}
+
+#define INTERLEAVED_RGBA_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = true, \
.element = { (e0), (e1), (e2), (e3) }, \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = CHROMA_FULL, \
- .unpack_count = uc, \
+ .unpack_count = 4, \
.bpp = bp, \
.fetch_mode = MDP_FETCH_LINEAR, \
- .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
+ .num_planes = 1, \
+ .tile_height = MDP_TILE_HEIGHT_DEFAULT \
+}
+
+#define INTERLEAVED_RGBX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = false, \
+ .element = { (e0), (e1), (e2), (e3) }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = a, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 4, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
+ .num_planes = 1, \
+ .tile_height = MDP_TILE_HEIGHT_DEFAULT \
+}
+
+#define INTERLEAVED_RGBA_DX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = true, \
+ .element = { (e0), (e1), (e2), (e3) }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = a, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 4, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_DX, \
+ .num_planes = 1, \
+ .tile_height = MDP_TILE_HEIGHT_DEFAULT \
+}
+
+#define INTERLEAVED_RGBX_DX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = false, \
+ .element = { (e0), (e1), (e2), (e3) }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = a, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 4, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_DX, \
.num_planes = 1, \
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
@@ -225,185 +302,149 @@ flg, fm, np) \
}
static const struct msm_format mdp_formats[] = {
- INTERLEAVED_RGB_FMT(ARGB8888,
+ INTERLEAVED_RGBA_FMT(ARGB8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 4, 0),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(ABGR8888,
+ INTERLEAVED_RGBA_FMT(ABGR8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, 0),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(XBGR8888,
+ INTERLEAVED_RGBX_FMT(XBGR8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, 0),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBA8888,
+ INTERLEAVED_RGBA_FMT(RGBA8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 4, 0),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGRA8888,
+ INTERLEAVED_RGBA_FMT(BGRA8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 4, 0),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(BGRX8888,
+ INTERLEAVED_RGBX_FMT(BGRX8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 4, 0),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(XRGB8888,
+ INTERLEAVED_RGBX_FMT(XRGB8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 4, 0),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBX8888,
+ INTERLEAVED_RGBX_FMT(RGBX8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 4, 0),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(RGB888,
- 0, BPC8, BPC8, BPC8,
- C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
- false, 3, 0),
+ INTERLEAVED_RGB_FMT(RGB888, 3,
+ BPC8, BPC8, BPC8,
+ C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGR888,
- 0, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
- false, 3, 0),
+ INTERLEAVED_RGB_FMT(BGR888, 3,
+ BPC8, BPC8, BPC8,
+ C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(RGB565,
- 0, BPC5, BPC6, BPC5,
- C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
- false, 2, 0),
+ INTERLEAVED_RGB_FMT(RGB565, 2,
+ BPC5, BPC6, BPC5,
+ C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGR565,
- 0, BPC5, BPC6, BPC5,
- C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
- false, 2, 0),
+ INTERLEAVED_RGB_FMT(BGR565, 2,
+ BPC5, BPC6, BPC5,
+ C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(ARGB1555,
+ INTERLEAVED_RGBA_FMT(ARGB1555, 2,
BPC1A, BPC5, BPC5, BPC5,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 2, 0),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(ABGR1555,
+ INTERLEAVED_RGBA_FMT(ABGR1555, 2,
BPC1A, BPC5, BPC5, BPC5,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 2, 0),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBA5551,
+ INTERLEAVED_RGBA_FMT(RGBA5551, 2,
BPC1A, BPC5, BPC5, BPC5,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 2, 0),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGRA5551,
+ INTERLEAVED_RGBA_FMT(BGRA5551, 2,
BPC1A, BPC5, BPC5, BPC5,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 2, 0),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(XRGB1555,
+ INTERLEAVED_RGBX_FMT(XRGB1555, 2,
BPC1A, BPC5, BPC5, BPC5,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 2, 0),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(XBGR1555,
+ INTERLEAVED_RGBX_FMT(XBGR1555, 2,
BPC1A, BPC5, BPC5, BPC5,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 2, 0),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBX5551,
+ INTERLEAVED_RGBX_FMT(RGBX5551, 2,
BPC1A, BPC5, BPC5, BPC5,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 2, 0),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGRX5551,
+ INTERLEAVED_RGBX_FMT(BGRX5551, 2,
BPC1A, BPC5, BPC5, BPC5,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 2, 0),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(ARGB4444,
+ INTERLEAVED_RGBA_FMT(ARGB4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 2, 0),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(ABGR4444,
+ INTERLEAVED_RGBA_FMT(ABGR4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 2, 0),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBA4444,
+ INTERLEAVED_RGBA_FMT(RGBA4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 2, 0),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGRA4444,
+ INTERLEAVED_RGBA_FMT(BGRA4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 2, 0),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(XRGB4444,
+ INTERLEAVED_RGBX_FMT(XRGB4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 2, 0),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(XBGR4444,
+ INTERLEAVED_RGBX_FMT(XBGR4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 2, 0),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBX4444,
+ INTERLEAVED_RGBX_FMT(RGBX4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 2, 0),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(BGRX4444,
+ INTERLEAVED_RGBX_FMT(BGRX4444, 2,
BPC4A, BPC4, BPC4, BPC4,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 2, 0),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(BGRA1010102,
+ INTERLEAVED_RGBA_DX_FMT(BGRA1010102, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- true, 4, MSM_FORMAT_FLAG_DX),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(RGBA1010102,
+ INTERLEAVED_RGBA_DX_FMT(RGBA1010102, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- true, 4, MSM_FORMAT_FLAG_DX),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
- INTERLEAVED_RGB_FMT(ABGR2101010,
+ INTERLEAVED_RGBA_DX_FMT(ABGR2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(ARGB2101010,
+ INTERLEAVED_RGBA_DX_FMT(ARGB2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(XRGB2101010,
+ INTERLEAVED_RGBX_DX_FMT(XRGB2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_DX),
+ C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
- INTERLEAVED_RGB_FMT(BGRX1010102,
+ INTERLEAVED_RGBX_DX_FMT(BGRX1010102, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
- false, 4, MSM_FORMAT_FLAG_DX),
+ C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT(XBGR2101010,
+ INTERLEAVED_RGBX_DX_FMT(XBGR2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_DX),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT(RGBX1010102,
+ INTERLEAVED_RGBX_DX_FMT(RGBX1010102, 4,
BPC8A, BPC8, BPC8, BPC8,
- C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
- false, 4, MSM_FORMAT_FLAG_DX),
+ C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
/* --- RGB formats above / YUV formats below this line --- */
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions
2025-07-05 2:47 ` [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions Dmitry Baryshkov
@ 2025-09-04 23:05 ` Jessica Zhang
2025-09-04 23:06 ` Jessica Zhang
1 sibling, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:05 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Define several additional macros, capturing RGB format classes, in order
> to simplify defining particular RGB* format.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 275 +++++++++++++++++++---------------
> 1 file changed, 158 insertions(+), 117 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index 09a5bffd838b8a4fd3c22622e82dcf9fb99b5117..28cef986f2d662484afd47440a79393c48256ff5 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -66,22 +66,99 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> #define MDP_TILE_HEIGHT_UBWC 4
> #define MDP_TILE_HEIGHT_NV12 8
>
> -#define INTERLEAVED_RGB_FMT(fmt, a, r, g, b, e0, e1, e2, e3, uc, alpha, \
> -bp, flg) \
> +#define INTERLEAVED_RGB_FMT(fmt, bp, r, g, b, e0, e1, e2) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_INTERLEAVED, \
> - .alpha_enable = alpha, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), 0 }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = 0, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 3, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBA_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = true, \
> .element = { (e0), (e1), (e2), (e3) }, \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> .bpc_a = a, \
> .chroma_sample = CHROMA_FULL, \
> - .unpack_count = uc, \
> + .unpack_count = 4, \
> .bpp = bp, \
> .fetch_mode = MDP_FETCH_LINEAR, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBA_DX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = true, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_DX, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBX_DX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_DX, \
> .num_planes = 1, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
> @@ -225,185 +302,149 @@ flg, fm, np) \
> }
>
> static const struct msm_format mdp_formats[] = {
> - INTERLEAVED_RGB_FMT(ARGB8888,
> + INTERLEAVED_RGBA_FMT(ARGB8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 4, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ABGR8888,
> + INTERLEAVED_RGBA_FMT(ABGR8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XBGR8888,
> + INTERLEAVED_RGBX_FMT(XBGR8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBA8888,
> + INTERLEAVED_RGBA_FMT(RGBA8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 4, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRA8888,
> + INTERLEAVED_RGBA_FMT(BGRA8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 4, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(BGRX8888,
> + INTERLEAVED_RGBX_FMT(BGRX8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 4, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XRGB8888,
> + INTERLEAVED_RGBX_FMT(XRGB8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 4, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX8888,
> + INTERLEAVED_RGBX_FMT(RGBX8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 4, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(RGB888,
> - 0, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
> - false, 3, 0),
> + INTERLEAVED_RGB_FMT(RGB888, 3,
> + BPC8, BPC8, BPC8,
> + C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGR888,
> - 0, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 3, 0),
> + INTERLEAVED_RGB_FMT(BGR888, 3,
> + BPC8, BPC8, BPC8,
> + C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(RGB565,
> - 0, BPC5, BPC6, BPC5,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
> - false, 2, 0),
> + INTERLEAVED_RGB_FMT(RGB565, 2,
> + BPC5, BPC6, BPC5,
> + C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGR565,
> - 0, BPC5, BPC6, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 2, 0),
> + INTERLEAVED_RGB_FMT(BGR565, 2,
> + BPC5, BPC6, BPC5,
> + C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(ARGB1555,
> + INTERLEAVED_RGBA_FMT(ARGB1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ABGR1555,
> + INTERLEAVED_RGBA_FMT(ABGR1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBA5551,
> + INTERLEAVED_RGBA_FMT(RGBA5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRA5551,
> + INTERLEAVED_RGBA_FMT(BGRA5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XRGB1555,
> + INTERLEAVED_RGBX_FMT(XRGB1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XBGR1555,
> + INTERLEAVED_RGBX_FMT(XBGR1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX5551,
> + INTERLEAVED_RGBX_FMT(RGBX5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRX5551,
> + INTERLEAVED_RGBX_FMT(BGRX5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(ARGB4444,
> + INTERLEAVED_RGBA_FMT(ARGB4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ABGR4444,
> + INTERLEAVED_RGBA_FMT(ABGR4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBA4444,
> + INTERLEAVED_RGBA_FMT(RGBA4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRA4444,
> + INTERLEAVED_RGBA_FMT(BGRA4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XRGB4444,
> + INTERLEAVED_RGBX_FMT(XRGB4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XBGR4444,
> + INTERLEAVED_RGBX_FMT(XBGR4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX4444,
> + INTERLEAVED_RGBX_FMT(RGBX4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRX4444,
> + INTERLEAVED_RGBX_FMT(BGRX4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(BGRA1010102,
> + INTERLEAVED_RGBA_DX_FMT(BGRA1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(RGBA1010102,
> + INTERLEAVED_RGBA_DX_FMT(RGBA1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(ABGR2101010,
> + INTERLEAVED_RGBA_DX_FMT(ABGR2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ARGB2101010,
> + INTERLEAVED_RGBA_DX_FMT(ARGB2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XRGB2101010,
> + INTERLEAVED_RGBX_DX_FMT(XRGB2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(BGRX1010102,
> + INTERLEAVED_RGBX_DX_FMT(BGRX1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XBGR2101010,
> + INTERLEAVED_RGBX_DX_FMT(XBGR2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX1010102,
> + INTERLEAVED_RGBX_DX_FMT(RGBX1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> /* --- RGB formats above / YUV formats below this line --- */
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions
2025-07-05 2:47 ` [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions Dmitry Baryshkov
2025-09-04 23:05 ` Jessica Zhang
@ 2025-09-04 23:06 ` Jessica Zhang
1 sibling, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:06 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Define several additional macros, capturing RGB format classes, in order
> to simplify defining particular RGB* format.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 275 +++++++++++++++++++---------------
> 1 file changed, 158 insertions(+), 117 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index 09a5bffd838b8a4fd3c22622e82dcf9fb99b5117..28cef986f2d662484afd47440a79393c48256ff5 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -66,22 +66,99 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> #define MDP_TILE_HEIGHT_UBWC 4
> #define MDP_TILE_HEIGHT_NV12 8
>
> -#define INTERLEAVED_RGB_FMT(fmt, a, r, g, b, e0, e1, e2, e3, uc, alpha, \
> -bp, flg) \
> +#define INTERLEAVED_RGB_FMT(fmt, bp, r, g, b, e0, e1, e2) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_INTERLEAVED, \
> - .alpha_enable = alpha, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), 0 }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = 0, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 3, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBA_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = true, \
> .element = { (e0), (e1), (e2), (e3) }, \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> .bpc_a = a, \
> .chroma_sample = CHROMA_FULL, \
> - .unpack_count = uc, \
> + .unpack_count = 4, \
> .bpp = bp, \
> .fetch_mode = MDP_FETCH_LINEAR, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBA_DX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = true, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_DX, \
> + .num_planes = 1, \
> + .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> +}
> +
> +#define INTERLEAVED_RGBX_DX_FMT(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_DX, \
> .num_planes = 1, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
> @@ -225,185 +302,149 @@ flg, fm, np) \
> }
>
> static const struct msm_format mdp_formats[] = {
> - INTERLEAVED_RGB_FMT(ARGB8888,
> + INTERLEAVED_RGBA_FMT(ARGB8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 4, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ABGR8888,
> + INTERLEAVED_RGBA_FMT(ABGR8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XBGR8888,
> + INTERLEAVED_RGBX_FMT(XBGR8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBA8888,
> + INTERLEAVED_RGBA_FMT(RGBA8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 4, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRA8888,
> + INTERLEAVED_RGBA_FMT(BGRA8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 4, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(BGRX8888,
> + INTERLEAVED_RGBX_FMT(BGRX8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 4, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XRGB8888,
> + INTERLEAVED_RGBX_FMT(XRGB8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 4, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX8888,
> + INTERLEAVED_RGBX_FMT(RGBX8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 4, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(RGB888,
> - 0, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
> - false, 3, 0),
> + INTERLEAVED_RGB_FMT(RGB888, 3,
> + BPC8, BPC8, BPC8,
> + C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGR888,
> - 0, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 3, 0),
> + INTERLEAVED_RGB_FMT(BGR888, 3,
> + BPC8, BPC8, BPC8,
> + C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(RGB565,
> - 0, BPC5, BPC6, BPC5,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, 0, 3,
> - false, 2, 0),
> + INTERLEAVED_RGB_FMT(RGB565, 2,
> + BPC5, BPC6, BPC5,
> + C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGR565,
> - 0, BPC5, BPC6, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 2, 0),
> + INTERLEAVED_RGB_FMT(BGR565, 2,
> + BPC5, BPC6, BPC5,
> + C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(ARGB1555,
> + INTERLEAVED_RGBA_FMT(ARGB1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ABGR1555,
> + INTERLEAVED_RGBA_FMT(ABGR1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBA5551,
> + INTERLEAVED_RGBA_FMT(RGBA5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRA5551,
> + INTERLEAVED_RGBA_FMT(BGRA5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XRGB1555,
> + INTERLEAVED_RGBX_FMT(XRGB1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XBGR1555,
> + INTERLEAVED_RGBX_FMT(XBGR1555, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX5551,
> + INTERLEAVED_RGBX_FMT(RGBX5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRX5551,
> + INTERLEAVED_RGBX_FMT(BGRX5551, 2,
> BPC1A, BPC5, BPC5, BPC5,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(ARGB4444,
> + INTERLEAVED_RGBA_FMT(ARGB4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ABGR4444,
> + INTERLEAVED_RGBA_FMT(ABGR4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBA4444,
> + INTERLEAVED_RGBA_FMT(RGBA4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRA4444,
> + INTERLEAVED_RGBA_FMT(BGRA4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XRGB4444,
> + INTERLEAVED_RGBX_FMT(XRGB4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 2, 0),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XBGR4444,
> + INTERLEAVED_RGBX_FMT(XBGR4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 2, 0),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX4444,
> + INTERLEAVED_RGBX_FMT(RGBX4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 2, 0),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(BGRX4444,
> + INTERLEAVED_RGBX_FMT(BGRX4444, 2,
> BPC4A, BPC4, BPC4, BPC4,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 2, 0),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(BGRA1010102,
> + INTERLEAVED_RGBA_DX_FMT(BGRA1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(RGBA1010102,
> + INTERLEAVED_RGBA_DX_FMT(RGBA1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> - INTERLEAVED_RGB_FMT(ABGR2101010,
> + INTERLEAVED_RGBA_DX_FMT(ABGR2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(ARGB2101010,
> + INTERLEAVED_RGBA_DX_FMT(ARGB2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(XRGB2101010,
> + INTERLEAVED_RGBX_DX_FMT(XRGB2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(BGRX1010102,
> + INTERLEAVED_RGBX_DX_FMT(BGRX1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT(XBGR2101010,
> + INTERLEAVED_RGBX_DX_FMT(XBGR2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT(RGBX1010102,
> + INTERLEAVED_RGBX_DX_FMT(RGBX1010102, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr, 4,
> - false, 4, MSM_FORMAT_FLAG_DX),
> + C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr),
>
> /* --- RGB formats above / YUV formats below this line --- */
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 05/12] drm/msm/disp: simplify tiled RGB{,A,X} formats definitions
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (3 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 23:06 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 06/12] drm/msm/disp: pull in common YUV format parameters Dmitry Baryshkov
` (6 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Define several additional macros, capturing tiled RGB format classes, in
order to simplify defining particular RGB* format.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 118 ++++++++++++++++++++++++----------
1 file changed, 85 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index 28cef986f2d662484afd47440a79393c48256ff5..d577b3d53fbebced63792b5c65f50dd45211c8ea 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -163,22 +163,83 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
-#define INTERLEAVED_RGB_FMT_TILED(fmt, a, r, g, b, e0, e1, e2, e3, uc, \
-alpha, bp, flg) \
+#define INTERLEAVED_RGB_FMT_TILED(fmt, bp, r, g, b, e0, e1, e2) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_INTERLEAVED, \
- .alpha_enable = alpha, \
+ .alpha_enable = false, \
+ .element = { (e0), (e1), (e2), 0 }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = 0, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 3, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_UBWC, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_COMPRESSED, \
+ .num_planes = 2, \
+ .tile_height = MDP_TILE_HEIGHT_UBWC, \
+}
+
+#define INTERLEAVED_RGBA_FMT_TILED(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = true, \
.element = { (e0), (e1), (e2), (e3) }, \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = CHROMA_FULL, \
- .unpack_count = uc, \
+ .unpack_count = 4, \
.bpp = bp, \
.fetch_mode = MDP_FETCH_UBWC, \
- .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_COMPRESSED, \
+ .num_planes = 2, \
+ .tile_height = MDP_TILE_HEIGHT_UBWC, \
+}
+
+#define INTERLEAVED_RGBX_FMT_TILED(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = false, \
+ .element = { (e0), (e1), (e2), (e3) }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = a, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 4, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_UBWC, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_COMPRESSED, \
+ .num_planes = 2, \
+ .tile_height = MDP_TILE_HEIGHT_UBWC, \
+}
+
+#define INTERLEAVED_RGBA_DX_FMT_TILED(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
+{ \
+ .pixel_format = DRM_FORMAT_ ## fmt, \
+ .fetch_type = MDP_PLANE_INTERLEAVED, \
+ .alpha_enable = true, \
+ .element = { (e0), (e1), (e2), (e3) }, \
+ .bpc_g_y = g, \
+ .bpc_b_cb = b, \
+ .bpc_r_cr = r, \
+ .bpc_a = a, \
+ .chroma_sample = CHROMA_FULL, \
+ .unpack_count = 4, \
+ .bpp = bp, \
+ .fetch_mode = MDP_FETCH_UBWC, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_DX | \
+ MSM_FORMAT_FLAG_COMPRESSED, \
.num_planes = 2, \
.tile_height = MDP_TILE_HEIGHT_UBWC, \
}
@@ -525,58 +586,49 @@ static const struct msm_format mdp_formats[] = {
* the data will be passed by user-space.
*/
static const struct msm_format mdp_formats_ubwc[] = {
- INTERLEAVED_RGB_FMT_TILED(BGR565,
- 0, BPC5, BPC6, BPC5,
- C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
- false, 2, MSM_FORMAT_FLAG_COMPRESSED),
+ INTERLEAVED_RGB_FMT_TILED(BGR565, 2,
+ BPC5, BPC6, BPC5,
+ C2_R_Cr, C0_G_Y, C1_B_Cb),
- INTERLEAVED_RGB_FMT_TILED(ABGR8888,
+ INTERLEAVED_RGBA_FMT_TILED(ABGR8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
/* ARGB8888 and ABGR8888 purposely have the same color
* ordering. The hardware only supports ABGR8888 UBWC
* natively.
*/
- INTERLEAVED_RGB_FMT_TILED(ARGB8888,
+ INTERLEAVED_RGBA_FMT_TILED(ARGB8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT_TILED(XBGR8888,
+ INTERLEAVED_RGBX_FMT_TILED(XBGR8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT_TILED(XRGB8888,
+ INTERLEAVED_RGBX_FMT_TILED(XRGB8888, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- false, 4, MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT_TILED(ABGR2101010,
+ INTERLEAVED_RGBA_DX_FMT_TILED(ABGR2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT_TILED(XBGR2101010,
+ INTERLEAVED_RGBA_DX_FMT_TILED(XBGR2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
- INTERLEAVED_RGB_FMT_TILED(XRGB2101010,
+ INTERLEAVED_RGBA_DX_FMT_TILED(XRGB2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
/* XRGB2101010 and ARGB2101010 purposely have the same color
* ordering. The hardware only supports ARGB2101010 UBWC
* natively.
*/
- INTERLEAVED_RGB_FMT_TILED(ARGB2101010,
+ INTERLEAVED_RGBA_DX_FMT_TILED(ARGB2101010, 4,
BPC8A, BPC8, BPC8, BPC8,
- C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
- true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
+ C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
PSEUDO_YUV_FMT_TILED(NV12,
0, BPC8, BPC8, BPC8,
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 05/12] drm/msm/disp: simplify tiled RGB{,A,X} formats definitions
2025-07-05 2:47 ` [PATCH 05/12] drm/msm/disp: simplify tiled " Dmitry Baryshkov
@ 2025-09-04 23:06 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:06 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Define several additional macros, capturing tiled RGB format classes, in
> order to simplify defining particular RGB* format.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 118 ++++++++++++++++++++++++----------
> 1 file changed, 85 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index 28cef986f2d662484afd47440a79393c48256ff5..d577b3d53fbebced63792b5c65f50dd45211c8ea 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -163,22 +163,83 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> -#define INTERLEAVED_RGB_FMT_TILED(fmt, a, r, g, b, e0, e1, e2, e3, uc, \
> -alpha, bp, flg) \
> +#define INTERLEAVED_RGB_FMT_TILED(fmt, bp, r, g, b, e0, e1, e2) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_INTERLEAVED, \
> - .alpha_enable = alpha, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), 0 }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = 0, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 3, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_UBWC, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_COMPRESSED, \
> + .num_planes = 2, \
> + .tile_height = MDP_TILE_HEIGHT_UBWC, \
> +}
> +
> +#define INTERLEAVED_RGBA_FMT_TILED(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = true, \
> .element = { (e0), (e1), (e2), (e3) }, \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> .bpc_a = a, \
> .chroma_sample = CHROMA_FULL, \
> - .unpack_count = uc, \
> + .unpack_count = 4, \
> .bpp = bp, \
> .fetch_mode = MDP_FETCH_UBWC, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_COMPRESSED, \
> + .num_planes = 2, \
> + .tile_height = MDP_TILE_HEIGHT_UBWC, \
> +}
> +
> +#define INTERLEAVED_RGBX_FMT_TILED(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = false, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_UBWC, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_COMPRESSED, \
> + .num_planes = 2, \
> + .tile_height = MDP_TILE_HEIGHT_UBWC, \
> +}
> +
> +#define INTERLEAVED_RGBA_DX_FMT_TILED(fmt, bp, a, r, g, b, e0, e1, e2, e3) \
> +{ \
> + .pixel_format = DRM_FORMAT_ ## fmt, \
> + .fetch_type = MDP_PLANE_INTERLEAVED, \
> + .alpha_enable = true, \
> + .element = { (e0), (e1), (e2), (e3) }, \
> + .bpc_g_y = g, \
> + .bpc_b_cb = b, \
> + .bpc_r_cr = r, \
> + .bpc_a = a, \
> + .chroma_sample = CHROMA_FULL, \
> + .unpack_count = 4, \
> + .bpp = bp, \
> + .fetch_mode = MDP_FETCH_UBWC, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_DX | \
> + MSM_FORMAT_FLAG_COMPRESSED, \
> .num_planes = 2, \
> .tile_height = MDP_TILE_HEIGHT_UBWC, \
> }
> @@ -525,58 +586,49 @@ static const struct msm_format mdp_formats[] = {
> * the data will be passed by user-space.
> */
> static const struct msm_format mdp_formats_ubwc[] = {
> - INTERLEAVED_RGB_FMT_TILED(BGR565,
> - 0, BPC5, BPC6, BPC5,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, 0, 3,
> - false, 2, MSM_FORMAT_FLAG_COMPRESSED),
> + INTERLEAVED_RGB_FMT_TILED(BGR565, 2,
> + BPC5, BPC6, BPC5,
> + C2_R_Cr, C0_G_Y, C1_B_Cb),
>
> - INTERLEAVED_RGB_FMT_TILED(ABGR8888,
> + INTERLEAVED_RGBA_FMT_TILED(ABGR8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> /* ARGB8888 and ABGR8888 purposely have the same color
> * ordering. The hardware only supports ABGR8888 UBWC
> * natively.
> */
> - INTERLEAVED_RGB_FMT_TILED(ARGB8888,
> + INTERLEAVED_RGBA_FMT_TILED(ARGB8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT_TILED(XBGR8888,
> + INTERLEAVED_RGBX_FMT_TILED(XBGR8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT_TILED(XRGB8888,
> + INTERLEAVED_RGBX_FMT_TILED(XRGB8888, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - false, 4, MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT_TILED(ABGR2101010,
> + INTERLEAVED_RGBA_DX_FMT_TILED(ABGR2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT_TILED(XBGR2101010,
> + INTERLEAVED_RGBA_DX_FMT_TILED(XBGR2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> - INTERLEAVED_RGB_FMT_TILED(XRGB2101010,
> + INTERLEAVED_RGBA_DX_FMT_TILED(XRGB2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> /* XRGB2101010 and ARGB2101010 purposely have the same color
> * ordering. The hardware only supports ARGB2101010 UBWC
> * natively.
> */
> - INTERLEAVED_RGB_FMT_TILED(ARGB2101010,
> + INTERLEAVED_RGBA_DX_FMT_TILED(ARGB2101010, 4,
> BPC8A, BPC8, BPC8, BPC8,
> - C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
> - true, 4, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_COMPRESSED),
> + C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> PSEUDO_YUV_FMT_TILED(NV12,
> 0, BPC8, BPC8, BPC8,
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 06/12] drm/msm/disp: pull in common YUV format parameters
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (4 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 05/12] drm/msm/disp: simplify tiled " Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 23:07 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 07/12] drm/msm/disp: pull in common tiled " Dmitry Baryshkov
` (5 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Pull common params of YUV formats into corresponding macro definitions,
simplifying format table.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 120 ++++++++++++++++------------------
1 file changed, 56 insertions(+), 64 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index d577b3d53fbebced63792b5c65f50dd45211c8ea..900b2de252a6eb2eac3d0670f1aaa77f7520fd77 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -244,27 +244,27 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
.tile_height = MDP_TILE_HEIGHT_UBWC, \
}
-#define INTERLEAVED_YUV_FMT(fmt, a, r, g, b, e0, e1, e2, e3, \
-alpha, chroma, count, bp, flg, fm, np) \
+#define INTERLEAVED_YUV_FMT(fmt, bp, r, g, b, e0, e1, e2, e3, chroma) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_INTERLEAVED, \
- .alpha_enable = alpha, \
+ .alpha_enable = false, \
.element = { (e0), (e1), (e2), (e3)}, \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
- .bpc_a = a, \
+ .bpc_a = 0, \
.chroma_sample = chroma, \
- .unpack_count = count, \
+ .unpack_count = 4, \
.bpp = bp, \
- .fetch_mode = fm, \
- .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
- .num_planes = np, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_YUV, \
+ .num_planes = 1, \
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
-#define PSEUDO_YUV_FMT(fmt, a, r, g, b, e0, e1, chroma, flg, fm, np) \
+#define PSEUDO_YUV_FMT(fmt, r, g, b, e0, e1, chroma) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
@@ -273,13 +273,14 @@ alpha, chroma, count, bp, flg, fm, np) \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
- .bpc_a = a, \
+ .bpc_a = 0, \
.chroma_sample = chroma, \
.unpack_count = 2, \
.bpp = 2, \
- .fetch_mode = fm, \
- .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
- .num_planes = np, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_YUV, \
+ .num_planes = 2, \
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
@@ -303,7 +304,7 @@ flg, fm, np, th) \
.tile_height = th \
}
-#define PSEUDO_YUV_FMT_LOOSE(fmt, a, r, g, b, e0, e1, chroma, flg, fm, np)\
+#define PSEUDO_YUV_FMT_LOOSE(fmt, r, g, b, e0, e1, chroma) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
@@ -312,13 +313,15 @@ flg, fm, np, th) \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
- .bpc_a = a, \
+ .bpc_a = 0, \
.chroma_sample = chroma, \
.unpack_count = 2, \
.bpp = 2, \
- .fetch_mode = fm, \
- .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
- .num_planes = np, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | \
+ MSM_FORMAT_FLAG_DX | \
+ MSM_FORMAT_FLAG_YUV, \
+ .num_planes = 2, \
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
@@ -342,23 +345,23 @@ flg, fm, np, th) \
.tile_height = th \
}
-#define PLANAR_YUV_FMT(fmt, a, r, g, b, e0, e1, e2, alpha, chroma, bp, \
-flg, fm, np) \
+#define PLANAR_YUV_FMT(fmt, bp, r, g, b, e0, e1, e2, chroma) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_PLANAR, \
- .alpha_enable = alpha, \
+ .alpha_enable = false, \
.element = { (e0), (e1), (e2), 0 }, \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
- .bpc_a = a, \
+ .bpc_a = 0, \
.chroma_sample = chroma, \
.unpack_count = 1, \
.bpp = bp, \
- .fetch_mode = fm, \
- .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
- .num_planes = np, \
+ .fetch_mode = MDP_FETCH_LINEAR, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_YUV, \
+ .num_planes = 3, \
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
@@ -511,72 +514,61 @@ static const struct msm_format mdp_formats[] = {
/* 2 plane YUV */
PSEUDO_YUV_FMT(NV12,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C2_R_Cr,
- CHROMA_420, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ CHROMA_420),
PSEUDO_YUV_FMT(NV21,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C2_R_Cr, C1_B_Cb,
- CHROMA_420, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ CHROMA_420),
PSEUDO_YUV_FMT(NV16,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C2_R_Cr,
- CHROMA_H2V1, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ CHROMA_H2V1),
PSEUDO_YUV_FMT(NV61,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C2_R_Cr, C1_B_Cb,
- CHROMA_H2V1, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ CHROMA_H2V1),
PSEUDO_YUV_FMT_LOOSE(P010,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C2_R_Cr,
- CHROMA_420, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 2),
+ CHROMA_420),
/* 1 plane YUV */
- INTERLEAVED_YUV_FMT(VYUY,
- 0, BPC8, BPC8, BPC8,
+ INTERLEAVED_YUV_FMT(VYUY, 2,
+ BPC8, BPC8, BPC8,
C2_R_Cr, C0_G_Y, C1_B_Cb, C0_G_Y,
- false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 1),
+ CHROMA_H2V1),
- INTERLEAVED_YUV_FMT(UYVY,
- 0, BPC8, BPC8, BPC8,
+ INTERLEAVED_YUV_FMT(UYVY, 2,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C0_G_Y, C2_R_Cr, C0_G_Y,
- false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 1),
+ CHROMA_H2V1),
- INTERLEAVED_YUV_FMT(YUYV,
- 0, BPC8, BPC8, BPC8,
+ INTERLEAVED_YUV_FMT(YUYV, 2,
+ BPC8, BPC8, BPC8,
C0_G_Y, C1_B_Cb, C0_G_Y, C2_R_Cr,
- false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 1),
+ CHROMA_H2V1),
- INTERLEAVED_YUV_FMT(YVYU,
- 0, BPC8, BPC8, BPC8,
+ INTERLEAVED_YUV_FMT(YVYU, 2,
+ BPC8, BPC8, BPC8,
C0_G_Y, C2_R_Cr, C0_G_Y, C1_B_Cb,
- false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 1),
+ CHROMA_H2V1),
/* 3 plane YUV */
- PLANAR_YUV_FMT(YUV420,
- 0, BPC8, BPC8, BPC8,
+ PLANAR_YUV_FMT(YUV420, 1,
+ BPC8, BPC8, BPC8,
C2_R_Cr, C1_B_Cb, C0_G_Y,
- false, CHROMA_420, 1, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 3),
+ CHROMA_420),
- PLANAR_YUV_FMT(YVU420,
- 0, BPC8, BPC8, BPC8,
+ PLANAR_YUV_FMT(YVU420, 1,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C2_R_Cr, C0_G_Y,
- false, CHROMA_420, 1, MSM_FORMAT_FLAG_YUV,
- MDP_FETCH_LINEAR, 3),
+ CHROMA_420),
};
/*
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 06/12] drm/msm/disp: pull in common YUV format parameters
2025-07-05 2:47 ` [PATCH 06/12] drm/msm/disp: pull in common YUV format parameters Dmitry Baryshkov
@ 2025-09-04 23:07 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:07 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Pull common params of YUV formats into corresponding macro definitions,
> simplifying format table.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 120 ++++++++++++++++------------------
> 1 file changed, 56 insertions(+), 64 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index d577b3d53fbebced63792b5c65f50dd45211c8ea..900b2de252a6eb2eac3d0670f1aaa77f7520fd77 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -244,27 +244,27 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> .tile_height = MDP_TILE_HEIGHT_UBWC, \
> }
>
> -#define INTERLEAVED_YUV_FMT(fmt, a, r, g, b, e0, e1, e2, e3, \
> -alpha, chroma, count, bp, flg, fm, np) \
> +#define INTERLEAVED_YUV_FMT(fmt, bp, r, g, b, e0, e1, e2, e3, chroma) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_INTERLEAVED, \
> - .alpha_enable = alpha, \
> + .alpha_enable = false, \
> .element = { (e0), (e1), (e2), (e3)}, \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> - .bpc_a = a, \
> + .bpc_a = 0, \
> .chroma_sample = chroma, \
> - .unpack_count = count, \
> + .unpack_count = 4, \
> .bpp = bp, \
> - .fetch_mode = fm, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> - .num_planes = np, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_YUV, \
> + .num_planes = 1, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> -#define PSEUDO_YUV_FMT(fmt, a, r, g, b, e0, e1, chroma, flg, fm, np) \
> +#define PSEUDO_YUV_FMT(fmt, r, g, b, e0, e1, chroma) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
> @@ -273,13 +273,14 @@ alpha, chroma, count, bp, flg, fm, np) \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> - .bpc_a = a, \
> + .bpc_a = 0, \
> .chroma_sample = chroma, \
> .unpack_count = 2, \
> .bpp = 2, \
> - .fetch_mode = fm, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> - .num_planes = np, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_YUV, \
> + .num_planes = 2, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> @@ -303,7 +304,7 @@ flg, fm, np, th) \
> .tile_height = th \
> }
>
> -#define PSEUDO_YUV_FMT_LOOSE(fmt, a, r, g, b, e0, e1, chroma, flg, fm, np)\
> +#define PSEUDO_YUV_FMT_LOOSE(fmt, r, g, b, e0, e1, chroma) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
> @@ -312,13 +313,15 @@ flg, fm, np, th) \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> - .bpc_a = a, \
> + .bpc_a = 0, \
> .chroma_sample = chroma, \
> .unpack_count = 2, \
> .bpp = 2, \
> - .fetch_mode = fm, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
> - .num_planes = np, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | \
> + MSM_FORMAT_FLAG_DX | \
> + MSM_FORMAT_FLAG_YUV, \
> + .num_planes = 2, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> @@ -342,23 +345,23 @@ flg, fm, np, th) \
> .tile_height = th \
> }
>
> -#define PLANAR_YUV_FMT(fmt, a, r, g, b, e0, e1, e2, alpha, chroma, bp, \
> -flg, fm, np) \
> +#define PLANAR_YUV_FMT(fmt, bp, r, g, b, e0, e1, e2, chroma) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_PLANAR, \
> - .alpha_enable = alpha, \
> + .alpha_enable = false, \
> .element = { (e0), (e1), (e2), 0 }, \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> - .bpc_a = a, \
> + .bpc_a = 0, \
> .chroma_sample = chroma, \
> .unpack_count = 1, \
> .bpp = bp, \
> - .fetch_mode = fm, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> - .num_planes = np, \
> + .fetch_mode = MDP_FETCH_LINEAR, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_YUV, \
> + .num_planes = 3, \
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> @@ -511,72 +514,61 @@ static const struct msm_format mdp_formats[] = {
>
> /* 2 plane YUV */
> PSEUDO_YUV_FMT(NV12,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C2_R_Cr,
> - CHROMA_420, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + CHROMA_420),
>
> PSEUDO_YUV_FMT(NV21,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C2_R_Cr, C1_B_Cb,
> - CHROMA_420, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + CHROMA_420),
>
> PSEUDO_YUV_FMT(NV16,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C2_R_Cr,
> - CHROMA_H2V1, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + CHROMA_H2V1),
>
> PSEUDO_YUV_FMT(NV61,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C2_R_Cr, C1_B_Cb,
> - CHROMA_H2V1, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + CHROMA_H2V1),
>
> PSEUDO_YUV_FMT_LOOSE(P010,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C2_R_Cr,
> - CHROMA_420, MSM_FORMAT_FLAG_DX | MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 2),
> + CHROMA_420),
>
> /* 1 plane YUV */
> - INTERLEAVED_YUV_FMT(VYUY,
> - 0, BPC8, BPC8, BPC8,
> + INTERLEAVED_YUV_FMT(VYUY, 2,
> + BPC8, BPC8, BPC8,
> C2_R_Cr, C0_G_Y, C1_B_Cb, C0_G_Y,
> - false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 1),
> + CHROMA_H2V1),
>
> - INTERLEAVED_YUV_FMT(UYVY,
> - 0, BPC8, BPC8, BPC8,
> + INTERLEAVED_YUV_FMT(UYVY, 2,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C0_G_Y, C2_R_Cr, C0_G_Y,
> - false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 1),
> + CHROMA_H2V1),
>
> - INTERLEAVED_YUV_FMT(YUYV,
> - 0, BPC8, BPC8, BPC8,
> + INTERLEAVED_YUV_FMT(YUYV, 2,
> + BPC8, BPC8, BPC8,
> C0_G_Y, C1_B_Cb, C0_G_Y, C2_R_Cr,
> - false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 1),
> + CHROMA_H2V1),
>
> - INTERLEAVED_YUV_FMT(YVYU,
> - 0, BPC8, BPC8, BPC8,
> + INTERLEAVED_YUV_FMT(YVYU, 2,
> + BPC8, BPC8, BPC8,
> C0_G_Y, C2_R_Cr, C0_G_Y, C1_B_Cb,
> - false, CHROMA_H2V1, 4, 2, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 1),
> + CHROMA_H2V1),
>
> /* 3 plane YUV */
> - PLANAR_YUV_FMT(YUV420,
> - 0, BPC8, BPC8, BPC8,
> + PLANAR_YUV_FMT(YUV420, 1,
> + BPC8, BPC8, BPC8,
> C2_R_Cr, C1_B_Cb, C0_G_Y,
> - false, CHROMA_420, 1, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 3),
> + CHROMA_420),
>
> - PLANAR_YUV_FMT(YVU420,
> - 0, BPC8, BPC8, BPC8,
> + PLANAR_YUV_FMT(YVU420, 1,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C2_R_Cr, C0_G_Y,
> - false, CHROMA_420, 1, MSM_FORMAT_FLAG_YUV,
> - MDP_FETCH_LINEAR, 3),
> + CHROMA_420),
> };
>
> /*
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 07/12] drm/msm/disp: pull in common tiled YUV format parameters
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (5 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 06/12] drm/msm/disp: pull in common YUV format parameters Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 22:22 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 08/12] drm/msm/disp: drop PSEUDO_YUV_FMT_LOOSE_TILED Dmitry Baryshkov
` (4 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Pull common params of tiled YUV formats into corresponding macro
definitions, simplifying format table.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index 900b2de252a6eb2eac3d0670f1aaa77f7520fd77..6f5af26d4e2d43414281197bf541e1ea3fe211f5 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -284,8 +284,7 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
-#define PSEUDO_YUV_FMT_TILED(fmt, a, r, g, b, e0, e1, chroma, \
-flg, fm, np, th) \
+#define PSEUDO_YUV_FMT_TILED(fmt, r, g, b, e0, e1, chroma, flg, th) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
.fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
@@ -294,13 +293,15 @@ flg, fm, np, th) \
.bpc_g_y = g, \
.bpc_b_cb = b, \
.bpc_r_cr = r, \
- .bpc_a = a, \
+ .bpc_a = 0, \
.chroma_sample = chroma, \
.unpack_count = 2, \
.bpp = 2, \
- .fetch_mode = fm, \
- .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
- .num_planes = np, \
+ .fetch_mode = MDP_FETCH_UBWC, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
+ MSM_FORMAT_FLAG_DX | \
+ MSM_FORMAT_FLAG_COMPRESSED | flg, \
+ .num_planes = 4, \
.tile_height = th \
}
@@ -623,19 +624,16 @@ static const struct msm_format mdp_formats_ubwc[] = {
C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
PSEUDO_YUV_FMT_TILED(NV12,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C2_R_Cr,
- CHROMA_420, MSM_FORMAT_FLAG_YUV |
- MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 4, MDP_TILE_HEIGHT_NV12),
+ CHROMA_420, 0,
+ MDP_TILE_HEIGHT_NV12),
PSEUDO_YUV_FMT_TILED(P010,
- 0, BPC8, BPC8, BPC8,
+ BPC8, BPC8, BPC8,
C1_B_Cb, C2_R_Cr,
- CHROMA_420, MSM_FORMAT_FLAG_DX |
- MSM_FORMAT_FLAG_YUV |
- MSM_FORMAT_FLAG_COMPRESSED,
- MDP_FETCH_UBWC, 4, MDP_TILE_HEIGHT_UBWC),
+ CHROMA_420, MSM_FORMAT_FLAG_DX,
+ MDP_TILE_HEIGHT_UBWC),
};
const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format,
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 07/12] drm/msm/disp: pull in common tiled YUV format parameters
2025-07-05 2:47 ` [PATCH 07/12] drm/msm/disp: pull in common tiled " Dmitry Baryshkov
@ 2025-09-04 22:22 ` Jessica Zhang
2025-09-04 22:37 ` Dmitry Baryshkov
0 siblings, 1 reply; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 22:22 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Pull common params of tiled YUV formats into corresponding macro
> definitions, simplifying format table.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 28 +++++++++++++---------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index 900b2de252a6eb2eac3d0670f1aaa77f7520fd77..6f5af26d4e2d43414281197bf541e1ea3fe211f5 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -284,8 +284,7 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> -#define PSEUDO_YUV_FMT_TILED(fmt, a, r, g, b, e0, e1, chroma, \
> -flg, fm, np, th) \
> +#define PSEUDO_YUV_FMT_TILED(fmt, r, g, b, e0, e1, chroma, flg, th) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
> .fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
> @@ -294,13 +293,15 @@ flg, fm, np, th) \
> .bpc_g_y = g, \
> .bpc_b_cb = b, \
> .bpc_r_cr = r, \
> - .bpc_a = a, \
> + .bpc_a = 0, \
> .chroma_sample = chroma, \
> .unpack_count = 2, \
> .bpp = 2, \
> - .fetch_mode = fm, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> - .num_planes = np, \
> + .fetch_mode = MDP_FETCH_UBWC, \
> + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> + MSM_FORMAT_FLAG_DX | \
Hi Dmitry,
This sets the DX flag for NV12 when it previously wasn't being set. Did
you mean for it to be that way?
Thanks,
Jessica Zhang
> + MSM_FORMAT_FLAG_COMPRESSED | flg, \
> + .num_planes = 4, \
> .tile_height = th \
> }
>
> @@ -623,19 +624,16 @@ static const struct msm_format mdp_formats_ubwc[] = {
> C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
>
> PSEUDO_YUV_FMT_TILED(NV12,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C2_R_Cr,
> - CHROMA_420, MSM_FORMAT_FLAG_YUV |
> - MSM_FORMAT_FLAG_COMPRESSED,
> - MDP_FETCH_UBWC, 4, MDP_TILE_HEIGHT_NV12),
> + CHROMA_420, 0,
> + MDP_TILE_HEIGHT_NV12),
>
> PSEUDO_YUV_FMT_TILED(P010,
> - 0, BPC8, BPC8, BPC8,
> + BPC8, BPC8, BPC8,
> C1_B_Cb, C2_R_Cr,
> - CHROMA_420, MSM_FORMAT_FLAG_DX |
> - MSM_FORMAT_FLAG_YUV |
> - MSM_FORMAT_FLAG_COMPRESSED,
> - MDP_FETCH_UBWC, 4, MDP_TILE_HEIGHT_UBWC),
> + CHROMA_420, MSM_FORMAT_FLAG_DX,
> + MDP_TILE_HEIGHT_UBWC),
> };
>
> const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format,
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 07/12] drm/msm/disp: pull in common tiled YUV format parameters
2025-09-04 22:22 ` Jessica Zhang
@ 2025-09-04 22:37 ` Dmitry Baryshkov
0 siblings, 0 replies; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-09-04 22:37 UTC (permalink / raw)
To: Jessica Zhang
Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Sean Paul,
Marijn Suijten, David Airlie, Simona Vetter, Jordan Crouse,
linux-arm-msm, dri-devel, freedreno, linux-kernel
On Thu, Sep 04, 2025 at 03:22:55PM -0700, Jessica Zhang wrote:
>
>
> On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> > Pull common params of tiled YUV formats into corresponding macro
> > definitions, simplifying format table.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > ---
> > drivers/gpu/drm/msm/disp/mdp_format.c | 28 +++++++++++++---------------
> > 1 file changed, 13 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> > index 900b2de252a6eb2eac3d0670f1aaa77f7520fd77..6f5af26d4e2d43414281197bf541e1ea3fe211f5 100644
> > --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> > +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> > @@ -284,8 +284,7 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> > .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> > }
> > -#define PSEUDO_YUV_FMT_TILED(fmt, a, r, g, b, e0, e1, chroma, \
> > -flg, fm, np, th) \
> > +#define PSEUDO_YUV_FMT_TILED(fmt, r, g, b, e0, e1, chroma, flg, th) \
> > { \
> > .pixel_format = DRM_FORMAT_ ## fmt, \
> > .fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
> > @@ -294,13 +293,15 @@ flg, fm, np, th) \
> > .bpc_g_y = g, \
> > .bpc_b_cb = b, \
> > .bpc_r_cr = r, \
> > - .bpc_a = a, \
> > + .bpc_a = 0, \
> > .chroma_sample = chroma, \
> > .unpack_count = 2, \
> > .bpp = 2, \
> > - .fetch_mode = fm, \
> > - .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg, \
> > - .num_planes = np, \
> > + .fetch_mode = MDP_FETCH_UBWC, \
> > + .flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | \
> > + MSM_FORMAT_FLAG_DX | \
>
> Hi Dmitry,
>
> This sets the DX flag for NV12 when it previously wasn't being set. Did you
> mean for it to be that way?
No :-(
>
> Thanks,
>
> Jessica Zhang
>
> > + MSM_FORMAT_FLAG_COMPRESSED | flg, \
> > + .num_planes = 4, \
> > .tile_height = th \
> > }
> > @@ -623,19 +624,16 @@ static const struct msm_format mdp_formats_ubwc[] = {
> > C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA),
> > PSEUDO_YUV_FMT_TILED(NV12,
> > - 0, BPC8, BPC8, BPC8,
> > + BPC8, BPC8, BPC8,
> > C1_B_Cb, C2_R_Cr,
> > - CHROMA_420, MSM_FORMAT_FLAG_YUV |
> > - MSM_FORMAT_FLAG_COMPRESSED,
> > - MDP_FETCH_UBWC, 4, MDP_TILE_HEIGHT_NV12),
> > + CHROMA_420, 0,
> > + MDP_TILE_HEIGHT_NV12),
> > PSEUDO_YUV_FMT_TILED(P010,
> > - 0, BPC8, BPC8, BPC8,
> > + BPC8, BPC8, BPC8,
> > C1_B_Cb, C2_R_Cr,
> > - CHROMA_420, MSM_FORMAT_FLAG_DX |
> > - MSM_FORMAT_FLAG_YUV |
> > - MSM_FORMAT_FLAG_COMPRESSED,
> > - MDP_FETCH_UBWC, 4, MDP_TILE_HEIGHT_UBWC),
> > + CHROMA_420, MSM_FORMAT_FLAG_DX,
> > + MDP_TILE_HEIGHT_UBWC),
> > };
> > const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format,
> >
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 08/12] drm/msm/disp: drop PSEUDO_YUV_FMT_LOOSE_TILED
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (6 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 07/12] drm/msm/disp: pull in common tiled " Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 23:04 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_* Dmitry Baryshkov
` (3 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Drop PSEUDO_YUV_FMT_LOOSE_TILED(), the macro is unused.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/mdp_format.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
index 6f5af26d4e2d43414281197bf541e1ea3fe211f5..f949810567d83c5924f9dd127261e7d523921724 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.c
+++ b/drivers/gpu/drm/msm/disp/mdp_format.c
@@ -326,26 +326,6 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
.tile_height = MDP_TILE_HEIGHT_DEFAULT \
}
-#define PSEUDO_YUV_FMT_LOOSE_TILED(fmt, a, r, g, b, e0, e1, chroma, \
-flg, fm, np, th) \
-{ \
- .pixel_format = DRM_FORMAT_ ## fmt, \
- .fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
- .alpha_enable = 0, \
- .element = { (e0), (e1), 0, 0 }, \
- .bpc_g_y = g, \
- .bpc_b_cb = b, \
- .bpc_r_cr = r, \
- .bpc_a = a, \
- .chroma_sample = chroma, \
- .unpack_count = 2, \
- .bpp = 2, \
- .fetch_mode = fm, \
- .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
- .num_planes = np, \
- .tile_height = th \
-}
-
#define PLANAR_YUV_FMT(fmt, bp, r, g, b, e0, e1, e2, chroma) \
{ \
.pixel_format = DRM_FORMAT_ ## fmt, \
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 08/12] drm/msm/disp: drop PSEUDO_YUV_FMT_LOOSE_TILED
2025-07-05 2:47 ` [PATCH 08/12] drm/msm/disp: drop PSEUDO_YUV_FMT_LOOSE_TILED Dmitry Baryshkov
@ 2025-09-04 23:04 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:04 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Drop PSEUDO_YUV_FMT_LOOSE_TILED(), the macro is unused.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/mdp_format.c | 20 --------------------
> 1 file changed, 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp_format.c b/drivers/gpu/drm/msm/disp/mdp_format.c
> index 6f5af26d4e2d43414281197bf541e1ea3fe211f5..f949810567d83c5924f9dd127261e7d523921724 100644
> --- a/drivers/gpu/drm/msm/disp/mdp_format.c
> +++ b/drivers/gpu/drm/msm/disp/mdp_format.c
> @@ -326,26 +326,6 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
> .tile_height = MDP_TILE_HEIGHT_DEFAULT \
> }
>
> -#define PSEUDO_YUV_FMT_LOOSE_TILED(fmt, a, r, g, b, e0, e1, chroma, \
> -flg, fm, np, th) \
> -{ \
> - .pixel_format = DRM_FORMAT_ ## fmt, \
> - .fetch_type = MDP_PLANE_PSEUDO_PLANAR, \
> - .alpha_enable = 0, \
> - .element = { (e0), (e1), 0, 0 }, \
> - .bpc_g_y = g, \
> - .bpc_b_cb = b, \
> - .bpc_r_cr = r, \
> - .bpc_a = a, \
> - .chroma_sample = chroma, \
> - .unpack_count = 2, \
> - .bpp = 2, \
> - .fetch_mode = fm, \
> - .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
> - .num_planes = np, \
> - .tile_height = th \
> -}
> -
> #define PLANAR_YUV_FMT(fmt, bp, r, g, b, e0, e1, e2, chroma) \
> { \
> .pixel_format = DRM_FORMAT_ ## fmt, \
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_*
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (7 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 08/12] drm/msm/disp: drop PSEUDO_YUV_FMT_LOOSE_TILED Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 23:19 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 10/12] drm/msm/dpu: drop redundant num_planes assignment in _dpu_format_populate_plane_sizes*() Dmitry Baryshkov
` (2 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Move common bits of _dpu_format_populate_plane_sizes_ubwc() and
_linear() to dpu_format_populate_plane_sizes(), reducing unnecessary
duplication and simplifying code flow fror the UBWC function.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 41 +++++++++++++----------------
1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 59c9427da7dda07b8e8ee3d070d2dfb3c165698e..195a6b7c4075eef40e7a5d0fee208168421cee35 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -95,15 +95,9 @@ static int _dpu_format_populate_plane_sizes_ubwc(
struct drm_framebuffer *fb,
struct dpu_hw_fmt_layout *layout)
{
- int i;
int color;
bool meta = MSM_FORMAT_IS_UBWC(fmt);
- memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
- layout->width = fb->width;
- layout->height = fb->height;
- layout->num_planes = fmt->num_planes;
-
color = _dpu_format_get_media_color_ubwc(fmt);
if (color < 0) {
DRM_ERROR("UBWC format not supported for fmt: %p4cc\n",
@@ -128,7 +122,7 @@ static int _dpu_format_populate_plane_sizes_ubwc(
uv_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
if (!meta)
- goto done;
+ return 0;
layout->num_planes += 2;
layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width);
@@ -152,7 +146,8 @@ static int _dpu_format_populate_plane_sizes_ubwc(
rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
if (!meta)
- goto done;
+ return 0;
+
layout->num_planes += 2;
layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width);
rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height);
@@ -160,10 +155,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
}
-done:
- for (i = 0; i < DPU_MAX_PLANES; i++)
- layout->total_size += layout->plane_size[i];
-
return 0;
}
@@ -174,11 +165,6 @@ static int _dpu_format_populate_plane_sizes_linear(
{
int i;
- memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
- layout->width = fb->width;
- layout->height = fb->height;
- layout->num_planes = fmt->num_planes;
-
/* Due to memset above, only need to set planes of interest */
if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) {
layout->num_planes = 1;
@@ -235,9 +221,6 @@ static int _dpu_format_populate_plane_sizes_linear(
}
}
- for (i = 0; i < DPU_MAX_PLANES; i++)
- layout->total_size += layout->plane_size[i];
-
return 0;
}
@@ -254,6 +237,7 @@ int dpu_format_populate_plane_sizes(
struct dpu_hw_fmt_layout *layout)
{
const struct msm_format *fmt;
+ int ret, i;
if (!layout || !fb) {
DRM_ERROR("invalid pointer\n");
@@ -268,10 +252,23 @@ int dpu_format_populate_plane_sizes(
fmt = msm_framebuffer_format(fb);
+ memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
+ layout->width = fb->width;
+ layout->height = fb->height;
+ layout->num_planes = fmt->num_planes;
+
if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt))
- return _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
+ ret = _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
+ else
+ ret = _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
- return _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < DPU_MAX_PLANES; i++)
+ layout->total_size += layout->plane_size[i];
+
+ return 0;
}
static void _dpu_format_populate_addrs_ubwc(struct msm_gem_address_space *aspace,
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_*
2025-07-05 2:47 ` [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_* Dmitry Baryshkov
@ 2025-09-04 23:19 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:19 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Move common bits of _dpu_format_populate_plane_sizes_ubwc() and
> _linear() to dpu_format_populate_plane_sizes(), reducing unnecessary
> duplication and simplifying code flow fror the UBWC function.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 41 +++++++++++++----------------
> 1 file changed, 19 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> index 59c9427da7dda07b8e8ee3d070d2dfb3c165698e..195a6b7c4075eef40e7a5d0fee208168421cee35 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> @@ -95,15 +95,9 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> struct drm_framebuffer *fb,
> struct dpu_hw_fmt_layout *layout)
> {
> - int i;
> int color;
> bool meta = MSM_FORMAT_IS_UBWC(fmt);
>
> - memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
> - layout->width = fb->width;
> - layout->height = fb->height;
> - layout->num_planes = fmt->num_planes;
> -
> color = _dpu_format_get_media_color_ubwc(fmt);
> if (color < 0) {
> DRM_ERROR("UBWC format not supported for fmt: %p4cc\n",
> @@ -128,7 +122,7 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> uv_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> if (!meta)
> - goto done;
> + return 0;
>
> layout->num_planes += 2;
> layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width);
> @@ -152,7 +146,8 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> if (!meta)
> - goto done;
> + return 0;
> +
> layout->num_planes += 2;
> layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width);
> rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height);
> @@ -160,10 +155,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> }
>
> -done:
> - for (i = 0; i < DPU_MAX_PLANES; i++)
> - layout->total_size += layout->plane_size[i];
> -
> return 0;
> }
>
> @@ -174,11 +165,6 @@ static int _dpu_format_populate_plane_sizes_linear(
> {
> int i;
>
> - memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
> - layout->width = fb->width;
> - layout->height = fb->height;
> - layout->num_planes = fmt->num_planes;
> -
> /* Due to memset above, only need to set planes of interest */
> if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) {
> layout->num_planes = 1;
> @@ -235,9 +221,6 @@ static int _dpu_format_populate_plane_sizes_linear(
> }
> }
>
> - for (i = 0; i < DPU_MAX_PLANES; i++)
> - layout->total_size += layout->plane_size[i];
> -
> return 0;
> }
>
> @@ -254,6 +237,7 @@ int dpu_format_populate_plane_sizes(
> struct dpu_hw_fmt_layout *layout)
> {
> const struct msm_format *fmt;
> + int ret, i;
>
> if (!layout || !fb) {
> DRM_ERROR("invalid pointer\n");
> @@ -268,10 +252,23 @@ int dpu_format_populate_plane_sizes(
>
> fmt = msm_framebuffer_format(fb);
>
> + memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
> + layout->width = fb->width;
> + layout->height = fb->height;
> + layout->num_planes = fmt->num_planes;
> +
> if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt))
> - return _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
> + ret = _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
> + else
> + ret = _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
>
> - return _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < DPU_MAX_PLANES; i++)
> + layout->total_size += layout->plane_size[i];
> +
> + return 0;
> }
>
> static void _dpu_format_populate_addrs_ubwc(struct msm_gem_address_space *aspace,
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 10/12] drm/msm/dpu: drop redundant num_planes assignment in _dpu_format_populate_plane_sizes*()
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (8 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_* Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 23:19 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Drop redundant layout->num_planes assignments, using the value assigned
from the formats table. RGB UBWC formats need special handling: they use
two planes (per the format table), but the uAPI defines plane[1] as
empty.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 195a6b7c4075eef40e7a5d0fee208168421cee35..e1fb7fd3b0b97a38880bc80aec26003d65a3a310 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -110,7 +110,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
uint32_t y_meta_scanlines = 0;
uint32_t uv_meta_scanlines = 0;
- layout->num_planes = 2;
layout->plane_pitch[0] = VENUS_Y_STRIDE(color, fb->width);
y_sclines = VENUS_Y_SCANLINES(color, fb->height);
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
@@ -124,7 +123,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
if (!meta)
return 0;
- layout->num_planes += 2;
layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width);
y_meta_scanlines = VENUS_Y_META_SCANLINES(color, fb->height);
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
@@ -138,8 +136,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
} else {
uint32_t rgb_scanlines, rgb_meta_scanlines;
- layout->num_planes = 1;
-
layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, fb->width);
rgb_scanlines = VENUS_RGB_SCANLINES(color, fb->height);
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
@@ -148,7 +144,9 @@ static int _dpu_format_populate_plane_sizes_ubwc(
if (!meta)
return 0;
- layout->num_planes += 2;
+ /* uAPI leaves plane[1] empty and plane[2] as meta */
+ layout->num_planes += 1;
+
layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width);
rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height);
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
@@ -167,7 +165,6 @@ static int _dpu_format_populate_plane_sizes_linear(
/* Due to memset above, only need to set planes of interest */
if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) {
- layout->num_planes = 1;
layout->plane_size[0] = fb->width * fb->height * fmt->bpp;
layout->plane_pitch[0] = fb->width * fmt->bpp;
} else {
@@ -194,12 +191,10 @@ static int _dpu_format_populate_plane_sizes_linear(
(fb->height / v_subsample);
if (fmt->fetch_type == MDP_PLANE_PSEUDO_PLANAR) {
- layout->num_planes = 2;
layout->plane_size[1] *= 2;
layout->plane_pitch[1] *= 2;
} else {
/* planar */
- layout->num_planes = 3;
layout->plane_size[2] = layout->plane_size[1];
layout->plane_pitch[2] = layout->plane_pitch[1];
}
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 10/12] drm/msm/dpu: drop redundant num_planes assignment in _dpu_format_populate_plane_sizes*()
2025-07-05 2:47 ` [PATCH 10/12] drm/msm/dpu: drop redundant num_planes assignment in _dpu_format_populate_plane_sizes*() Dmitry Baryshkov
@ 2025-09-04 23:19 ` Jessica Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 23:19 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Drop redundant layout->num_planes assignments, using the value assigned
> from the formats table. RGB UBWC formats need special handling: they use
> two planes (per the format table), but the uAPI defines plane[1] as
> empty.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> index 195a6b7c4075eef40e7a5d0fee208168421cee35..e1fb7fd3b0b97a38880bc80aec26003d65a3a310 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> @@ -110,7 +110,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> uint32_t y_meta_scanlines = 0;
> uint32_t uv_meta_scanlines = 0;
>
> - layout->num_planes = 2;
> layout->plane_pitch[0] = VENUS_Y_STRIDE(color, fb->width);
> y_sclines = VENUS_Y_SCANLINES(color, fb->height);
> layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
> @@ -124,7 +123,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> if (!meta)
> return 0;
>
> - layout->num_planes += 2;
> layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width);
> y_meta_scanlines = VENUS_Y_META_SCANLINES(color, fb->height);
> layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
> @@ -138,8 +136,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> } else {
> uint32_t rgb_scanlines, rgb_meta_scanlines;
>
> - layout->num_planes = 1;
> -
> layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, fb->width);
> rgb_scanlines = VENUS_RGB_SCANLINES(color, fb->height);
> layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
> @@ -148,7 +144,9 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> if (!meta)
> return 0;
>
> - layout->num_planes += 2;
> + /* uAPI leaves plane[1] empty and plane[2] as meta */
> + layout->num_planes += 1;
> +
> layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width);
> rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height);
> layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
> @@ -167,7 +165,6 @@ static int _dpu_format_populate_plane_sizes_linear(
>
> /* Due to memset above, only need to set planes of interest */
> if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) {
> - layout->num_planes = 1;
> layout->plane_size[0] = fb->width * fb->height * fmt->bpp;
> layout->plane_pitch[0] = fb->width * fmt->bpp;
> } else {
> @@ -194,12 +191,10 @@ static int _dpu_format_populate_plane_sizes_linear(
> (fb->height / v_subsample);
>
> if (fmt->fetch_type == MDP_PLANE_PSEUDO_PLANAR) {
> - layout->num_planes = 2;
> layout->plane_size[1] *= 2;
> layout->plane_pitch[1] *= 2;
> } else {
> /* planar */
> - layout->num_planes = 3;
> layout->plane_size[2] = layout->plane_size[1];
> layout->plane_pitch[2] = layout->plane_pitch[1];
> }
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc()
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (9 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 10/12] drm/msm/dpu: drop redundant num_planes assignment in _dpu_format_populate_plane_sizes*() Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-07-05 17:53 ` kernel test robot
2025-07-05 2:47 ` [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Drop extra wrapping layer (msm_media_info.h) and inline all VENUS_*()
functions, simplifying the code.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 124 ++-
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h | 1155 ------------------------
2 files changed, 60 insertions(+), 1219 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index e1fb7fd3b0b97a38880bc80aec26003d65a3a310..67bc5a6eeb43dcf113dea9eccdb778cd52b1ad40 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -7,10 +7,19 @@
#include <uapi/drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
-#include "msm_media_info.h"
#include "dpu_kms.h"
#include "dpu_formats.h"
+#ifndef MSM_MEDIA_ALIGN
+#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
+ ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
+ (((__sz) + (__align) - 1) & (~((__align) - 1))))
+#endif
+
+#ifndef MSM_MEDIA_ROUNDUP
+#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
+#endif
+
#define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096
/*
@@ -54,90 +63,73 @@ static void _dpu_get_v_h_subsample_rate(
}
}
-static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt)
-{
- static const struct dpu_media_color_map dpu_media_ubwc_map[] = {
- {DRM_FORMAT_ABGR8888, COLOR_FMT_RGBA8888_UBWC},
- {DRM_FORMAT_ARGB8888, COLOR_FMT_RGBA8888_UBWC},
- {DRM_FORMAT_XBGR8888, COLOR_FMT_RGBA8888_UBWC},
- {DRM_FORMAT_XRGB8888, COLOR_FMT_RGBA8888_UBWC},
- {DRM_FORMAT_ABGR2101010, COLOR_FMT_RGBA1010102_UBWC},
- {DRM_FORMAT_ARGB2101010, COLOR_FMT_RGBA1010102_UBWC},
- {DRM_FORMAT_XRGB2101010, COLOR_FMT_RGBA1010102_UBWC},
- {DRM_FORMAT_XBGR2101010, COLOR_FMT_RGBA1010102_UBWC},
- {DRM_FORMAT_BGR565, COLOR_FMT_RGB565_UBWC},
- };
- int color_fmt = -1;
- int i;
-
- if (fmt->pixel_format == DRM_FORMAT_NV12 ||
- fmt->pixel_format == DRM_FORMAT_P010) {
- if (MSM_FORMAT_IS_DX(fmt)) {
- if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT)
- color_fmt = COLOR_FMT_NV12_BPP10_UBWC;
- else
- color_fmt = COLOR_FMT_P010_UBWC;
- } else
- color_fmt = COLOR_FMT_NV12_UBWC;
- return color_fmt;
- }
-
- for (i = 0; i < ARRAY_SIZE(dpu_media_ubwc_map); ++i)
- if (fmt->pixel_format == dpu_media_ubwc_map[i].format) {
- color_fmt = dpu_media_ubwc_map[i].color;
- break;
- }
- return color_fmt;
-}
-
static int _dpu_format_populate_plane_sizes_ubwc(
const struct msm_format *fmt,
struct drm_framebuffer *fb,
struct dpu_hw_fmt_layout *layout)
{
- int color;
bool meta = MSM_FORMAT_IS_UBWC(fmt);
- color = _dpu_format_get_media_color_ubwc(fmt);
- if (color < 0) {
- DRM_ERROR("UBWC format not supported for fmt: %p4cc\n",
- &fmt->pixel_format);
- return -EINVAL;
- }
-
if (MSM_FORMAT_IS_YUV(fmt)) {
- uint32_t y_sclines, uv_sclines;
- uint32_t y_meta_scanlines = 0;
- uint32_t uv_meta_scanlines = 0;
+ unsigned int stride, sclines;
+ unsigned int y_tile_width, y_tile_height;
+ unsigned int y_meta_stride, y_meta_scanlines;
+ unsigned int uv_meta_stride, uv_meta_scanlines;
+
+ if (fmt->pixel_format == DRM_FORMAT_NV12 ||
+ fmt->pixel_format == DRM_FORMAT_P010) {
+ if (MSM_FORMAT_IS_DX(fmt)) {
+ if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) {
+ stride = MSM_MEDIA_ALIGN(fb->width, 192);
+ stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
+ y_tile_width = 48;
+ } else {
+ stride = MSM_MEDIA_ALIGN(fb->width * 2, 256);
+ y_tile_width = 32;
+ }
+
+ sclines = MSM_MEDIA_ALIGN(fb->height, 16);
+ y_tile_height = 4;
+ } else {
+ stride = MSM_MEDIA_ALIGN(fb->width, 128);
+ y_tile_width = 32;
+
+ sclines = MSM_MEDIA_ALIGN(fb->height, 32);
+ y_tile_height = 8;
+ }
+ }
- layout->plane_pitch[0] = VENUS_Y_STRIDE(color, fb->width);
- y_sclines = VENUS_Y_SCANLINES(color, fb->height);
+ layout->plane_pitch[0] = stride;
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
- y_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
+ sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
- layout->plane_pitch[1] = VENUS_UV_STRIDE(color, fb->width);
- uv_sclines = VENUS_UV_SCANLINES(color, fb->height);
+ layout->plane_pitch[1] = stride;
layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
- uv_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
+ sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
if (!meta)
return 0;
- layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width);
- y_meta_scanlines = VENUS_Y_META_SCANLINES(color, fb->height);
+ y_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, y_tile_width);
+ layout->plane_pitch[2] = MSM_MEDIA_ALIGN(y_meta_stride, 64);
+
+ y_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, y_tile_height);
+ y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
- layout->plane_pitch[3] = VENUS_UV_META_STRIDE(color, fb->width);
- uv_meta_scanlines = VENUS_UV_META_SCANLINES(color, fb->height);
+ uv_meta_stride = MSM_MEDIA_ROUNDUP((fb->width+1)>>1, y_tile_width / 2);
+ layout->plane_pitch[3] = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
+
+ uv_meta_scanlines = MSM_MEDIA_ROUNDUP((fb->height+1)>>1, y_tile_height);
+ uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
layout->plane_size[3] = MSM_MEDIA_ALIGN(layout->plane_pitch[3] *
uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
-
} else {
- uint32_t rgb_scanlines, rgb_meta_scanlines;
+ unsigned int rgb_scanlines, rgb_meta_scanlines, rgb_meta_stride;
- layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, fb->width);
- rgb_scanlines = VENUS_RGB_SCANLINES(color, fb->height);
+ layout->plane_pitch[0] = MSM_MEDIA_ALIGN(fb->width * fmt->bpp, 256);
+ rgb_scanlines = MSM_MEDIA_ALIGN(fb->height, 16);
layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
@@ -147,8 +139,12 @@ static int _dpu_format_populate_plane_sizes_ubwc(
/* uAPI leaves plane[1] empty and plane[2] as meta */
layout->num_planes += 1;
- layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width);
- rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height);
+ rgb_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, 16);
+ layout->plane_pitch[2] = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
+
+ rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, 4);
+ rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
+
layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h b/drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h
deleted file mode 100644
index 9fc9dbde8a27c1d7078c3d6b260c8635f27a514f..0000000000000000000000000000000000000000
--- a/drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h
+++ /dev/null
@@ -1,1155 +0,0 @@
-#ifndef __MEDIA_INFO_H__
-#define __MEDIA_INFO_H__
-
-#ifndef MSM_MEDIA_ALIGN
-#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
- ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
- (((__sz) + (__align) - 1) & (~((__align) - 1))))
-#endif
-
-#ifndef MSM_MEDIA_ROUNDUP
-#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
-#endif
-
-#ifndef MSM_MEDIA_MAX
-#define MSM_MEDIA_MAX(__a, __b) ((__a) > (__b)?(__a):(__b))
-#endif
-
-enum color_fmts {
- /* Venus NV12:
- * YUV 4:2:0 image with a plane of 8 bit Y samples followed
- * by an interleaved U/V plane containing 8 bit 2x2 subsampled
- * colour difference samples.
- *
- * <-------- Y/UV_Stride -------->
- * <------- Width ------->
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * U V U V U V U V U V U V . . . . ^
- * U V U V U V U V U V U V . . . . |
- * U V U V U V U V U V U V . . . . |
- * U V U V U V U V U V U V . . . . UV_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . --> Buffer size alignment
- *
- * Y_Stride : Width aligned to 128
- * UV_Stride : Width aligned to 128
- * Y_Scanlines: Height aligned to 32
- * UV_Scanlines: Height/2 aligned to 16
- * Extradata: Arbitrary (software-imposed) padding
- * Total size = align((Y_Stride * Y_Scanlines
- * + UV_Stride * UV_Scanlines
- * + max(Extradata, Y_Stride * 8), 4096)
- */
- COLOR_FMT_NV12,
-
- /* Venus NV21:
- * YUV 4:2:0 image with a plane of 8 bit Y samples followed
- * by an interleaved V/U plane containing 8 bit 2x2 subsampled
- * colour difference samples.
- *
- * <-------- Y/UV_Stride -------->
- * <------- Width ------->
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * V U V U V U V U V U V U . . . . ^
- * V U V U V U V U V U V U . . . . |
- * V U V U V U V U V U V U . . . . |
- * V U V U V U V U V U V U . . . . UV_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment
- *
- * Y_Stride : Width aligned to 128
- * UV_Stride : Width aligned to 128
- * Y_Scanlines: Height aligned to 32
- * UV_Scanlines: Height/2 aligned to 16
- * Extradata: Arbitrary (software-imposed) padding
- * Total size = align((Y_Stride * Y_Scanlines
- * + UV_Stride * UV_Scanlines
- * + max(Extradata, Y_Stride * 8), 4096)
- */
- COLOR_FMT_NV21,
- /* Venus NV12_MVTB:
- * Two YUV 4:2:0 images/views one after the other
- * in a top-bottom layout, same as NV12
- * with a plane of 8 bit Y samples followed
- * by an interleaved U/V plane containing 8 bit 2x2 subsampled
- * colour difference samples.
- *
- *
- * <-------- Y/UV_Stride -------->
- * <------- Width ------->
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | |
- * . . . . . . . . . . . . . . . . | View_1
- * . . . . . . . . . . . . . . . . | |
- * . . . . . . . . . . . . . . . . | |
- * . . . . . . . . . . . . . . . . V |
- * U V U V U V U V U V U V . . . . ^ |
- * U V U V U V U V U V U V . . . . | |
- * U V U V U V U V U V U V . . . . | |
- * U V U V U V U V U V U V . . . . UV_Scanlines |
- * . . . . . . . . . . . . . . . . | |
- * . . . . . . . . . . . . . . . . V V
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | |
- * . . . . . . . . . . . . . . . . | View_2
- * . . . . . . . . . . . . . . . . | |
- * . . . . . . . . . . . . . . . . | |
- * . . . . . . . . . . . . . . . . V |
- * U V U V U V U V U V U V . . . . ^ |
- * U V U V U V U V U V U V . . . . | |
- * U V U V U V U V U V U V . . . . | |
- * U V U V U V U V U V U V . . . . UV_Scanlines |
- * . . . . . . . . . . . . . . . . | |
- * . . . . . . . . . . . . . . . . V V
- * . . . . . . . . . . . . . . . . --> Buffer size alignment
- *
- * Y_Stride : Width aligned to 128
- * UV_Stride : Width aligned to 128
- * Y_Scanlines: Height aligned to 32
- * UV_Scanlines: Height/2 aligned to 16
- * View_1 begin at: 0 (zero)
- * View_2 begin at: Y_Stride * Y_Scanlines + UV_Stride * UV_Scanlines
- * Extradata: Arbitrary (software-imposed) padding
- * Total size = align((2*(Y_Stride * Y_Scanlines)
- * + 2*(UV_Stride * UV_Scanlines) + Extradata), 4096)
- */
- COLOR_FMT_NV12_MVTB,
- /*
- * The buffer can be of 2 types:
- * (1) Venus NV12 UBWC Progressive
- * (2) Venus NV12 UBWC Interlaced
- *
- * (1) Venus NV12 UBWC Progressive Buffer Format:
- * Compressed Macro-tile format for NV12.
- * Contains 4 planes in the following order -
- * (A) Y_Meta_Plane
- * (B) Y_UBWC_Plane
- * (C) UV_Meta_Plane
- * (D) UV_UBWC_Plane
- *
- * Y_Meta_Plane consists of meta information to decode compressed
- * tile data in Y_UBWC_Plane.
- * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
- * UBWC decoder block will use the Y_Meta_Plane data together with
- * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples.
- *
- * UV_Meta_Plane consists of meta information to decode compressed
- * tile data in UV_UBWC_Plane.
- * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
- * UBWC decoder block will use UV_Meta_Plane data together with
- * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2
- * subsampled color difference samples.
- *
- * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
- * and randomly accessible. There is no dependency between tiles.
- *
- * <----- Y_Meta_Stride ---->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Height |
- * M M M M M M M M M M M M . . | Meta_Y_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <--Compressed tile Y Stride--->
- * <------- Width ------->
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- * <----- UV_Meta_Stride ---->
- * M M M M M M M M M M M M . . ^
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . M_UV_Scanlines
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * <--Compressed tile UV Stride--->
- * U* V* U* V* U* V* U* V* . . . . ^
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . UV_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- *
- * Y_Stride = align(Width, 128)
- * UV_Stride = align(Width, 128)
- * Y_Scanlines = align(Height, 32)
- * UV_Scanlines = align(Height/2, 16)
- * Y_UBWC_Plane_size = align(Y_Stride * Y_Scanlines, 4096)
- * UV_UBWC_Plane_size = align(UV_Stride * UV_Scanlines, 4096)
- * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
- * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
- * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
- * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
- * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
- * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align( Y_UBWC_Plane_size + UV_UBWC_Plane_size +
- * Y_Meta_Plane_size + UV_Meta_Plane_size
- * + max(Extradata, Y_Stride * 48), 4096)
- *
- *
- * (2) Venus NV12 UBWC Interlaced Buffer Format:
- * Compressed Macro-tile format for NV12 interlaced.
- * Contains 8 planes in the following order -
- * (A) Y_Meta_Top_Field_Plane
- * (B) Y_UBWC_Top_Field_Plane
- * (C) UV_Meta_Top_Field_Plane
- * (D) UV_UBWC_Top_Field_Plane
- * (E) Y_Meta_Bottom_Field_Plane
- * (F) Y_UBWC_Bottom_Field_Plane
- * (G) UV_Meta_Bottom_Field_Plane
- * (H) UV_UBWC_Bottom_Field_Plane
- * Y_Meta_Top_Field_Plane consists of meta information to decode
- * compressed tile data for Y_UBWC_Top_Field_Plane.
- * Y_UBWC_Top_Field_Plane consists of Y data in compressed macro-tile
- * format for top field of an interlaced frame.
- * UBWC decoder block will use the Y_Meta_Top_Field_Plane data together
- * with Y_UBWC_Top_Field_Plane data to produce loss-less uncompressed
- * 8 bit Y samples for top field of an interlaced frame.
- *
- * UV_Meta_Top_Field_Plane consists of meta information to decode
- * compressed tile data in UV_UBWC_Top_Field_Plane.
- * UV_UBWC_Top_Field_Plane consists of UV data in compressed macro-tile
- * format for top field of an interlaced frame.
- * UBWC decoder block will use UV_Meta_Top_Field_Plane data together
- * with UV_UBWC_Top_Field_Plane data to produce loss-less uncompressed
- * 8 bit subsampled color difference samples for top field of an
- * interlaced frame.
- *
- * Each tile in Y_UBWC_Top_Field_Plane/UV_UBWC_Top_Field_Plane is
- * independently decodable and randomly accessible. There is no
- * dependency between tiles.
- *
- * Y_Meta_Bottom_Field_Plane consists of meta information to decode
- * compressed tile data for Y_UBWC_Bottom_Field_Plane.
- * Y_UBWC_Bottom_Field_Plane consists of Y data in compressed macro-tile
- * format for bottom field of an interlaced frame.
- * UBWC decoder block will use the Y_Meta_Bottom_Field_Plane data
- * together with Y_UBWC_Bottom_Field_Plane data to produce loss-less
- * uncompressed 8 bit Y samples for bottom field of an interlaced frame.
- *
- * UV_Meta_Bottom_Field_Plane consists of meta information to decode
- * compressed tile data in UV_UBWC_Bottom_Field_Plane.
- * UV_UBWC_Bottom_Field_Plane consists of UV data in compressed
- * macro-tile format for bottom field of an interlaced frame.
- * UBWC decoder block will use UV_Meta_Bottom_Field_Plane data together
- * with UV_UBWC_Bottom_Field_Plane data to produce loss-less
- * uncompressed 8 bit subsampled color difference samples for bottom
- * field of an interlaced frame.
- *
- * Each tile in Y_UBWC_Bottom_Field_Plane/UV_UBWC_Bottom_Field_Plane is
- * independently decodable and randomly accessible. There is no
- * dependency between tiles.
- *
- * <-----Y_TF_Meta_Stride---->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Half_height |
- * M M M M M M M M M M M M . . | Meta_Y_TF_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <-Compressed tile Y_TF Stride->
- * <------- Width ------->
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_TF_Scanlines
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- * <----UV_TF_Meta_Stride---->
- * M M M M M M M M M M M M . . ^
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . M_UV_TF_Scanlines
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * <-Compressed tile UV_TF Stride->
- * U* V* U* V* U* V* U* V* . . . . ^
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . UV_TF_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * <-----Y_BF_Meta_Stride---->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Half_height |
- * M M M M M M M M M M M M . . | Meta_Y_BF_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <-Compressed tile Y_BF Stride->
- * <------- Width ------->
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_BF_Scanlines
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- * <----UV_BF_Meta_Stride---->
- * M M M M M M M M M M M M . . ^
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . M_UV_BF_Scanlines
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * <-Compressed tile UV_BF Stride->
- * U* V* U* V* U* V* U* V* . . . . ^
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . UV_BF_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- *
- * Half_height = (Height+1)>>1
- * Y_TF_Stride = align(Width, 128)
- * UV_TF_Stride = align(Width, 128)
- * Y_TF_Scanlines = align(Half_height, 32)
- * UV_TF_Scanlines = align((Half_height+1)/2, 32)
- * Y_UBWC_TF_Plane_size = align(Y_TF_Stride * Y_TF_Scanlines, 4096)
- * UV_UBWC_TF_Plane_size = align(UV_TF_Stride * UV_TF_Scanlines, 4096)
- * Y_TF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
- * Y_TF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)
- * Y_TF_Meta_Plane_size =
- * align(Y_TF_Meta_Stride * Y_TF_Meta_Scanlines, 4096)
- * UV_TF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
- * UV_TF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)
- * UV_TF_Meta_Plane_size =
- * align(UV_TF_Meta_Stride * UV_TF_Meta_Scanlines, 4096)
- * Y_BF_Stride = align(Width, 128)
- * UV_BF_Stride = align(Width, 128)
- * Y_BF_Scanlines = align(Half_height, 32)
- * UV_BF_Scanlines = align((Half_height+1)/2, 32)
- * Y_UBWC_BF_Plane_size = align(Y_BF_Stride * Y_BF_Scanlines, 4096)
- * UV_UBWC_BF_Plane_size = align(UV_BF_Stride * UV_BF_Scanlines, 4096)
- * Y_BF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
- * Y_BF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)
- * Y_BF_Meta_Plane_size =
- * align(Y_BF_Meta_Stride * Y_BF_Meta_Scanlines, 4096)
- * UV_BF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
- * UV_BF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)
- * UV_BF_Meta_Plane_size =
- * align(UV_BF_Meta_Stride * UV_BF_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align( Y_UBWC_TF_Plane_size + UV_UBWC_TF_Plane_size +
- * Y_TF_Meta_Plane_size + UV_TF_Meta_Plane_size +
- * Y_UBWC_BF_Plane_size + UV_UBWC_BF_Plane_size +
- * Y_BF_Meta_Plane_size + UV_BF_Meta_Plane_size +
- * + max(Extradata, Y_TF_Stride * 48), 4096)
- */
- COLOR_FMT_NV12_UBWC,
- /* Venus NV12 10-bit UBWC:
- * Compressed Macro-tile format for NV12.
- * Contains 4 planes in the following order -
- * (A) Y_Meta_Plane
- * (B) Y_UBWC_Plane
- * (C) UV_Meta_Plane
- * (D) UV_UBWC_Plane
- *
- * Y_Meta_Plane consists of meta information to decode compressed
- * tile data in Y_UBWC_Plane.
- * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
- * UBWC decoder block will use the Y_Meta_Plane data together with
- * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.
- *
- * UV_Meta_Plane consists of meta information to decode compressed
- * tile data in UV_UBWC_Plane.
- * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
- * UBWC decoder block will use UV_Meta_Plane data together with
- * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2
- * subsampled color difference samples.
- *
- * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
- * and randomly accessible. There is no dependency between tiles.
- *
- * <----- Y_Meta_Stride ----->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Height |
- * M M M M M M M M M M M M . . | Meta_Y_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <--Compressed tile Y Stride--->
- * <------- Width ------->
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- * <----- UV_Meta_Stride ---->
- * M M M M M M M M M M M M . . ^
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . M_UV_Scanlines
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * <--Compressed tile UV Stride--->
- * U* V* U* V* U* V* U* V* . . . . ^
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . UV_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- *
- *
- * Y_Stride = align(Width * 4/3, 128)
- * UV_Stride = align(Width * 4/3, 128)
- * Y_Scanlines = align(Height, 32)
- * UV_Scanlines = align(Height/2, 16)
- * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
- * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
- * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
- * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
- * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
- * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
- * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
- * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
- * Y_Meta_Plane_size + UV_Meta_Plane_size
- * + max(Extradata, Y_Stride * 48), 4096)
- */
- COLOR_FMT_NV12_BPP10_UBWC,
- /* Venus RGBA8888 format:
- * Contains 1 plane in the following order -
- * (A) RGBA plane
- *
- * <-------- RGB_Stride -------->
- * <------- Width ------->
- * R R R R R R R R R R R R . . . . ^ ^
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . Height |
- * R R R R R R R R R R R R . . . . | RGB_Scanlines
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- *
- * RGB_Stride = align(Width * 4, 128)
- * RGB_Scanlines = align(Height, 32)
- * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align(RGB_Plane_size + Extradata, 4096)
- */
- COLOR_FMT_RGBA8888,
- /* Venus RGBA8888 UBWC format:
- * Contains 2 planes in the following order -
- * (A) Meta plane
- * (B) RGBA plane
- *
- * <--- RGB_Meta_Stride ---->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Height |
- * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <-------- RGB_Stride -------->
- * <------- Width ------->
- * R R R R R R R R R R R R . . . . ^ ^
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . Height |
- * R R R R R R R R R R R R . . . . | RGB_Scanlines
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- *
- * RGB_Stride = align(Width * 4, 128)
- * RGB_Scanlines = align(Height, 32)
- * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
- * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
- * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
- * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
- * RGB_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
- * Extradata, 4096)
- */
- COLOR_FMT_RGBA8888_UBWC,
- /* Venus RGBA1010102 UBWC format:
- * Contains 2 planes in the following order -
- * (A) Meta plane
- * (B) RGBA plane
- *
- * <--- RGB_Meta_Stride ---->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Height |
- * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <-------- RGB_Stride -------->
- * <------- Width ------->
- * R R R R R R R R R R R R . . . . ^ ^
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . Height |
- * R R R R R R R R R R R R . . . . | RGB_Scanlines
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- *
- * RGB_Stride = align(Width * 4, 256)
- * RGB_Scanlines = align(Height, 16)
- * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
- * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
- * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
- * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
- * RGB_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
- * Extradata, 4096)
- */
- COLOR_FMT_RGBA1010102_UBWC,
- /* Venus RGB565 UBWC format:
- * Contains 2 planes in the following order -
- * (A) Meta plane
- * (B) RGB plane
- *
- * <--- RGB_Meta_Stride ---->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Height |
- * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <-------- RGB_Stride -------->
- * <------- Width ------->
- * R R R R R R R R R R R R . . . . ^ ^
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . Height |
- * R R R R R R R R R R R R . . . . | RGB_Scanlines
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . | |
- * R R R R R R R R R R R R . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- *
- * RGB_Stride = align(Width * 2, 128)
- * RGB_Scanlines = align(Height, 16)
- * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
- * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
- * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
- * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
- * RGB_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
- * Extradata, 4096)
- */
- COLOR_FMT_RGB565_UBWC,
- /* P010 UBWC:
- * Compressed Macro-tile format for NV12.
- * Contains 4 planes in the following order -
- * (A) Y_Meta_Plane
- * (B) Y_UBWC_Plane
- * (C) UV_Meta_Plane
- * (D) UV_UBWC_Plane
- *
- * Y_Meta_Plane consists of meta information to decode compressed
- * tile data in Y_UBWC_Plane.
- * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
- * UBWC decoder block will use the Y_Meta_Plane data together with
- * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.
- *
- * UV_Meta_Plane consists of meta information to decode compressed
- * tile data in UV_UBWC_Plane.
- * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
- * UBWC decoder block will use UV_Meta_Plane data together with
- * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2
- * subsampled color difference samples.
- *
- * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
- * and randomly accessible. There is no dependency between tiles.
- *
- * <----- Y_Meta_Stride ----->
- * <-------- Width ------>
- * M M M M M M M M M M M M . . ^ ^
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . Height |
- * M M M M M M M M M M M M . . | Meta_Y_Scanlines
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . | |
- * M M M M M M M M M M M M . . V |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . V
- * <--Compressed tile Y Stride--->
- * <------- Width ------->
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
- * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * . . . . . . . . . . . . . . . . V
- * <----- UV_Meta_Stride ---->
- * M M M M M M M M M M M M . . ^
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . |
- * M M M M M M M M M M M M . . M_UV_Scanlines
- * . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- * <--Compressed tile UV Stride--->
- * U* V* U* V* U* V* U* V* . . . . ^
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . |
- * U* V* U* V* U* V* U* V* . . . . UV_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
- *
- *
- * Y_Stride = align(Width * 2, 256)
- * UV_Stride = align(Width * 2, 256)
- * Y_Scanlines = align(Height, 16)
- * UV_Scanlines = align(Height/2, 16)
- * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
- * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
- * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
- * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
- * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
- * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
- * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
- * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
- * Extradata = 8k
- *
- * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
- * Y_Meta_Plane_size + UV_Meta_Plane_size
- * + max(Extradata, Y_Stride * 48), 4096)
- */
- COLOR_FMT_P010_UBWC,
- /* Venus P010:
- * YUV 4:2:0 image with a plane of 10 bit Y samples followed
- * by an interleaved U/V plane containing 10 bit 2x2 subsampled
- * colour difference samples.
- *
- * <-------- Y/UV_Stride -------->
- * <------- Width ------->
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
- * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * U V U V U V U V U V U V . . . . ^
- * U V U V U V U V U V U V . . . . |
- * U V U V U V U V U V U V . . . . |
- * U V U V U V U V U V U V . . . . UV_Scanlines
- * . . . . . . . . . . . . . . . . |
- * . . . . . . . . . . . . . . . . V
- * . . . . . . . . . . . . . . . . --> Buffer size alignment
- *
- * Y_Stride : Width * 2 aligned to 128
- * UV_Stride : Width * 2 aligned to 128
- * Y_Scanlines: Height aligned to 32
- * UV_Scanlines: Height/2 aligned to 16
- * Extradata: Arbitrary (software-imposed) padding
- * Total size = align((Y_Stride * Y_Scanlines
- * + UV_Stride * UV_Scanlines
- * + max(Extradata, Y_Stride * 8), 4096)
- */
- COLOR_FMT_P010,
-};
-
-#define COLOR_FMT_RGBA1010102_UBWC COLOR_FMT_RGBA1010102_UBWC
-#define COLOR_FMT_RGB565_UBWC COLOR_FMT_RGB565_UBWC
-#define COLOR_FMT_P010_UBWC COLOR_FMT_P010_UBWC
-#define COLOR_FMT_P010 COLOR_FMT_P010
-
-/*
- * Function arguments:
- * @color_fmt
- * @width
- * Progressive: width
- * Interlaced: width
- */
-static unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
-{
- unsigned int stride = 0;
-
- if (!width)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV21:
- case COLOR_FMT_NV12:
- case COLOR_FMT_NV12_MVTB:
- case COLOR_FMT_NV12_UBWC:
- stride = MSM_MEDIA_ALIGN(width, 128);
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- stride = MSM_MEDIA_ALIGN(width, 192);
- stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
- break;
- case COLOR_FMT_P010_UBWC:
- stride = MSM_MEDIA_ALIGN(width * 2, 256);
- break;
- case COLOR_FMT_P010:
- stride = MSM_MEDIA_ALIGN(width * 2, 128);
- break;
- }
-
- return stride;
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @width
- * Progressive: width
- * Interlaced: width
- */
-static unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
-{
- unsigned int stride = 0;
-
- if (!width)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV21:
- case COLOR_FMT_NV12:
- case COLOR_FMT_NV12_MVTB:
- case COLOR_FMT_NV12_UBWC:
- stride = MSM_MEDIA_ALIGN(width, 128);
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- stride = MSM_MEDIA_ALIGN(width, 192);
- stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
- break;
- case COLOR_FMT_P010_UBWC:
- stride = MSM_MEDIA_ALIGN(width * 2, 256);
- break;
- case COLOR_FMT_P010:
- stride = MSM_MEDIA_ALIGN(width * 2, 128);
- break;
- }
-
- return stride;
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @height
- * Progressive: height
- * Interlaced: (height+1)>>1
- */
-static unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
-{
- unsigned int sclines = 0;
-
- if (!height)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV21:
- case COLOR_FMT_NV12:
- case COLOR_FMT_NV12_MVTB:
- case COLOR_FMT_NV12_UBWC:
- case COLOR_FMT_P010:
- sclines = MSM_MEDIA_ALIGN(height, 32);
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- case COLOR_FMT_P010_UBWC:
- sclines = MSM_MEDIA_ALIGN(height, 16);
- break;
- }
-
- return sclines;
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @height
- * Progressive: height
- * Interlaced: (height+1)>>1
- */
-static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
-{
- unsigned int sclines = 0;
-
- if (!height)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV21:
- case COLOR_FMT_NV12:
- case COLOR_FMT_NV12_MVTB:
- case COLOR_FMT_NV12_BPP10_UBWC:
- case COLOR_FMT_P010_UBWC:
- case COLOR_FMT_P010:
- sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 16);
- break;
- case COLOR_FMT_NV12_UBWC:
- sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 32);
- break;
- }
-
- return sclines;
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @width
- * Progressive: width
- * Interlaced: width
- */
-static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
-{
- int y_tile_width = 0, y_meta_stride;
-
- if (!width)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV12_UBWC:
- case COLOR_FMT_P010_UBWC:
- y_tile_width = 32;
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- y_tile_width = 48;
- break;
- default:
- return 0;
- }
-
- y_meta_stride = MSM_MEDIA_ROUNDUP(width, y_tile_width);
- return MSM_MEDIA_ALIGN(y_meta_stride, 64);
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @height
- * Progressive: height
- * Interlaced: (height+1)>>1
- */
-static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
-{
- int y_tile_height = 0, y_meta_scanlines;
-
- if (!height)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV12_UBWC:
- y_tile_height = 8;
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- case COLOR_FMT_P010_UBWC:
- y_tile_height = 4;
- break;
- default:
- return 0;
- }
-
- y_meta_scanlines = MSM_MEDIA_ROUNDUP(height, y_tile_height);
- return MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @width
- * Progressive: width
- * Interlaced: width
- */
-static unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
-{
- int uv_tile_width = 0, uv_meta_stride;
-
- if (!width)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV12_UBWC:
- case COLOR_FMT_P010_UBWC:
- uv_tile_width = 16;
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- uv_tile_width = 24;
- break;
- default:
- return 0;
- }
-
- uv_meta_stride = MSM_MEDIA_ROUNDUP((width+1)>>1, uv_tile_width);
- return MSM_MEDIA_ALIGN(uv_meta_stride, 64);
-}
-
-/*
- * Function arguments:
- * @color_fmt
- * @height
- * Progressive: height
- * Interlaced: (height+1)>>1
- */
-static unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
-{
- int uv_tile_height = 0, uv_meta_scanlines;
-
- if (!height)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_NV12_UBWC:
- uv_tile_height = 8;
- break;
- case COLOR_FMT_NV12_BPP10_UBWC:
- case COLOR_FMT_P010_UBWC:
- uv_tile_height = 4;
- break;
- default:
- return 0;
- }
-
- uv_meta_scanlines = MSM_MEDIA_ROUNDUP((height+1)>>1, uv_tile_height);
- return MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
-}
-
-static unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
-{
- unsigned int alignment = 0, bpp = 4;
-
- if (!width)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_RGBA8888:
- alignment = 128;
- break;
- case COLOR_FMT_RGB565_UBWC:
- alignment = 256;
- bpp = 2;
- break;
- case COLOR_FMT_RGBA8888_UBWC:
- case COLOR_FMT_RGBA1010102_UBWC:
- alignment = 256;
- break;
- default:
- return 0;
- }
-
- return MSM_MEDIA_ALIGN(width * bpp, alignment);
-}
-
-static unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
-{
- unsigned int alignment = 0;
-
- if (!height)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_RGBA8888:
- alignment = 32;
- break;
- case COLOR_FMT_RGBA8888_UBWC:
- case COLOR_FMT_RGBA1010102_UBWC:
- case COLOR_FMT_RGB565_UBWC:
- alignment = 16;
- break;
- default:
- return 0;
- }
-
- return MSM_MEDIA_ALIGN(height, alignment);
-}
-
-static unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
-{
- int rgb_meta_stride;
-
- if (!width)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_RGBA8888_UBWC:
- case COLOR_FMT_RGBA1010102_UBWC:
- case COLOR_FMT_RGB565_UBWC:
- rgb_meta_stride = MSM_MEDIA_ROUNDUP(width, 16);
- return MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
- }
-
- return 0;
-}
-
-static unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
-{
- int rgb_meta_scanlines;
-
- if (!height)
- return 0;
-
- switch (color_fmt) {
- case COLOR_FMT_RGBA8888_UBWC:
- case COLOR_FMT_RGBA1010102_UBWC:
- case COLOR_FMT_RGB565_UBWC:
- rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(height, 4);
- return MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
- }
-
- return 0;
-}
-
-#endif
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc()
2025-07-05 2:47 ` [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
@ 2025-07-05 17:53 ` kernel test robot
0 siblings, 0 replies; 27+ messages in thread
From: kernel test robot @ 2025-07-05 17:53 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: llvm, oe-kbuild-all, linux-arm-msm, dri-devel, freedreno,
linux-kernel
Hi Dmitry,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 26ffb3d6f02cd0935fb9fa3db897767beee1cb2a]
url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Baryshkov/drm-msm-disp-set-num_planes-to-1-for-interleaved-YUV-formats/20250705-104933
base: 26ffb3d6f02cd0935fb9fa3db897767beee1cb2a
patch link: https://lore.kernel.org/r/20250705-dpu-formats-v1-11-40f0bb31b8c8%40oss.qualcomm.com
patch subject: [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc()
config: powerpc64-randconfig-003-20250705 (https://download.01.org/0day-ci/archive/20250706/202507060149.j2XwjHut-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 61529d9e36fa86782a2458e6bdeedf7f376ef4b5)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250706/202507060149.j2XwjHut-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/202507060149.j2XwjHut-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:79:7: warning: variable 'sclines' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
79 | if (fmt->pixel_format == DRM_FORMAT_NV12 ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 | fmt->pixel_format == DRM_FORMAT_P010) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:104:4: note: uninitialized use occurs here
104 | sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
| ^~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:79:3: note: remove the 'if' if its condition is always true
79 | if (fmt->pixel_format == DRM_FORMAT_NV12 ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 | fmt->pixel_format == DRM_FORMAT_P010) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:74:31: note: initialize the variable 'sclines' to silence this warning
74 | unsigned int stride, sclines;
| ^
| = 0
>> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:79:7: warning: variable 'stride' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
79 | if (fmt->pixel_format == DRM_FORMAT_NV12 ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 | fmt->pixel_format == DRM_FORMAT_P010) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:102:28: note: uninitialized use occurs here
102 | layout->plane_pitch[0] = stride;
| ^~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:79:3: note: remove the 'if' if its condition is always true
79 | if (fmt->pixel_format == DRM_FORMAT_NV12 ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 | fmt->pixel_format == DRM_FORMAT_P010) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c:74:22: note: initialize the variable 'stride' to silence this warning
74 | unsigned int stride, sclines;
| ^
| = 0
2 warnings generated.
vim +79 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
65
66 static int _dpu_format_populate_plane_sizes_ubwc(
67 const struct msm_format *fmt,
68 struct drm_framebuffer *fb,
69 struct dpu_hw_fmt_layout *layout)
70 {
71 bool meta = MSM_FORMAT_IS_UBWC(fmt);
72
73 if (MSM_FORMAT_IS_YUV(fmt)) {
74 unsigned int stride, sclines;
75 unsigned int y_tile_width, y_tile_height;
76 unsigned int y_meta_stride, y_meta_scanlines;
77 unsigned int uv_meta_stride, uv_meta_scanlines;
78
> 79 if (fmt->pixel_format == DRM_FORMAT_NV12 ||
80 fmt->pixel_format == DRM_FORMAT_P010) {
81 if (MSM_FORMAT_IS_DX(fmt)) {
82 if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) {
83 stride = MSM_MEDIA_ALIGN(fb->width, 192);
84 stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
85 y_tile_width = 48;
86 } else {
87 stride = MSM_MEDIA_ALIGN(fb->width * 2, 256);
88 y_tile_width = 32;
89 }
90
91 sclines = MSM_MEDIA_ALIGN(fb->height, 16);
92 y_tile_height = 4;
93 } else {
94 stride = MSM_MEDIA_ALIGN(fb->width, 128);
95 y_tile_width = 32;
96
97 sclines = MSM_MEDIA_ALIGN(fb->height, 32);
98 y_tile_height = 8;
99 }
100 }
101
102 layout->plane_pitch[0] = stride;
103 layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
104 sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
105
106 layout->plane_pitch[1] = stride;
107 layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
108 sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
109
110 if (!meta)
111 return 0;
112
113 y_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, y_tile_width);
114 layout->plane_pitch[2] = MSM_MEDIA_ALIGN(y_meta_stride, 64);
115
116 y_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, y_tile_height);
117 y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
118 layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
119 y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
120
121 uv_meta_stride = MSM_MEDIA_ROUNDUP((fb->width+1)>>1, y_tile_width / 2);
122 layout->plane_pitch[3] = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
123
124 uv_meta_scanlines = MSM_MEDIA_ROUNDUP((fb->height+1)>>1, y_tile_height);
125 uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
126 layout->plane_size[3] = MSM_MEDIA_ALIGN(layout->plane_pitch[3] *
127 uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
128 } else {
129 unsigned int rgb_scanlines, rgb_meta_scanlines, rgb_meta_stride;
130
131 layout->plane_pitch[0] = MSM_MEDIA_ALIGN(fb->width * fmt->bpp, 256);
132 rgb_scanlines = MSM_MEDIA_ALIGN(fb->height, 16);
133 layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
134 rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
135
136 if (!meta)
137 return 0;
138
139 /* uAPI leaves plane[1] empty and plane[2] as meta */
140 layout->num_planes += 1;
141
142 rgb_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, 16);
143 layout->plane_pitch[2] = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
144
145 rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, 4);
146 rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
147
148 layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
149 rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
150 }
151
152 return 0;
153 }
154
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc()
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
` (10 preceding siblings ...)
2025-07-05 2:47 ` [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
@ 2025-07-05 2:47 ` Dmitry Baryshkov
2025-09-04 18:38 ` Jessica Zhang
11 siblings, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-07-05 2:47 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
The _dpu_format_populate_plane_sizes_ubwc() used MSM_MEDIA_ALIGN() and
MSM_MEDIA_ROUNDUP(), macros inherited from the previous implementation,
msm_media_info.h. Replace them with the standard Linux macros,
round_up() and DIV_ROUND_UP() respectively.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 62 ++++++++++++-----------------
1 file changed, 26 insertions(+), 36 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 67bc5a6eeb43dcf113dea9eccdb778cd52b1ad40..6a0426ed1460c5af4822844d7a7b0c51739df875 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -10,16 +10,6 @@
#include "dpu_kms.h"
#include "dpu_formats.h"
-#ifndef MSM_MEDIA_ALIGN
-#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
- ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
- (((__sz) + (__align) - 1) & (~((__align) - 1))))
-#endif
-
-#ifndef MSM_MEDIA_ROUNDUP
-#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
-#endif
-
#define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096
/*
@@ -80,57 +70,57 @@ static int _dpu_format_populate_plane_sizes_ubwc(
fmt->pixel_format == DRM_FORMAT_P010) {
if (MSM_FORMAT_IS_DX(fmt)) {
if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) {
- stride = MSM_MEDIA_ALIGN(fb->width, 192);
- stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
+ stride = round_up(fb->width, 192);
+ stride = round_up(stride * 4 / 3, 256);
y_tile_width = 48;
} else {
- stride = MSM_MEDIA_ALIGN(fb->width * 2, 256);
+ stride = round_up(fb->width * 2, 256);
y_tile_width = 32;
}
- sclines = MSM_MEDIA_ALIGN(fb->height, 16);
+ sclines = round_up(fb->height, 16);
y_tile_height = 4;
} else {
- stride = MSM_MEDIA_ALIGN(fb->width, 128);
+ stride = round_up(fb->width, 128);
y_tile_width = 32;
- sclines = MSM_MEDIA_ALIGN(fb->height, 32);
+ sclines = round_up(fb->height, 32);
y_tile_height = 8;
}
}
layout->plane_pitch[0] = stride;
- layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
+ layout->plane_size[0] = round_up(layout->plane_pitch[0] *
sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
layout->plane_pitch[1] = stride;
- layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
+ layout->plane_size[1] = round_up(layout->plane_pitch[1] *
sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
if (!meta)
return 0;
- y_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, y_tile_width);
- layout->plane_pitch[2] = MSM_MEDIA_ALIGN(y_meta_stride, 64);
+ y_meta_stride = DIV_ROUND_UP(fb->width, y_tile_width);
+ layout->plane_pitch[2] = round_up(y_meta_stride, 64);
- y_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, y_tile_height);
- y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
- layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
+ y_meta_scanlines = DIV_ROUND_UP(fb->height, y_tile_height);
+ y_meta_scanlines = round_up(y_meta_scanlines, 16);
+ layout->plane_size[2] = round_up(layout->plane_pitch[2] *
y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
- uv_meta_stride = MSM_MEDIA_ROUNDUP((fb->width+1)>>1, y_tile_width / 2);
- layout->plane_pitch[3] = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
+ uv_meta_stride = DIV_ROUND_UP((fb->width+1)>>1, y_tile_width / 2);
+ layout->plane_pitch[3] = round_up(uv_meta_stride, 64);
- uv_meta_scanlines = MSM_MEDIA_ROUNDUP((fb->height+1)>>1, y_tile_height);
- uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
- layout->plane_size[3] = MSM_MEDIA_ALIGN(layout->plane_pitch[3] *
+ uv_meta_scanlines = DIV_ROUND_UP((fb->height+1)>>1, y_tile_height);
+ uv_meta_scanlines = round_up(uv_meta_scanlines, 16);
+ layout->plane_size[3] = round_up(layout->plane_pitch[3] *
uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
} else {
unsigned int rgb_scanlines, rgb_meta_scanlines, rgb_meta_stride;
- layout->plane_pitch[0] = MSM_MEDIA_ALIGN(fb->width * fmt->bpp, 256);
- rgb_scanlines = MSM_MEDIA_ALIGN(fb->height, 16);
- layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
+ layout->plane_pitch[0] = round_up(fb->width * fmt->bpp, 256);
+ rgb_scanlines = round_up(fb->height, 16);
+ layout->plane_size[0] = round_up(layout->plane_pitch[0] *
rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
if (!meta)
@@ -139,13 +129,13 @@ static int _dpu_format_populate_plane_sizes_ubwc(
/* uAPI leaves plane[1] empty and plane[2] as meta */
layout->num_planes += 1;
- rgb_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, 16);
- layout->plane_pitch[2] = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
+ rgb_meta_stride = DIV_ROUND_UP(fb->width, 16);
+ layout->plane_pitch[2] = round_up(rgb_meta_stride, 64);
- rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, 4);
- rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
+ rgb_meta_scanlines = DIV_ROUND_UP(fb->height, 4);
+ rgb_meta_scanlines = round_up(rgb_meta_scanlines, 16);
- layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
+ layout->plane_size[2] = round_up(layout->plane_pitch[2] *
rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc()
2025-07-05 2:47 ` [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
@ 2025-09-04 18:38 ` Jessica Zhang
2025-09-04 20:19 ` Dmitry Baryshkov
0 siblings, 1 reply; 27+ messages in thread
From: Jessica Zhang @ 2025-09-04 18:38 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Jordan Crouse
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> The _dpu_format_populate_plane_sizes_ubwc() used MSM_MEDIA_ALIGN() and
> MSM_MEDIA_ROUNDUP(), macros inherited from the previous implementation,
> msm_media_info.h. Replace them with the standard Linux macros,
> round_up() and DIV_ROUND_UP() respectively.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 62 ++++++++++++-----------------
> 1 file changed, 26 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> index 67bc5a6eeb43dcf113dea9eccdb778cd52b1ad40..6a0426ed1460c5af4822844d7a7b0c51739df875 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> @@ -10,16 +10,6 @@
> #include "dpu_kms.h"
> #include "dpu_formats.h"
>
> -#ifndef MSM_MEDIA_ALIGN
> -#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
> - ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
> - (((__sz) + (__align) - 1) & (~((__align) - 1))))
> -#endif
> -
> -#ifndef MSM_MEDIA_ROUNDUP
> -#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
> -#endif
> -
> #define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096
>
> /*
> @@ -80,57 +70,57 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> fmt->pixel_format == DRM_FORMAT_P010) {
> if (MSM_FORMAT_IS_DX(fmt)) {
> if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) {
> - stride = MSM_MEDIA_ALIGN(fb->width, 192);
> - stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
> + stride = round_up(fb->width, 192);
Hi Dmitry,
It seems like the usage of round_up() here might be incorrect -- the
docs say "round up to next specified power of 2".
Maybe we should use roundup() instead here?
The rest of the patch LGTM.
Thanks,
Jessica Zhang
> + stride = round_up(stride * 4 / 3, 256);
> y_tile_width = 48;
> } else {
> - stride = MSM_MEDIA_ALIGN(fb->width * 2, 256);
> + stride = round_up(fb->width * 2, 256);
> y_tile_width = 32;
> }
>
> - sclines = MSM_MEDIA_ALIGN(fb->height, 16);
> + sclines = round_up(fb->height, 16);
> y_tile_height = 4;
> } else {
> - stride = MSM_MEDIA_ALIGN(fb->width, 128);
> + stride = round_up(fb->width, 128);
> y_tile_width = 32;
>
> - sclines = MSM_MEDIA_ALIGN(fb->height, 32);
> + sclines = round_up(fb->height, 32);
> y_tile_height = 8;
> }
> }
>
> layout->plane_pitch[0] = stride;
> - layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
> + layout->plane_size[0] = round_up(layout->plane_pitch[0] *
> sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> layout->plane_pitch[1] = stride;
> - layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
> + layout->plane_size[1] = round_up(layout->plane_pitch[1] *
> sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> if (!meta)
> return 0;
>
> - y_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, y_tile_width);
> - layout->plane_pitch[2] = MSM_MEDIA_ALIGN(y_meta_stride, 64);
> + y_meta_stride = DIV_ROUND_UP(fb->width, y_tile_width);
> + layout->plane_pitch[2] = round_up(y_meta_stride, 64);
>
> - y_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, y_tile_height);
> - y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
> - layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
> + y_meta_scanlines = DIV_ROUND_UP(fb->height, y_tile_height);
> + y_meta_scanlines = round_up(y_meta_scanlines, 16);
> + layout->plane_size[2] = round_up(layout->plane_pitch[2] *
> y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> - uv_meta_stride = MSM_MEDIA_ROUNDUP((fb->width+1)>>1, y_tile_width / 2);
> - layout->plane_pitch[3] = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
> + uv_meta_stride = DIV_ROUND_UP((fb->width+1)>>1, y_tile_width / 2);
> + layout->plane_pitch[3] = round_up(uv_meta_stride, 64);
>
> - uv_meta_scanlines = MSM_MEDIA_ROUNDUP((fb->height+1)>>1, y_tile_height);
> - uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
> - layout->plane_size[3] = MSM_MEDIA_ALIGN(layout->plane_pitch[3] *
> + uv_meta_scanlines = DIV_ROUND_UP((fb->height+1)>>1, y_tile_height);
> + uv_meta_scanlines = round_up(uv_meta_scanlines, 16);
> + layout->plane_size[3] = round_up(layout->plane_pitch[3] *
> uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> } else {
> unsigned int rgb_scanlines, rgb_meta_scanlines, rgb_meta_stride;
>
> - layout->plane_pitch[0] = MSM_MEDIA_ALIGN(fb->width * fmt->bpp, 256);
> - rgb_scanlines = MSM_MEDIA_ALIGN(fb->height, 16);
> - layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
> + layout->plane_pitch[0] = round_up(fb->width * fmt->bpp, 256);
> + rgb_scanlines = round_up(fb->height, 16);
> + layout->plane_size[0] = round_up(layout->plane_pitch[0] *
> rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> if (!meta)
> @@ -139,13 +129,13 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> /* uAPI leaves plane[1] empty and plane[2] as meta */
> layout->num_planes += 1;
>
> - rgb_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, 16);
> - layout->plane_pitch[2] = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
> + rgb_meta_stride = DIV_ROUND_UP(fb->width, 16);
> + layout->plane_pitch[2] = round_up(rgb_meta_stride, 64);
>
> - rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, 4);
> - rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
> + rgb_meta_scanlines = DIV_ROUND_UP(fb->height, 4);
> + rgb_meta_scanlines = round_up(rgb_meta_scanlines, 16);
>
> - layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
> + layout->plane_size[2] = round_up(layout->plane_pitch[2] *
> rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> }
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc()
2025-09-04 18:38 ` Jessica Zhang
@ 2025-09-04 20:19 ` Dmitry Baryshkov
0 siblings, 0 replies; 27+ messages in thread
From: Dmitry Baryshkov @ 2025-09-04 20:19 UTC (permalink / raw)
To: Jessica Zhang
Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Sean Paul,
Marijn Suijten, David Airlie, Simona Vetter, Jordan Crouse,
linux-arm-msm, dri-devel, freedreno, linux-kernel
On Thu, Sep 04, 2025 at 11:38:16AM -0700, Jessica Zhang wrote:
>
>
> On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> > The _dpu_format_populate_plane_sizes_ubwc() used MSM_MEDIA_ALIGN() and
> > MSM_MEDIA_ROUNDUP(), macros inherited from the previous implementation,
> > msm_media_info.h. Replace them with the standard Linux macros,
> > round_up() and DIV_ROUND_UP() respectively.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > ---
> > drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 62 ++++++++++++-----------------
> > 1 file changed, 26 insertions(+), 36 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> > index 67bc5a6eeb43dcf113dea9eccdb778cd52b1ad40..6a0426ed1460c5af4822844d7a7b0c51739df875 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> > @@ -10,16 +10,6 @@
> > #include "dpu_kms.h"
> > #include "dpu_formats.h"
> > -#ifndef MSM_MEDIA_ALIGN
> > -#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
> > - ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
> > - (((__sz) + (__align) - 1) & (~((__align) - 1))))
> > -#endif
> > -
> > -#ifndef MSM_MEDIA_ROUNDUP
> > -#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
> > -#endif
> > -
> > #define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096
> > /*
> > @@ -80,57 +70,57 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> > fmt->pixel_format == DRM_FORMAT_P010) {
> > if (MSM_FORMAT_IS_DX(fmt)) {
> > if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) {
> > - stride = MSM_MEDIA_ALIGN(fb->width, 192);
> > - stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
> > + stride = round_up(fb->width, 192);
>
> Hi Dmitry,
>
> It seems like the usage of round_up() here might be incorrect -- the docs
> say "round up to next specified power of 2".
>
> Maybe we should use roundup() instead here?
Indeed, two macros with very simlar names. Thanks for spotting it!
>
> The rest of the patch LGTM.
>
> Thanks,
>
> Jessica Zhang
>
> > + stride = round_up(stride * 4 / 3, 256);
> > y_tile_width = 48;
> > } else {
> > - stride = MSM_MEDIA_ALIGN(fb->width * 2, 256);
> > + stride = round_up(fb->width * 2, 256);
> > y_tile_width = 32;
> > }
> > - sclines = MSM_MEDIA_ALIGN(fb->height, 16);
> > + sclines = round_up(fb->height, 16);
> > y_tile_height = 4;
> > } else {
> > - stride = MSM_MEDIA_ALIGN(fb->width, 128);
> > + stride = round_up(fb->width, 128);
> > y_tile_width = 32;
> > - sclines = MSM_MEDIA_ALIGN(fb->height, 32);
> > + sclines = round_up(fb->height, 32);
> > y_tile_height = 8;
> > }
> > }
> > layout->plane_pitch[0] = stride;
> > - layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
> > + layout->plane_size[0] = round_up(layout->plane_pitch[0] *
> > sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> > layout->plane_pitch[1] = stride;
> > - layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] *
> > + layout->plane_size[1] = round_up(layout->plane_pitch[1] *
> > sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> > if (!meta)
> > return 0;
> > - y_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, y_tile_width);
> > - layout->plane_pitch[2] = MSM_MEDIA_ALIGN(y_meta_stride, 64);
> > + y_meta_stride = DIV_ROUND_UP(fb->width, y_tile_width);
> > + layout->plane_pitch[2] = round_up(y_meta_stride, 64);
> > - y_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, y_tile_height);
> > - y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
> > - layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
> > + y_meta_scanlines = DIV_ROUND_UP(fb->height, y_tile_height);
> > + y_meta_scanlines = round_up(y_meta_scanlines, 16);
> > + layout->plane_size[2] = round_up(layout->plane_pitch[2] *
> > y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> > - uv_meta_stride = MSM_MEDIA_ROUNDUP((fb->width+1)>>1, y_tile_width / 2);
> > - layout->plane_pitch[3] = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
> > + uv_meta_stride = DIV_ROUND_UP((fb->width+1)>>1, y_tile_width / 2);
> > + layout->plane_pitch[3] = round_up(uv_meta_stride, 64);
> > - uv_meta_scanlines = MSM_MEDIA_ROUNDUP((fb->height+1)>>1, y_tile_height);
> > - uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
> > - layout->plane_size[3] = MSM_MEDIA_ALIGN(layout->plane_pitch[3] *
> > + uv_meta_scanlines = DIV_ROUND_UP((fb->height+1)>>1, y_tile_height);
> > + uv_meta_scanlines = round_up(uv_meta_scanlines, 16);
> > + layout->plane_size[3] = round_up(layout->plane_pitch[3] *
> > uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> > } else {
> > unsigned int rgb_scanlines, rgb_meta_scanlines, rgb_meta_stride;
> > - layout->plane_pitch[0] = MSM_MEDIA_ALIGN(fb->width * fmt->bpp, 256);
> > - rgb_scanlines = MSM_MEDIA_ALIGN(fb->height, 16);
> > - layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] *
> > + layout->plane_pitch[0] = round_up(fb->width * fmt->bpp, 256);
> > + rgb_scanlines = round_up(fb->height, 16);
> > + layout->plane_size[0] = round_up(layout->plane_pitch[0] *
> > rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> > if (!meta)
> > @@ -139,13 +129,13 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> > /* uAPI leaves plane[1] empty and plane[2] as meta */
> > layout->num_planes += 1;
> > - rgb_meta_stride = MSM_MEDIA_ROUNDUP(fb->width, 16);
> > - layout->plane_pitch[2] = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
> > + rgb_meta_stride = DIV_ROUND_UP(fb->width, 16);
> > + layout->plane_pitch[2] = round_up(rgb_meta_stride, 64);
> > - rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(fb->height, 4);
> > - rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
> > + rgb_meta_scanlines = DIV_ROUND_UP(fb->height, 4);
> > + rgb_meta_scanlines = round_up(rgb_meta_scanlines, 16);
> > - layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] *
> > + layout->plane_size[2] = round_up(layout->plane_pitch[2] *
> > rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> > }
> >
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 27+ messages in thread