Currently, CWB allocation only supports a single pair of CWB muxes and dedicated pingpong blocks. In quad-pipe topologies, two pairs of CWB blocks are required to feed concurrent writeback paths.
Because each Layer Mixer (LM) iteration previously restarted the search from CWB index 0, allocating a second pair would attempt to re-evaluate already considered or reserved CWB blocks. Track the start search index (`cwb_mux_idx_start`) and advance it past the most recently assigned CWB block. This ensures subsequent LMs only scan unallocated CWB blocks, enabling support for multiple CWB pairs. Signed-off-by: Jun Nie <[email protected]> --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 7e77d88f8959..4ada16cf8610 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -244,6 +244,7 @@ static int _dpu_rm_reserve_cwb_mux_and_pingpongs(struct dpu_rm *rm, int cwb_pp_start_idx = PINGPONG_CWB_0 - PINGPONG_0; int cwb_pp_idx[MAX_BLOCKS]; int cwb_mux_idx[MAX_BLOCKS]; + int cwb_mux_idx_start = 0; /* * Reserve additional dedicated CWB PINGPONG blocks and muxes for each @@ -252,9 +253,9 @@ static int _dpu_rm_reserve_cwb_mux_and_pingpongs(struct dpu_rm *rm, * TODO: add support reserving resources for platforms with no * PINGPONG_CWB */ - for (int i = 0; i < ARRAY_SIZE(rm->mixer_blks) && + for (int i = 0; i < ARRAY_SIZE(rm->cwb_blks) && cwb_mux_count < num_cwb_mux; i++) { - for (int j = 0; j < ARRAY_SIZE(rm->cwb_blks); j++) { + for (int j = cwb_mux_idx_start; j < ARRAY_SIZE(rm->cwb_blks); j++) { /* * Odd LMs must be assigned to odd CWB muxes and even * LMs with even CWB muxes. @@ -268,6 +269,11 @@ static int _dpu_rm_reserve_cwb_mux_and_pingpongs(struct dpu_rm *rm, i % 2 != j % 2) continue; + /* + * Advance search offset past the allocated block so + * subsequent mixers allocate the next available CWB block. + */ + cwb_mux_idx_start = j + 1; cwb_mux_idx[cwb_mux_count] = j; cwb_pp_idx[cwb_mux_count] = j + cwb_pp_start_idx; cwb_mux_count++; -- 2.53.0
