Skip to content

Commit 42f62cd

Browse files
committed
drm/msm/dpu: try reserving the DSPP-less LM first
On most of the platforms only some mixers have connected DSPP blocks. If DSPP is not required for the CRTC, try looking for the LM with no DSSP block, leaving DSPP-enabled LMs to CRTCs which actually require those. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/698773/ Link: https://lore.kernel.org/r/20260115-dpu-fix-dspp-v1-2-b73152c147b3@oss.qualcomm.com
1 parent 98c8f14 commit 42f62cd

1 file changed

Lines changed: 38 additions & 14 deletions

File tree

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

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,28 +350,26 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm,
350350
return true;
351351
}
352352

353-
static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
354-
struct dpu_global_state *global_state,
355-
uint32_t crtc_id,
356-
struct msm_display_topology *topology)
353+
static bool dpu_rm_find_lms(struct dpu_rm *rm,
354+
struct dpu_global_state *global_state,
355+
uint32_t crtc_id, bool skip_dspp,
356+
struct msm_display_topology *topology,
357+
int *lm_idx, int *pp_idx, int *dspp_idx)
357358

358359
{
359-
int lm_idx[MAX_BLOCKS];
360-
int pp_idx[MAX_BLOCKS];
361-
int dspp_idx[MAX_BLOCKS] = {0};
362360
int i, lm_count = 0;
363361

364-
if (!topology->num_lm) {
365-
DPU_ERROR("zero LMs in topology\n");
366-
return -EINVAL;
367-
}
368-
369362
/* Find a primary mixer */
370363
for (i = 0; i < ARRAY_SIZE(rm->mixer_blks) &&
371364
lm_count < topology->num_lm; i++) {
372365
if (!rm->mixer_blks[i])
373366
continue;
374367

368+
if (skip_dspp && to_dpu_hw_mixer(rm->mixer_blks[i])->cap->dspp) {
369+
DPU_DEBUG("Skipping LM_%d, skipping LMs with DSPPs\n", i);
370+
continue;
371+
}
372+
375373
/*
376374
* Reset lm_count to an even index. This will drop the previous
377375
* primary mixer if failed to find its peer.
@@ -410,12 +408,38 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
410408
}
411409
}
412410

413-
if (lm_count != topology->num_lm) {
411+
return lm_count == topology->num_lm;
412+
}
413+
414+
static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
415+
struct dpu_global_state *global_state,
416+
uint32_t crtc_id,
417+
struct msm_display_topology *topology)
418+
419+
{
420+
int lm_idx[MAX_BLOCKS];
421+
int pp_idx[MAX_BLOCKS];
422+
int dspp_idx[MAX_BLOCKS] = {0};
423+
int i;
424+
bool found;
425+
426+
if (!topology->num_lm) {
427+
DPU_ERROR("zero LMs in topology\n");
428+
return -EINVAL;
429+
}
430+
431+
/* Try using non-DSPP LM blocks first */
432+
found = dpu_rm_find_lms(rm, global_state, crtc_id, !topology->num_dspp,
433+
topology, lm_idx, pp_idx, dspp_idx);
434+
if (!found && !topology->num_dspp)
435+
found = dpu_rm_find_lms(rm, global_state, crtc_id, false,
436+
topology, lm_idx, pp_idx, dspp_idx);
437+
if (!found) {
414438
DPU_DEBUG("unable to find appropriate mixers\n");
415439
return -ENAVAIL;
416440
}
417441

418-
for (i = 0; i < lm_count; i++) {
442+
for (i = 0; i < topology->num_lm; i++) {
419443
global_state->mixer_to_crtc_id[lm_idx[i]] = crtc_id;
420444
global_state->pingpong_to_crtc_id[pp_idx[i]] = crtc_id;
421445
global_state->dspp_to_crtc_id[dspp_idx[i]] =

0 commit comments

Comments
 (0)