Skip to content

Commit 5e317a6

Browse files
committed
drm/msm/dpu: drop msm_format from struct dpu_hw_fmt_layout
The struct dpu_hw_fmt_layout defines hardware data layout (addresses, sizes and pitches. Drop format field from this structure as it's not a part of the data layout. Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/612242/ Link: https://lore.kernel.org/r/20240903-dpu-mode-config-width-v6-7-617e1ecc4b7a@linaro.org
1 parent ce35787 commit 5e317a6

5 files changed

Lines changed: 25 additions & 38 deletions

File tree

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ static void dpu_encoder_phys_wb_set_qos(struct dpu_encoder_phys *phys_enc)
166166
/**
167167
* dpu_encoder_phys_wb_setup_fb - setup output framebuffer
168168
* @phys_enc: Pointer to physical encoder
169-
* @fb: Pointer to output framebuffer
169+
* @format: Format of the framebuffer
170170
*/
171171
static void dpu_encoder_phys_wb_setup_fb(struct dpu_encoder_phys *phys_enc,
172-
struct drm_framebuffer *fb)
172+
const struct msm_format *format)
173173
{
174174
struct dpu_encoder_phys_wb *wb_enc = to_dpu_encoder_phys_wb(phys_enc);
175175
struct dpu_hw_wb *hw_wb;
@@ -193,12 +193,12 @@ static void dpu_encoder_phys_wb_setup_fb(struct dpu_encoder_phys *phys_enc,
193193
hw_wb->ops.setup_roi(hw_wb, wb_cfg);
194194

195195
if (hw_wb->ops.setup_outformat)
196-
hw_wb->ops.setup_outformat(hw_wb, wb_cfg);
196+
hw_wb->ops.setup_outformat(hw_wb, wb_cfg, format);
197197

198198
if (hw_wb->ops.setup_cdp) {
199199
const struct dpu_perf_cfg *perf = phys_enc->dpu_kms->catalog->perf;
200200

201-
hw_wb->ops.setup_cdp(hw_wb, wb_cfg->dest.format,
201+
hw_wb->ops.setup_cdp(hw_wb, format,
202202
perf->cdp_cfg[DPU_PERF_CDP_USAGE_NRT].wr_enable);
203203
}
204204

@@ -321,15 +321,10 @@ static void dpu_encoder_phys_wb_setup(
321321
{
322322
struct dpu_hw_wb *hw_wb = phys_enc->hw_wb;
323323
struct drm_display_mode mode = phys_enc->cached_mode;
324-
struct drm_framebuffer *fb = NULL;
325324
struct dpu_encoder_phys_wb *wb_enc = to_dpu_encoder_phys_wb(phys_enc);
326-
struct drm_writeback_job *wb_job;
327325
const struct msm_format *format;
328-
const struct msm_format *dpu_fmt;
329326

330-
wb_job = wb_enc->wb_job;
331327
format = msm_framebuffer_format(wb_enc->wb_job->fb);
332-
dpu_fmt = mdp_get_format(&phys_enc->dpu_kms->base, format->pixel_format, wb_job->fb->modifier);
333328

334329
DPU_DEBUG("[mode_set:%d, \"%s\",%d,%d]\n",
335330
hw_wb->idx - WB_0, mode.name,
@@ -341,9 +336,9 @@ static void dpu_encoder_phys_wb_setup(
341336

342337
dpu_encoder_phys_wb_set_qos(phys_enc);
343338

344-
dpu_encoder_phys_wb_setup_fb(phys_enc, fb);
339+
dpu_encoder_phys_wb_setup_fb(phys_enc, format);
345340

346-
dpu_encoder_helper_phys_setup_cdm(phys_enc, dpu_fmt, CDM_CDWN_OUTPUT_WB);
341+
dpu_encoder_helper_phys_setup_cdm(phys_enc, format, CDM_CDWN_OUTPUT_WB);
347342

348343
dpu_encoder_phys_wb_setup_ctl(phys_enc);
349344
}
@@ -587,14 +582,6 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc
587582

588583
format = msm_framebuffer_format(job->fb);
589584

590-
wb_cfg->dest.format = mdp_get_format(&phys_enc->dpu_kms->base,
591-
format->pixel_format, job->fb->modifier);
592-
if (!wb_cfg->dest.format) {
593-
/* this error should be detected during atomic_check */
594-
DPU_ERROR("failed to get format %p4cc\n", &format->pixel_format);
595-
return;
596-
}
597-
598585
ret = dpu_format_populate_layout(aspace, job->fb, &wb_cfg->dest);
599586
if (ret) {
600587
DPU_DEBUG("failed to populate layout %d\n", ret);
@@ -603,10 +590,10 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc
603590

604591
wb_cfg->dest.width = job->fb->width;
605592
wb_cfg->dest.height = job->fb->height;
606-
wb_cfg->dest.num_planes = wb_cfg->dest.format->num_planes;
593+
wb_cfg->dest.num_planes = format->num_planes;
607594

608-
if ((wb_cfg->dest.format->fetch_type == MDP_PLANE_PLANAR) &&
609-
(wb_cfg->dest.format->element[0] == C1_B_Cb))
595+
if ((format->fetch_type == MDP_PLANE_PLANAR) &&
596+
(format->element[0] == C1_B_Cb))
610597
swap(wb_cfg->dest.plane_addr[1], wb_cfg->dest.plane_addr[2]);
611598

612599
DPU_DEBUG("[fb_offset:%8.8x,%8.8x,%8.8x,%8.8x]\n",

drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ static int _dpu_format_get_plane_sizes_ubwc(
104104
bool meta = MSM_FORMAT_IS_UBWC(fmt);
105105

106106
memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
107-
layout->format = fmt;
108107
layout->width = width;
109108
layout->height = height;
110109
layout->num_planes = fmt->num_planes;
@@ -116,7 +115,7 @@ static int _dpu_format_get_plane_sizes_ubwc(
116115
return -EINVAL;
117116
}
118117

119-
if (MSM_FORMAT_IS_YUV(layout->format)) {
118+
if (MSM_FORMAT_IS_YUV(fmt)) {
120119
uint32_t y_sclines, uv_sclines;
121120
uint32_t y_meta_scanlines = 0;
122121
uint32_t uv_meta_scanlines = 0;
@@ -182,16 +181,15 @@ static int _dpu_format_get_plane_sizes_linear(
182181
int i;
183182

184183
memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
185-
layout->format = fmt;
186184
layout->width = width;
187185
layout->height = height;
188186
layout->num_planes = fmt->num_planes;
189187

190188
/* Due to memset above, only need to set planes of interest */
191189
if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) {
192190
layout->num_planes = 1;
193-
layout->plane_size[0] = width * height * layout->format->bpp;
194-
layout->plane_pitch[0] = width * layout->format->bpp;
191+
layout->plane_size[0] = width * height * fmt->bpp;
192+
layout->plane_pitch[0] = width * fmt->bpp;
195193
} else {
196194
uint32_t v_subsample, h_subsample;
197195
uint32_t chroma_samp;
@@ -272,6 +270,7 @@ static int _dpu_format_populate_addrs_ubwc(
272270
struct drm_framebuffer *fb,
273271
struct dpu_hw_fmt_layout *layout)
274272
{
273+
const struct msm_format *fmt;
275274
uint32_t base_addr = 0;
276275
bool meta;
277276

@@ -286,10 +285,11 @@ static int _dpu_format_populate_addrs_ubwc(
286285
return -EFAULT;
287286
}
288287

289-
meta = MSM_FORMAT_IS_UBWC(layout->format);
288+
fmt = msm_framebuffer_format(fb);
289+
meta = MSM_FORMAT_IS_UBWC(fmt);
290290

291291
/* Per-format logic for verifying active planes */
292-
if (MSM_FORMAT_IS_YUV(layout->format)) {
292+
if (MSM_FORMAT_IS_YUV(fmt)) {
293293
/************************************************/
294294
/* UBWC ** */
295295
/* buffer ** DPU PLANE */
@@ -390,6 +390,7 @@ int dpu_format_populate_layout(
390390
struct drm_framebuffer *fb,
391391
struct dpu_hw_fmt_layout *layout)
392392
{
393+
const struct msm_format *fmt;
393394
int ret;
394395

395396
if (!fb || !layout) {
@@ -403,17 +404,17 @@ int dpu_format_populate_layout(
403404
return -ERANGE;
404405
}
405406

406-
layout->format = msm_framebuffer_format(fb);
407+
fmt = msm_framebuffer_format(fb);
407408

408409
/* Populate the plane sizes etc via get_format */
409-
ret = dpu_format_get_plane_sizes(layout->format, fb->width, fb->height,
410+
ret = dpu_format_get_plane_sizes(fmt, fb->width, fb->height,
410411
layout, fb->pitches);
411412
if (ret)
412413
return ret;
413414

414415
/* Populate the addresses given the fb */
415-
if (MSM_FORMAT_IS_UBWC(layout->format) ||
416-
MSM_FORMAT_IS_TILE(layout->format))
416+
if (MSM_FORMAT_IS_UBWC(fmt) ||
417+
MSM_FORMAT_IS_TILE(fmt))
417418
ret = _dpu_format_populate_addrs_ubwc(aspace, fb, layout);
418419
else
419420
ret = _dpu_format_populate_addrs_linear(aspace, fb, layout);

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ enum dpu_3d_blend_mode {
293293

294294
/**
295295
* struct dpu_hw_fmt_layout - format information of the source pixel data
296-
* @format: pixel format parameters
297296
* @num_planes: number of planes (including meta data planes)
298297
* @width: image width
299298
* @height: image height
@@ -303,7 +302,6 @@ enum dpu_3d_blend_mode {
303302
* @plane_pitch: pitch of each plane
304303
*/
305304
struct dpu_hw_fmt_layout {
306-
const struct msm_format *format;
307305
uint32_t num_planes;
308306
uint32_t width;
309307
uint32_t height;

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ static void dpu_hw_wb_setup_outaddress(struct dpu_hw_wb *ctx,
6464
}
6565

6666
static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx,
67-
struct dpu_hw_wb_cfg *data)
67+
struct dpu_hw_wb_cfg *data,
68+
const struct msm_format *fmt)
6869
{
6970
struct dpu_hw_blk_reg_map *c = &ctx->hw;
70-
const struct msm_format *fmt = data->dest.format;
7171
u32 dst_format, pattern, ystride0, ystride1, outsize, chroma_samp;
7272
u32 write_config = 0;
7373
u32 opmode = 0;

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ struct dpu_hw_wb_ops {
3737
struct dpu_hw_wb_cfg *wb);
3838

3939
void (*setup_outformat)(struct dpu_hw_wb *ctx,
40-
struct dpu_hw_wb_cfg *wb);
40+
struct dpu_hw_wb_cfg *wb,
41+
const struct msm_format *fmt);
4142

4243
void (*setup_roi)(struct dpu_hw_wb *ctx,
4344
struct dpu_hw_wb_cfg *wb);

0 commit comments

Comments
 (0)