drm/msm/dpu: fix pipe ordering for source-split planes
cover drm/msm/dpu: fix pipe ordering for source-split planes
Virtual planes can use two SSPPs when a plane exceeds the single-pipe width or clock limit and parallel multirect cannot be used. The pair can contain different SSPP types, depending on resource availability.
This series handles source split ordering for those pairs:
1. Keep the higher priority SSPP on the left before DPU 5.0.
2. Add the SRC_SPLIT_ORDER operation for DPU 5.0 through 12.x.
3. Program the order from the destination X positions, clearing the bit for the left source and sources without a sibling.
4. Add the operation for the DPU 13.x SSPP rectangle banks.
---
Mahadevan P (4):
drm/msm/dpu: keep SSPP priority order for split planes on DPU < 5.0 drm/msm/dpu: add SSPP op to program the source split order drm/msm/dpu: program the source split order for split planes drm/msm/dpu: add source split order op for DPU 13.x
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 19 ++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 35 +++++++++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 11 ++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c | 14 ++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +++ 5 files changed, 83 insertions(+)
---
base-commit: aac26bee2287c88af5be5a5ff96d783b19a28790
change-id: 20261009-pipe_order-87a83717ac4c
Best regards,
Signature · 1 line
Mahadevan P <[email protected]>
PATCH 1/4 drm/msm/dpu: keep SSPP priority order for split planes on DPU < 5.0
Before DPU 5.0, the layer mixer places the higher priority SSPP on the left of a source-split pair. Priority follows the SSPP index (VIG, RGB, DMA), while allocation prefers DMA, RGB, then VIG.
Swap the two SSPPs when the right one has the lower index. Both are reserved with the same requirements. Same-SSPP parallel multirect already puts RECT_0, the higher priority rectangle, on the left.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +4 -0
@@ -1245,6 +1245,10 @@ static int dpu_plane_assign_resource_in_stage(struct dpu_sw_pipe *pipe, r_pipe->multirect_index =DPU_SSPP_RECT_SOLO ; r_pipe->multirect_mode =DPU_SSPP_MULTIRECT_NONE ; +if (dpu_kms->catalog->mdss_ver->core_major_ver <5 && + r_pipe->sspp->idx < pipe->sspp->idx) +swap (pipe->sspp, r_pipe->sspp); +return 0 ; }
Signature · 1 line
2.34.1
Re: [PATCH 1/4] drm/msm/dpu: keep SSPP priority order for split planes on DPU < 5.0
Quoted 8 lines · Mahadevan P
Before DPU 5.0, the layer mixer places the higher priority SSPP on the left of a source-split pair. Priority follows the SSPP index (VIG, RGB, DMA), while allocation prefers DMA, RGB, then VIG.
Swap the two SSPPs when the right one has the lower index. Both are reserved with the same requirements. Same-SSPP parallel multirect already puts
RECT_0, the higher priority rectangle, on the left.
Quoted 7 lines
Fixes 8c62a31607f6 ("drm/msm/dpu: allow using two SSPP blocks for a single plane")Assisted-by LLMSigned-off-by Mahadevan P <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++++ 1 file changed, 4 insertions(+)
Signature · 2 lines
With best wishes Dmitry
PATCH 2/4 drm/msm/dpu: add SSPP op to program the source split order
In reply to Mahadevan PDPU 5.0 introduced SRC_SPLIT_ORDER in bit 4 of SSPP_SRC_OP_MODE and SSPP_SRC_OP_MODE_REC1. For source-split pairs using legacy CTL routing, this field identifies the left source with 0 and the right source with 1.
Add a setup_src_split_order() operation for the SSPP register layout used on DPU 5.0 through 12.x. Select SSPP_SRC_OP_MODE for SOLO or RECT0 and SSPP_SRC_OP_MODE_REC1 for RECT1, and update only the ordering bit.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 35 +++++++++++++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 11 +++++++++ 2 files changed, 46 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +35 -0
@@ -84,6 +84,7 @@#define MDSS_MDP_OP_IGC_EN BIT(16)#define MDSS_MDP_OP_FLIP_UD BIT(14)#define MDSS_MDP_OP_FLIP_LR BIT(13) +#define MDSS_MDP_OP_SRC_SPLIT_ORDER BIT(4)#define MDSS_MDP_OP_BWC_EN BIT(0)#define MDSS_MDP_OP_PE_OVERRIDE BIT(31)#define MDSS_MDP_OP_BWC_LOSSLESS (0 << 1)
@@ -260,6 +261,38 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, ubwc_ctrl_off, ubwc_error_off); } +void dpu_hw_setup_src_split_order_impl (struct dpu_hw_sspp *ctx, +u32 op_mode_off,bool right) +{ +u32 opmode; + + opmode =DPU_REG_READ (&ctx->hw, op_mode_off); +if (right) + opmode |=MDSS_MDP_OP_SRC_SPLIT_ORDER ; +else + opmode &= ~MDSS_MDP_OP_SRC_SPLIT_ORDER ; + +DPU_REG_WRITE (&ctx->hw, op_mode_off, opmode); +} + +static void dpu_hw_sspp_setup_src_split_order (struct dpu_sw_pipe *pipe, +bool right) +{ +struct dpu_hw_sspp *ctx = pipe->sspp; +u32 op_mode_off; + +if (!ctx) +return ; + +if (pipe->multirect_index ==DPU_SSPP_RECT_SOLO || + pipe->multirect_index ==DPU_SSPP_RECT_0 ) + op_mode_off =SSPP_SRC_OP_MODE ; +else + op_mode_off =SSPP_SRC_OP_MODE_REC1 ; + +dpu_hw_setup_src_split_order_impl (ctx, op_mode_off, right); +} + void dpu_hw_setup_format_impl(struct dpu_sw_pipe *pipe, const struct msm_format *fmt, u32 flags, struct dpu_hw_sspp *ctx, u32 op_mode_off, u32 unpack_pat_off, u32 format_off, u32 ubwc_ctrl_off,
@@ -636,6 +669,8 @@ static void _setup_layer_ops(struct dpu_hw_sspp *c, c->ops.setup_sourceaddress = dpu_hw_sspp_setup_sourceaddress; c->ops.setup_solidfill = dpu_hw_sspp_setup_solidfill; c->ops.setup_pe = dpu_hw_sspp_setup_pe_config; +if (mdss_rev->core_major_ver >=5 ) + c->ops.setup_src_split_order = dpu_hw_sspp_setup_src_split_order;if (test_bit (DPU_SSPP_QOS , &features)) { c->ops.setup_qos_lut = dpu_hw_sspp_setup_qos_lut;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +11 -0
@@ -236,6 +236,14 @@ struct dpu_hw_sspp_ops {void (*setup_multirect)(struct dpu_sw_pipe *pipe); +/** +* @setup_src_split_order: program the position of the pipe within +* a source split pair +* @pipe: Pointer to pipe context +* @right: true if the pipe fetches the right half of the pair +*/ +void (*setup_src_split_order)(struct dpu_sw_pipe *pipe,bool right); +/** * @setup_sharpening: setup sharpening * @ctx: Pointer to pipe context
@@ -349,6 +357,9 @@ void dpu_hw_setup_multirect_impl(struct dpu_sw_pipe *pipe,struct dpu_hw_sspp *ctx, u32 op_mode_off); +void dpu_hw_setup_src_split_order_impl (struct dpu_hw_sspp *ctx, +u32 op_mode_off,bool right); + void dpu_hw_setup_format_impl(struct dpu_sw_pipe *pipe, const struct msm_format *fmt, u32 flags, struct dpu_hw_sspp *ctx, u32 op_mode_off, u32 unpack_pat_off, u32 format_off,
Signature · 1 line
2.34.1
Re: [PATCH 2/4] drm/msm/dpu: add SSPP op to program the source split order
Quoted 28 lines · Mahadevan P
DPU 5.0 introduced
SRC_SPLIT_ORDERin bit 4 ofSSPP_SRC_OP_MODEandSSPP_SRC_OP_MODE_REC1. For source-split pairs using legacy CTL routing, this field identifies the left source with 0 and the right source with 1.Add a
setup_src_split_order()operation for the SSPP register layout used on DPU 5.0 through 12.x. SelectSSPP_SRC_OP_MODEfor SOLO or RECT0 andSSPP_SRC_OP_MODE_REC1for RECT1, and update only the ordering bit.Assisted-by LLMSigned-off-by Mahadevan P <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 35 +++++++++++++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 11 +++++++++ 2 files changed, 46 insertions(+)drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +1
-0@@ -84,6 +84,7 @@#define MDSS_MDP_OP_IGC_EN BIT(16)#define MDSS_MDP_OP_FLIP_UD BIT(14)#define MDSS_MDP_OP_FLIP_LR BIT(13) +#define MDSS_MDP_OP_SRC_SPLIT_ORDER BIT(4)#define MDSS_MDP_OP_BWC_EN BIT(0)#define MDSS_MDP_OP_PE_OVERRIDE BIT(31)#define MDSS_MDP_OP_BWC_LOSSLESS (0 << 1)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, · line 265
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +2
-0@@ -260,6 +261,38 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe, ubwc_ctrl_off, ubwc_error_off); } +void dpu_hw_setup_src_split_order_impl (struct dpu_hw_sspp *ctx, +u32 op_mode_off,bool right)
static
Quoted 32 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +12
-0+{ +u32 opmode; + + opmode =DPU_REG_READ (&ctx->hw, op_mode_off); +if (right) + opmode |=MDSS_MDP_OP_SRC_SPLIT_ORDER ; +else + opmode &= ~MDSS_MDP_OP_SRC_SPLIT_ORDER ; + +DPU_REG_WRITE (&ctx->hw, op_mode_off, opmode); +} +drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +8
-0@@ -236,6 +236,14 @@ struct dpu_hw_sspp_ops {void (*setup_multirect)(struct dpu_sw_pipe *pipe); +/** +* @setup_src_split_order: program the position of the pipe within +* a source split pair +* @pipe: Pointer to pipe context +* @right: true if the pipe fetches the right half of the pair +*/ +void (*setup_src_split_order)(struct dpu_sw_pipe *pipe,bool right); +/** * @setup_sharpening: setup sharpening * @ctx: Pointer to pipe context
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h void dpu_hw_setup_multirect_impl(struct dpu_sw_pipe *pipe, · line 361
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +2
-0@@ -349,6 +357,9 @@ void dpu_hw_setup_multirect_impl(struct dpu_sw_pipe *pipe,struct dpu_hw_sspp *ctx, u32 op_mode_off); +void dpu_hw_setup_src_split_order_impl (struct dpu_hw_sspp *ctx, +u32 op_mode_off,bool right);
It's not used outside of the original file, drop.
Quoted 8 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +1
-0+ void dpu_hw_setup_format_impl(struct dpu_sw_pipe *pipe, const struct msm_format *fmt, u32 flags, struct dpu_hw_sspp *ctx, u32 op_mode_off, u32 unpack_pat_off, u32 format_off,Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
PATCH 3/4 drm/msm/dpu: program the source split order for split planes
In reply to Mahadevan PVirtual planes can use two SSPPs when a plane exceeds the single-pipe width or clock limit and parallel multirect cannot be used.
Program SRC_SPLIT_ORDER during mixer setup from the pipes' destination X positions. Set the bit for the right source and clear it for the left source or a source without a sibling.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +19 -0
@@ -434,6 +434,18 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, mixer[lm_idx].lm_ctl->ops.update_pending_flush_sspp (mixer[lm_idx].lm_ctl, sspp_idx); } +static bool _dpu_crtc_pipe_is_right (const struct dpu_plane_state *pstate, +unsigned int pipe_idx) +{ +unsigned int other_idx = pipe_idx ^1 ; + +if (!pstate->pipe[other_idx].sspp) +return false; + +return pstate->pipe_cfg[pipe_idx].dst_rect.x1 > + pstate->pipe_cfg[other_idx].dst_rect.x1; +} +static void _dpu_crtc_blend_setup_mixer (struct drm_crtc *crtc,struct dpu_crtc *dpu_crtc,struct dpu_crtc_mixer *mixer,struct dpu_hw_stage_cfg *stage_cfg)
@@ -443,10 +455,13 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,struct drm_plane_state *state;struct dpu_crtc_state *cstate =to_dpu_crtc_state (crtc->state);struct dpu_plane_state *pstate =NULL ; +struct dpu_sw_pipe *pipe;const struct msm_format *format;struct dpu_hw_ctl *ctl = mixer->lm_ctl;u32 lm_idx, stage, i, pipe_idx, head_pipe_in_stage, lms_in_pair;bool bg_alpha_enable = false; +bool src_split =test_bit (DPU_MIXER_SOURCESPLIT , + &mixer->hw_lm->cap->features);DECLARE_BITMAP (active_fetch,SSPP_MAX );DECLARE_BITMAP (active_pipes,SSPP_MAX );
@@ -475,6 +490,10 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, pipe_idx = i + head_pipe_in_stage;if (!pstate->pipe[pipe_idx].sspp)continue ; + pipe = &pstate->pipe[pipe_idx]; +if (src_split && pipe->sspp->ops.setup_src_split_order) + pipe->sspp->ops.setup_src_split_order (pipe, +_dpu_crtc_pipe_is_right (pstate, pipe_idx)); lms_in_pair =min (cstate->num_mixers - (stage *PIPES_PER_STAGE ),PIPES_PER_STAGE );set_bit (pstate->pipe[pipe_idx].sspp->idx, active_fetch);
Signature · 1 line
2.34.1
Re: [PATCH 3/4] drm/msm/dpu: program the source split order for split planes
Quoted 22 lines · Mahadevan P
Virtual planes can use two SSPPs when a plane exceeds the single-pipe width or clock limit and parallel multirect cannot be used.
Program
SRC_SPLIT_ORDERduring mixer setup from the pipes' destination X positions. Set the bit for the right source and clear it for the left source or a source without a sibling.Fixes 8c62a31607f6 ("drm/msm/dpu: allow using two SSPP blocks for a single plane")Assisted-by LLMSigned-off-by Mahadevan P <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0
-0@@ -434,6 +434,18 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, mixer[lm_idx].lm_ctl->ops.update_pending_flush_sspp (mixer[lm_idx].lm_ctl, sspp_idx); }
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, · line 446
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +10
-0+static bool _dpu_crtc_pipe_is_right (const struct dpu_plane_state *pstate, +unsigned int pipe_idx) +{ +unsigned int other_idx = pipe_idx ^1 ; + +if (!pstate->pipe[other_idx].sspp) +return false; + +return pstate->pipe_cfg[pipe_idx].dst_rect.x1 > + pstate->pipe_cfg[other_idx].dst_rect.x1;
We know that the right plane has odd index. This is a total overkill.
Quoted 34 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +9
-0+} +static void _dpu_crtc_blend_setup_mixer (struct drm_crtc *crtc,struct dpu_crtc *dpu_crtc,struct dpu_crtc_mixer *mixer,struct dpu_hw_stage_cfg *stage_cfg)@@ -443,10 +455,13 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,struct drm_plane_state *state;struct dpu_crtc_state *cstate =to_dpu_crtc_state (crtc->state);struct dpu_plane_state *pstate =NULL ; +struct dpu_sw_pipe *pipe;const struct msm_format *format;struct dpu_hw_ctl *ctl = mixer->lm_ctl;u32 lm_idx, stage, i, pipe_idx, head_pipe_in_stage, lms_in_pair;bool bg_alpha_enable = false; +bool src_split =test_bit (DPU_MIXER_SOURCESPLIT , + &mixer->hw_lm->cap->features);DECLARE_BITMAP (active_fetch,SSPP_MAX );DECLARE_BITMAP (active_pipes,SSPP_MAX );@@ -475,6 +490,10 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, pipe_idx = i + head_pipe_in_stage;if (!pstate->pipe[pipe_idx].sspp)continue ; + pipe = &pstate->pipe[pipe_idx]; +if (src_split && pipe->sspp->ops.setup_src_split_order) + pipe->sspp->ops.setup_src_split_order (pipe, +_dpu_crtc_pipe_is_right (pstate, pipe_idx)); lms_in_pair =min (cstate->num_mixers - (stage *PIPES_PER_STAGE ),PIPES_PER_STAGE );set_bit (pstate->pipe[pipe_idx].sspp->idx, active_fetch);Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
PATCH 4/4 drm/msm/dpu: add source split order op for DPU 13.x
In reply to Mahadevan PDPU 13.x places the SSPP op-mode register in separate REC0 and REC1 banks. Add the source split order operation for this layout, using the shared helper to update SRC_SPLIT_ORDER in the selected bank.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c +14 -0
@@ -149,6 +149,19 @@ static void dpu_hw_sspp_setup_format_v13(struct dpu_sw_pipe *pipe, unpack_pat_off, format_off, ubwc_ctrl_off, ubwc_err_off); } +static void dpu_hw_sspp_setup_src_split_order_v13 (struct dpu_sw_pipe *pipe, +bool right) +{ +struct dpu_hw_sspp *ctx = pipe->sspp; +u32 offset; + +if (!ctx) +return ; + + offset =dpu_hw_sspp_calculate_rect_off (pipe->multirect_index, ctx); +dpu_hw_setup_src_split_order_impl (ctx, offset +SSPP_REC_SRC_OP_MODE , right); +} +static void dpu_hw_sspp_setup_pe_config_v13 (struct dpu_hw_sspp *ctx,struct dpu_hw_pixel_ext *pe_ext) {
@@ -299,6 +312,7 @@ void dpu_hw_sspp_init_v13(struct dpu_hw_sspp *c, c->ops.setup_sourceaddress = dpu_hw_sspp_setup_sourceaddress_v13; c->ops.setup_solidfill = dpu_hw_sspp_setup_solidfill_v13; c->ops.setup_pe = dpu_hw_sspp_setup_pe_config_v13; + c->ops.setup_src_split_order = dpu_hw_sspp_setup_src_split_order_v13;if (test_bit (DPU_SSPP_QOS , &features)) { c->ops.setup_qos_lut = dpu_hw_sspp_setup_qos_lut_v13;
Signature · 1 line
2.34.1
Re: [PATCH 4/4] drm/msm/dpu: add source split order op for DPU 13.x
Quoted 9 lines · Mahadevan P
DPU 13.x places the SSPP op-mode register in separate REC0 and REC1 banks. Add the source split order operation for this layout, using the shared helper to update
SRC_SPLIT_ORDERin the selected bank.Assisted-by LLMSigned-off-by Mahadevan P <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
This should come before the last patch. But as the fixes shouldn't depend on the non-fixes patches, just squash those three.
Signature · 2 lines
With best wishes Dmitry