drm/msm/dpu: use PINGPONG_NONE to unbind INTF from PP
PATCH 1/1 drm/msm/dpu: use PINGPONG_NONE to unbind INTF from PP
Currently the driver passes the PINGPONG index to dpu_hw_intf_ops::bind_pingpong_blk() callback and uses separate boolean flag to tell whether INTF should be bound or unbound. Simplify this by passing PINGPONG_NONE in case of unbinding and drop the flag completely.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 - 5 files changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2 -2
@@ -2102,8 +2102,8 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)for (i =0 ; i < dpu_enc->num_phys_encs; i++) {if (dpu_enc->phys_encs[i] && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( - dpu_enc->phys_encs[i]->hw_intf, false, - dpu_enc->phys_encs[i]->hw_pp->idx); + dpu_enc->phys_encs[i]->hw_intf, +PINGPONG_NONE );/* mark INTF flush as pending */ if (phys_enc->hw_ctl->ops.update_pending_flush_intf)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1 -3
@@ -66,7 +66,6 @@ static void _dpu_encoder_phys_cmd_update_intf_cfg(if (test_bit (DPU_CTL_ACTIVE_CFG , &ctl->caps->features) && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);if (phys_enc->hw_intf->ops.enable_compression)
@@ -556,8 +555,7 @@ static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc)if (phys_enc->hw_intf->ops.bind_pingpong_blk) { phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - false, - phys_enc->hw_pp->idx); +PINGPONG_NONE ); ctl = phys_enc->hw_ctl; ctl->ops.update_pending_flush_intf (ctl, phys_enc->intf_idx);
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0 -1
@@ -287,7 +287,6 @@ static void dpu_encoder_phys_vid_setup_timing_engine(if (phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);if (phys_enc->hw_pp->merge_3d)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1 -2
@@ -268,7 +268,6 @@ static void dpu_hw_intf_setup_prg_fetch(static void dpu_hw_intf_bind_pingpong_blk (struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp) {struct dpu_hw_blk_reg_map *c = &intf->hw;
@@ -277,7 +276,7 @@ static void dpu_hw_intf_bind_pingpong_blk( mux_cfg =DPU_REG_READ (c,INTF_MUX ); mux_cfg &= ~0xf ; -if (enable) +if (pp !=PINGPONG_NONE ) mux_cfg |= (pp -PINGPONG_0 ) &0x7 ;else mux_cfg |=0xf ;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +0 -1
@@ -89,7 +89,6 @@ struct dpu_hw_intf_ops {u32 (*get_line_count)(struct dpu_hw_intf *intf);void (*bind_pingpong_blk)(struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp);void (*setup_misr)(struct dpu_hw_intf *intf,bool enable,u32 frame_count);int (*collect_misr)(struct dpu_hw_intf *intf,u32 *misr_value);
Signature · 1 line
2.39.2
Marijn Suijten
reviewerQuoted 4 lines · Dmitry Baryshkov
Currently the driver passes the PINGPONG index to
dpu_hw_intf_ops::bind_pingpong_blk()callback and uses separate boolean flag to tell whether INTF should be bound or unbound. Simplify this by passingPINGPONG_NONEin case of unbinding and drop the flag completely.
Perhaps worth mentioning that this flag was only recently introduced (and link to it as a dependency under the cut), as well as explain that the passed enum dpu_pingpong value is bogus when enable=false because it is not part of the value written to the register for the "unbind/disable" case? See for example the wording I suggested on the patch that introduces and uses PINGPONG_NONE.
Quoted 7 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 -
How about appending/sending another patch that drops this from dpu_hw_wb.c as well?
Quoted 30 lines
5 files changed, 4 insertions(+), 9 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2
-2@@ -2102,8 +2102,8 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)for (i =0 ; i < dpu_enc->num_phys_encs; i++) {if (dpu_enc->phys_encs[i] && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( - dpu_enc->phys_encs[i]->hw_intf, false, - dpu_enc->phys_encs[i]->hw_pp->idx); + dpu_enc->phys_encs[i]->hw_intf, +PINGPONG_NONE );/* mark INTF flush as pending */ if (phys_enc->hw_ctl->ops.update_pending_flush_intf)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-1@@ -66,7 +66,6 @@ static void _dpu_encoder_phys_cmd_update_intf_cfg(if (test_bit (DPU_CTL_ACTIVE_CFG , &ctl->caps->features) && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);if (phys_enc->hw_intf->ops.enable_compression)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc) · line 558
Quoted 6 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1
-2@@ -556,8 +555,7 @@ static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc)if (phys_enc->hw_intf->ops.bind_pingpong_blk) { phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - false, - phys_enc->hw_pp->idx); +PINGPONG_NONE );
Is there also a cleanup state where hw_pp is assigned back to NULL?
Quoted 27 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-0ctl = phys_enc->hw_ctl; ctl->ops.update_pending_flush_intf (ctl, phys_enc->intf_idx);drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0
-1@@ -287,7 +287,6 @@ static void dpu_encoder_phys_vid_setup_timing_engine(if (phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);if (phys_enc->hw_pp->merge_3d)drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-1@@ -268,7 +268,6 @@ static void dpu_hw_intf_setup_prg_fetch(static void dpu_hw_intf_bind_pingpong_blk (struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp) {struct dpu_hw_blk_reg_map *c = &intf->hw;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c static void dpu_hw_intf_bind_pingpong_blk( · line 279
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1
-1@@ -277,7 +276,7 @@ static void dpu_hw_intf_bind_pingpong_blk( mux_cfg =DPU_REG_READ (c,INTF_MUX ); mux_cfg &= ~0xf ; -if (enable) +if (pp !=PINGPONG_NONE )
Kuogee just used if (pp), I think we should stay consistent.
- Marijn
Quoted 18 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-0mux_cfg |= (pp -PINGPONG_0 ) &0x7 ; else mux_cfg |= 0xf;drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +0
-1@@ -89,7 +89,6 @@ struct dpu_hw_intf_ops {u32 (*get_line_count)(struct dpu_hw_intf *intf);void (*bind_pingpong_blk)(struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp);void (*setup_misr)(struct dpu_hw_intf *intf,bool enable,u32 frame_count);int (*collect_misr)(struct dpu_hw_intf *intf,u32 *misr_value);Signature · 1 line
2.39.2
Quoted 9 lines · Marijn Suijten
Quoted 4 lines · Dmitry Baryshkov
Currently the driver passes the PINGPONG index to
dpu_hw_intf_ops::bind_pingpong_blk()callback and uses separate boolean flag to tell whether INTF should be bound or unbound. Simplify this by passingPINGPONG_NONEin case of unbinding and drop the flag completely.Perhaps worth mentioning that this flag was only recently introduced (and link to it as a dependency under the cut),
The patch is already a part of linux-next. This is the usual boundary of skipping the dependencies.
Quoted 4 lines
as well as explain that
the passedenum dpu_pingpongvalue is bogus when enable=false because it is not part of the value written to the register for the "unbind/disable" case?
Good suggestion.
Quoted 11 lines
See for example the wording I suggested on the
patch that introduces and usesPINGPONG_NONE.Quoted 7 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 -
Quoted 2 lines
How about appending/sending another patch that drops this from
dpu_hw_wb.cas well?
Ack, nice catch.
Quoted 29 lines
Quoted 29 lines
5 files changed, 4 insertions(+), 9 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2
-2@@ -2102,8 +2102,8 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)for (i =0 ; i < dpu_enc->num_phys_encs; i++) {if (dpu_enc->phys_encs[i] && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( - dpu_enc->phys_encs[i]->hw_intf, false, - dpu_enc->phys_encs[i]->hw_pp->idx); + dpu_enc->phys_encs[i]->hw_intf, +PINGPONG_NONE );/* mark INTF flush as pending */ if (phys_enc->hw_ctl->ops.update_pending_flush_intf)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-1@@ -66,7 +66,6 @@ static void _dpu_encoder_phys_cmd_update_intf_cfg(if (test_bit (DPU_CTL_ACTIVE_CFG , &ctl->caps->features) && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc) · line 558
Quoted 8 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1
-2if (phys_enc->hw_intf->ops.enable_compression)@@ -556,8 +555,7 @@ static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc)if (phys_enc->hw_intf->ops.bind_pingpong_blk) { phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - false, - phys_enc->hw_pp->idx); +PINGPONG_NONE );Is there also a cleanup state where
hw_ppis assigned back to NULL?
No. None of the encoder resources are reassigned to NULL. I will tend this topic during vN of resource allocation rework.
Quoted 31 lines
Quoted 31 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-0ctl = phys_enc->hw_ctl; ctl->ops.update_pending_flush_intf (ctl, phys_enc->intf_idx);drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0
-1@@ -287,7 +287,6 @@ static void dpu_encoder_phys_vid_setup_timing_engine(if (phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);if (phys_enc->hw_pp->merge_3d)drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-1@@ -268,7 +268,6 @@ static void dpu_hw_intf_setup_prg_fetch(static void dpu_hw_intf_bind_pingpong_blk (struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp) {struct dpu_hw_blk_reg_map *c = &intf->hw;@@ -277,7 +276,7 @@ static void dpu_hw_intf_bind_pingpong_blk( mux_cfg =DPU_REG_READ (c,INTF_MUX ); mux_cfg &= ~0xf ;
Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c static void dpu_hw_intf_bind_pingpong_blk( · line 279
Quoted 2 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1
-1-if (enable) +if (pp !=PINGPONG_NONE )Kuogee just used
if (pp), I think we should stay consistent.
Sure. The rest of the driver usually compares to foo_NONE.
Quoted 20 lines
- Marijn
Quoted 17 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-0mux_cfg |= (pp -PINGPONG_0 ) &0x7 ; else mux_cfg |= 0xf;drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +0
-2@@ -89,7 +89,6 @@ struct dpu_hw_intf_ops {u32 (*get_line_count)(struct dpu_hw_intf *intf);void (*bind_pingpong_blk)(struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp);void (*setup_misr)(struct dpu_hw_intf *intf,bool enable,u32 frame_count);int (*collect_misr)(struct dpu_hw_intf *intf,u32 *misr_value); --2.39.2
Signature · 2 lines
With best wishes Dmitry
Marijn Suijten
reviewerQuoted 9 lines · Dmitry Baryshkov
Quoted 7 lines · Marijn Suijten
Quoted 4 lines · Dmitry Baryshkov
Currently the driver passes the PINGPONG index to
dpu_hw_intf_ops::bind_pingpong_blk()callback and uses separate boolean flag to tell whether INTF should be bound or unbound. Simplify this by passingPINGPONG_NONEin case of unbinding and drop the flag completely.
Quoted 5 lines
Quoted 2 lines
Perhaps worth mentioning that this flag was only recently introduced (and link to it as a dependency under the cut),
The patch is already a part of linux-next. This is the usual boundary of skipping the dependencies.
Excuse me, I forgot about the confusion even after reviewing your patch
[1] which introduces PINGPONG_NONE, while DSC v14 (sent 3 days after your patch was applied) also still introduces the same [2]. This patch should likely be rebased and retitled.
[1]: https://lore.kernel.org/dri-devel/[email protected]/
[2]: https://lore.kernel.org/linux-arm-msm/[email protected]/
Quoted 97 lines
Quoted 4 lines
as well as explain that
the passedenum dpu_pingpongvalue is bogus when enable=false because it is not part of the value written to the register for the "unbind/disable" case?Good suggestion.
Quoted 11 lines
See for example the wording I suggested on the
patch that introduces and usesPINGPONG_NONE.Quoted 7 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 -Quoted 2 lines
How about appending/sending another patch that drops this from
dpu_hw_wb.cas well?Ack, nice catch.
Quoted 29 lines
Quoted 29 lines
5 files changed, 4 insertions(+), 9 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2
-2@@ -2102,8 +2102,8 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)for (i =0 ; i < dpu_enc->num_phys_encs; i++) {if (dpu_enc->phys_encs[i] && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( - dpu_enc->phys_encs[i]->hw_intf, false, - dpu_enc->phys_encs[i]->hw_pp->idx); + dpu_enc->phys_encs[i]->hw_intf, +PINGPONG_NONE );/* mark INTF flush as pending */ if (phys_enc->hw_ctl->ops.update_pending_flush_intf)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-1@@ -66,7 +66,6 @@ static void _dpu_encoder_phys_cmd_update_intf_cfg(if (test_bit (DPU_CTL_ACTIVE_CFG , &ctl->caps->features) && phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc) · line 558
Quoted 8 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1
-2if (phys_enc->hw_intf->ops.enable_compression)@@ -556,8 +555,7 @@ static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc)if (phys_enc->hw_intf->ops.bind_pingpong_blk) { phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - false, - phys_enc->hw_pp->idx); +PINGPONG_NONE );Is there also a cleanup state where
hw_ppis assigned back to NULL?No. None of the encoder resources are reassigned to NULL. I will tend this topic during vN of resource allocation rework.
Quoted 31 lines
Quoted 31 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-0ctl = phys_enc->hw_ctl; ctl->ops.update_pending_flush_intf (ctl, phys_enc->intf_idx);drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0
-1@@ -287,7 +287,6 @@ static void dpu_encoder_phys_vid_setup_timing_engine(if (phys_enc->hw_intf->ops.bind_pingpong_blk) phys_enc->hw_intf->ops.bind_pingpong_blk ( phys_enc->hw_intf, - true, phys_enc->hw_pp->idx);if (phys_enc->hw_pp->merge_3d)drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-1@@ -268,7 +268,6 @@ static void dpu_hw_intf_setup_prg_fetch(static void dpu_hw_intf_bind_pingpong_blk (struct dpu_hw_intf *intf, -bool enable,const enum dpu_pingpong pp) {struct dpu_hw_blk_reg_map *c = &intf->hw;@@ -277,7 +276,7 @@ static void dpu_hw_intf_bind_pingpong_blk( mux_cfg =DPU_REG_READ (c,INTF_MUX ); mux_cfg &= ~0xf ;
Quoted 6 lines
Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c static void dpu_hw_intf_bind_pingpong_blk( · line 279
Quoted 2 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1
-1-if (enable) +if (pp !=PINGPONG_NONE )Kuogee just used
if (pp), I think we should stay consistent.Sure. The rest of the driver usually compares to
foo_NONE.
If that is the common way to do it, that DSC patch [2] should also use a an explicit comparison instead of assuming PINGPONG_NONE = 0?
- Marijn