Skip to content

Commit b8afe9f

Browse files
committed
drm/msm/dpu: fix/enable 6bpc dither with split-lm
If split-lm is used (for ex, on sdm845), we can have multiple ping- pongs, but only a single phys encoder. We need to configure dithering on each of them. Signed-off-by: Rob Clark <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> Reviewed-by: Kalyan Thota <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent 57c0bd5 commit b8afe9f

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ static u32 dither_matrix[DITHER_MATRIX_SZ] = {
212212
15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10
213213
};
214214

215-
static void _dpu_encoder_setup_dither(struct dpu_encoder_phys *phys)
215+
static void _dpu_encoder_setup_dither(struct dpu_hw_pingpong *hw_pp, unsigned bpc)
216216
{
217217
struct dpu_hw_dither_cfg dither_cfg = { 0 };
218218

219-
if (!phys->hw_pp || !phys->hw_pp->ops.setup_dither)
219+
if (!hw_pp->ops.setup_dither)
220220
return;
221221

222-
switch (phys->connector->display_info.bpc) {
222+
switch (bpc) {
223223
case 6:
224224
dither_cfg.c0_bitdepth = 6;
225225
dither_cfg.c1_bitdepth = 6;
@@ -228,14 +228,14 @@ static void _dpu_encoder_setup_dither(struct dpu_encoder_phys *phys)
228228
dither_cfg.temporal_en = 0;
229229
break;
230230
default:
231-
phys->hw_pp->ops.setup_dither(phys->hw_pp, NULL);
231+
hw_pp->ops.setup_dither(hw_pp, NULL);
232232
return;
233233
}
234234

235235
memcpy(&dither_cfg.matrix, dither_matrix,
236236
sizeof(u32) * DITHER_MATRIX_SZ);
237237

238-
phys->hw_pp->ops.setup_dither(phys->hw_pp, &dither_cfg);
238+
hw_pp->ops.setup_dither(hw_pp, &dither_cfg);
239239
}
240240

241241
void dpu_encoder_helper_report_irq_timeout(struct dpu_encoder_phys *phys_enc,
@@ -1113,11 +1113,13 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)
11131113

11141114
_dpu_encoder_update_vsync_source(dpu_enc, &dpu_enc->disp_info);
11151115

1116-
if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI) {
1117-
for (i = 0; i < dpu_enc->num_phys_encs; i++) {
1118-
struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
1119-
1120-
_dpu_encoder_setup_dither(phys);
1116+
if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI &&
1117+
!WARN_ON(dpu_enc->num_phys_encs == 0)) {
1118+
unsigned bpc = dpu_enc->phys_encs[0]->connector->display_info.bpc;
1119+
for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) {
1120+
if (!dpu_enc->hw_pp[i])
1121+
continue;
1122+
_dpu_encoder_setup_dither(dpu_enc->hw_pp[i], bpc);
11211123
}
11221124
}
11231125
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c,
231231
c->ops.poll_timeout_wr_ptr = dpu_hw_pp_poll_timeout_wr_ptr;
232232
c->ops.get_line_count = dpu_hw_pp_get_line_count;
233233

234-
if (test_bit(DPU_PINGPONG_DITHER, &features) &&
235-
IS_SC7180_TARGET(c->hw.hwversion))
234+
if (test_bit(DPU_PINGPONG_DITHER, &features))
236235
c->ops.setup_dither = dpu_hw_pp_setup_dither;
237236
};
238237

0 commit comments

Comments
 (0)