drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_ini
v3 cover drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_ini
rop two feature flags, DPU_INTF_TE and DPU_PINGPONG_TE, in favour of performing the MDSS revision checks instead.
Changes since v2:
- Added guarding checks for hw_intf and hw_pp in debug print (Marijn)
- Removed extra empty lines (Marijn)
Changes since v1:
- Added missing patch
- Reworked commit messages (following suggestions by Marijn)
- Changed code to check for major & INTF type rather than checking for intr presence in catalog. Added WARN_ON()s instead. (Marijn)
- Added severall comments & TODO item.
Dmitry Baryshkov (8):
drm/msm/dpu: inline _setup_pingpong_ops()
drm/msm/dpu: enable PINGPONG TE operations only when supported by HW drm/msm/dpu: drop the DPU_PINGPONG_TE flag
drm/msm/dpu: inline _setup_intf_ops()
drm/msm/dpu: enable INTF TE operations only when supported by HW drm/msm/dpu: drop DPU_INTF_TE feature flag
drm/msm/dpu: drop useless check from
dpu_encoder_phys_cmd_te_rd_ptr_irq()
drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init
.../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 52 +++++++++---------- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 3 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 6 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 51 +++++++++--------- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 41 +++++++-------- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 3 +- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- 7 files changed, 75 insertions(+), 83 deletions(-)
Signature · 1 line
2.39.2
PATCH v3 1/8 drm/msm/dpu: inline _setup_pingpong_ops()
Inline the _setup_pingpong_ops() function, it makes it easier to handle different conditions involving PINGPONG configuration.
--- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +17 -22
@@ -281,27 +281,6 @@ static int dpu_hw_pp_setup_dsc(struct dpu_hw_pingpong *pp)return 0 ; } -static void _setup_pingpong_ops (struct dpu_hw_pingpong *c, -unsigned long features) -{ -if (test_bit (DPU_PINGPONG_TE , &features)) { - c->ops.enable_tearcheck = dpu_hw_pp_enable_te; - c->ops.disable_tearcheck = dpu_hw_pp_disable_te; - c->ops.connect_external_te = dpu_hw_pp_connect_external_te; - c->ops.get_line_count = dpu_hw_pp_get_line_count; - c->ops.disable_autorefresh = dpu_hw_pp_disable_autorefresh; - } - -if (test_bit (DPU_PINGPONG_DSC , &features)) { - c->ops.setup_dsc = dpu_hw_pp_setup_dsc; - c->ops.enable_dsc = dpu_hw_pp_dsc_enable; - c->ops.disable_dsc = dpu_hw_pp_dsc_disable; - } - -if (test_bit (DPU_PINGPONG_DITHER , &features)) - c->ops.setup_dither = dpu_hw_pp_setup_dither; -}; -struct dpu_hw_pingpong *dpu_hw_pingpong_init (const struct dpu_pingpong_cfg *cfg,void __iomem *addr) {
@@ -316,7 +295,23 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, c->idx = cfg->id; c->caps = cfg; -_setup_pingpong_ops (c, c->caps->features); + +if (test_bit (DPU_PINGPONG_TE , &cfg->features)) { + c->ops.enable_tearcheck = dpu_hw_pp_enable_te; + c->ops.disable_tearcheck = dpu_hw_pp_disable_te; + c->ops.connect_external_te = dpu_hw_pp_connect_external_te; + c->ops.get_line_count = dpu_hw_pp_get_line_count; + c->ops.disable_autorefresh = dpu_hw_pp_disable_autorefresh; + } + +if (test_bit (DPU_PINGPONG_DSC , &cfg->features)) { + c->ops.setup_dsc = dpu_hw_pp_setup_dsc; + c->ops.enable_dsc = dpu_hw_pp_dsc_enable; + c->ops.disable_dsc = dpu_hw_pp_dsc_disable; + } + +if (test_bit (DPU_PINGPONG_DITHER , &cfg->features)) + c->ops.setup_dither = dpu_hw_pp_setup_dither;return c; }
Signature · 1 line
2.39.2
Re: [PATCH v3 1/8] drm/msm/dpu: inline _setup_pingpong_ops()
Quoting Dmitry Baryshkov (2023-09-03 19:04:47)
Quoted 6 lines
Inline the
_setup_pingpong_ops()function, it makes it easier to handle different conditions involving PINGPONG configuration.Reviewed-by Marijn Suijten <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>---
PATCH v3 2/8 drm/msm/dpu: enable PINGPONG TE operations only when supported by HW
In reply to Dmitry BaryshkovThe DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 6 ++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 3 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +4 -2
@@ -282,7 +282,7 @@ static int dpu_hw_pp_setup_dsc(struct dpu_hw_pingpong *pp) }struct dpu_hw_pingpong *dpu_hw_pingpong_init (const struct dpu_pingpong_cfg *cfg, -void __iomem *addr) +void __iomem *addr,const struct dpu_mdss_version *mdss_rev) {struct dpu_hw_pingpong *c;
@@ -296,7 +296,9 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, c->idx = cfg->id; c->caps = cfg; -if (test_bit (DPU_PINGPONG_TE , &cfg->features)) { +if (mdss_rev->core_major_ver <5 ) { +WARN_ON (!cfg->intr_rdptr); + c->ops.enable_tearcheck = dpu_hw_pp_enable_te; c->ops.disable_tearcheck = dpu_hw_pp_disable_te; c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +2 -1
@@ -123,10 +123,11 @@ static inline struct dpu_hw_pingpong *to_dpu_hw_pingpong(struct dpu_hw_blk *hw)* pingpong catalog entry. * @cfg: Pingpong catalog entry for which driver object is required * @addr: Mapped register io address of MDP +* @mdss_rev: dpu core's major and minor versions * Return: Error code or allocated dpu_hw_pingpong context */ struct dpu_hw_pingpong *dpu_hw_pingpong_init (const struct dpu_pingpong_cfg *cfg, -void __iomem *addr); +void __iomem *addr,const struct dpu_mdss_version *mdss_rev);/** * dpu_hw_pingpong_destroy - destroys pingpong driver context
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
@@ -146,7 +146,7 @@ int dpu_rm_init(struct dpu_rm *rm,struct dpu_hw_pingpong *hw;const struct dpu_pingpong_cfg *pp = &cat->pingpong[i]; - hw =dpu_hw_pingpong_init (pp, mmio); + hw =dpu_hw_pingpong_init (pp, mmio, cat->mdss_ver);if (IS_ERR (hw)) { rc =PTR_ERR (hw); DPU_ERROR("failed pingpong object creation: err %d\n",
Signature · 1 line
2.39.2
Re: [PATCH v3 2/8] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW
Quoting Dmitry Baryshkov (2023-09-03 19:04:48)
Quoted 2 lines
The
DPU_PINGPONG_TEbit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the
s/presense/presence/
Quoted 1 line
corresponding interrupt line.
The patch checks for the major version though?
Re: [PATCH v3 2/8] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW
Quoted 10 lines · Stephen Boyd
Quoting Dmitry Baryshkov (2023-09-03 19:04:48)
Quoted 2 lines
The
DPU_PINGPONG_TEbit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of thes/presense/presence/
Quoted 1 line
corresponding interrupt line.
The patch checks for the major version though?
ugh, forgot to update the commit message after rebasing on top of Abhinav's core_major_rev series. I'll fix this in v4/
Signature · 2 lines
With best wishes Dmitry
PATCH v3 3/8 drm/msm/dpu: drop the DPU_PINGPONG_TE flag
In reply to Dmitry BaryshkovThe DPU_PINGPONG_TE flag became unused, we can drop it now.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +1 -1
@@ -79,7 +79,7 @@ (BIT(DPU_DIM_LAYER) | BIT(DPU_MIXER_COMBINED_ALPHA))#define PINGPONG_SDM845_MASK \ - (BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_TE) | BIT(DPU_PINGPONG_DSC)) + (BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_DSC))#define PINGPONG_SDM845_TE2_MASK \ (PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2))
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +1 -3
@@ -119,7 +119,6 @@ enum {/** * PINGPONG sub-blocks -* @DPU_PINGPONG_TE Tear check block * @DPU_PINGPONG_TE2 Additional tear check block for split pipes * @DPU_PINGPONG_SPLIT PP block supports split fifo * @DPU_PINGPONG_SLAVE PP block is a suitable slave for split fifo
@@ -128,8 +127,7 @@ enum {* @DPU_PINGPONG_MAX */ enum { -DPU_PINGPONG_TE =0x1 , -DPU_PINGPONG_TE2 , +DPU_PINGPONG_TE2 =0x1 ,DPU_PINGPONG_SPLIT ,DPU_PINGPONG_SLAVE ,DPU_PINGPONG_DITHER ,
Signature · 1 line
2.39.2
Re: [PATCH v3 3/8] drm/msm/dpu: drop the DPU_PINGPONG_TE flag
Quoting Dmitry Baryshkov (2023-09-03 19:04:49)
Quoted 5 lines
The
DPU_PINGPONG_TEflag became unused, we can drop it now.Reviewed-by Marijn Suijten <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>---
PATCH v3 4/8 drm/msm/dpu: inline _setup_intf_ops()
In reply to Dmitry BaryshkovInline the _setup_intf_ops() function, it makes it easier to handle different conditions involving INTF configuration.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 48 ++++++++++----------- 1 file changed, 22 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +22 -26
@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,DPU_REG_WRITE (&ctx->hw,INTF_CONFIG2 , intf_cfg2); } -static void _setup_intf_ops (struct dpu_hw_intf_ops *ops, -unsigned long cap,const struct dpu_mdss_version *mdss_rev) -{ - ops->setup_timing_gen = dpu_hw_intf_setup_timing_engine; - ops->setup_prg_fetch = dpu_hw_intf_setup_prg_fetch; - ops->get_status = dpu_hw_intf_get_status; - ops->enable_timing = dpu_hw_intf_enable_timing_engine; - ops->get_line_count = dpu_hw_intf_get_line_count; -if (cap &BIT (DPU_INTF_INPUT_CTRL )) - ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk; - ops->setup_misr = dpu_hw_intf_setup_misr; - ops->collect_misr = dpu_hw_intf_collect_misr; - -if (cap &BIT (DPU_INTF_TE )) { - ops->enable_tearcheck = dpu_hw_intf_enable_te; - ops->disable_tearcheck = dpu_hw_intf_disable_te; - ops->connect_external_te = dpu_hw_intf_connect_external_te; - ops->vsync_sel = dpu_hw_intf_vsync_sel; - ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh; - } - -if (mdss_rev->core_major_ver >=7 ) - ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg; -} -struct dpu_hw_intf *dpu_hw_intf_init (const struct dpu_intf_cfg *cfg,void __iomem *addr,const struct dpu_mdss_version *mdss_rev) {
@@ -571,7 +546,28 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,*/ c->idx = cfg->id; c->cap = cfg; -_setup_intf_ops (&c->ops, c->cap->features, mdss_rev); + + c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine; + c->ops.setup_prg_fetch = dpu_hw_intf_setup_prg_fetch; + c->ops.get_status = dpu_hw_intf_get_status; + c->ops.enable_timing = dpu_hw_intf_enable_timing_engine; + c->ops.get_line_count = dpu_hw_intf_get_line_count; + c->ops.setup_misr = dpu_hw_intf_setup_misr; + c->ops.collect_misr = dpu_hw_intf_collect_misr; + +if (cfg->features &BIT (DPU_INTF_INPUT_CTRL )) + c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk; + +if (cfg->features &BIT (DPU_INTF_TE )) { + c->ops.enable_tearcheck = dpu_hw_intf_enable_te; + c->ops.disable_tearcheck = dpu_hw_intf_disable_te; + c->ops.connect_external_te = dpu_hw_intf_connect_external_te; + c->ops.vsync_sel = dpu_hw_intf_vsync_sel; + c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh; + } + +if (mdss_rev->core_major_ver >=7 ) + c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;return c; }
Signature · 1 line
2.39.2
Re: [PATCH v3 4/8] drm/msm/dpu: inline _setup_intf_ops()
Quoting Dmitry Baryshkov (2023-09-03 19:04:50)
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-0@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,
[...]
Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0
-7- ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh; - } - -if (mdss_rev->core_major_ver >=7 ) - ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg; -} -struct dpu_hw_intf *dpu_hw_intf_init (const struct dpu_intf_cfg *cfg,void __iomem *addr,const struct dpu_mdss_version *mdss_rev) {
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 550
Quoted 6 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +2
-1@@ -571,7 +546,28 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,*/ c->idx = cfg->id; c->cap = cfg; -_setup_intf_ops (&c->ops, c->cap->features, mdss_rev); + + c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine;
Maybe grow a local variable 'ops' that can be assigned to so the code doesn't change at all, only the location does.
Quoted 2 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +2
-0+ c->ops.setup_prg_fetch = dpu_hw_intf_setup_prg_fetch; + c->ops.get_status = dpu_hw_intf_get_status;
PATCH v3 5/8 drm/msm/dpu: enable INTF TE operations only when supported by HW
In reply to Dmitry BaryshkovThe DPU_INTF_TE bit is set for all INTF blocks on DPU >= 5.0, however only INTF_1 and INTF_2 actually support tearing control (both are INTF_DSI). Rather than trying to limit the DPU_INTF_TE feature bit to those two INTF instances, check for the major && INTF type.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +4 -1
@@ -558,7 +558,10 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,if (cfg->features &BIT (DPU_INTF_INPUT_CTRL )) c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk; -if (cfg->features &BIT (DPU_INTF_TE )) { +/* INTF TE is only for DSI interfaces */ +if (mdss_rev->core_major_ver >=5 && cfg->type ==INTF_DSI ) { +WARN_ON (!cfg->intr_tear_rd_ptr); + c->ops.enable_tearcheck = dpu_hw_intf_enable_te; c->ops.disable_tearcheck = dpu_hw_intf_disable_te; c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
Signature · 1 line
2.39.2
Re: [PATCH v3 5/8] drm/msm/dpu: enable INTF TE operations only when supported by HW
Quoting Dmitry Baryshkov (2023-09-03 19:04:51)
Quoted 8 lines
The
DPU_INTF_TEbit is set for all INTF blocks on DPU >= 5.0, however onlyINTF_1andINTF_2actually support tearing control (both areINTF_DSI). Rather than trying to limit theDPU_INTF_TEfeature bit to those two INTF instances, check for the major && INTF type.Reviewed-by Marijn Suijten <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>---
PATCH v3 6/8 drm/msm/dpu: drop DPU_INTF_TE feature flag
In reply to Dmitry BaryshkovReplace the only user of the DPU_INTF_TE feature flag with the direct DPU version comparison.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 5 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +3 -2
@@ -776,8 +776,9 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( phys_enc->intf_mode =INTF_MODE_CMD ; cmd_enc->stream_sel =0 ; - phys_enc->has_intf_te =test_bit (DPU_INTF_TE , - &phys_enc->hw_intf->cap->features); +/* DPU before 5.0 use PINGPONG for TE handling */ +if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >=5 ) + phys_enc->has_intf_te = true;atomic_set (&cmd_enc->pending_vblank_cnt,0 );init_waitqueue_head (&cmd_enc->pending_vblank_wq);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +0 -1
@@ -100,7 +100,6 @@#define INTF_SC7180_MASK \ (BIT(DPU_INTF_INPUT_CTRL) | \ - BIT(DPU_INTF_TE) | \ BIT(DPU_INTF_STATUS_SUPPORTED) | \ BIT(DPU_DATA_HCTL_EN))
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +0 -2
@@ -158,7 +158,6 @@ enum {* INTF sub-blocks * @DPU_INTF_INPUT_CTRL Supports the setting of pp block from which * pixel data arrives to this INTF -* @DPU_INTF_TE INTF block has TE configuration support * @DPU_DATA_HCTL_EN Allows data to be transferred at different rate * than video timing * @DPU_INTF_STATUS_SUPPORTED INTF block has INTF_STATUS register
@@ -166,7 +165,6 @@ enum {*/ enum {DPU_INTF_INPUT_CTRL =0x1 , -DPU_INTF_TE ,DPU_DATA_HCTL_EN ,DPU_INTF_STATUS_SUPPORTED ,DPU_INTF_MAX
Signature · 1 line
2.39.2
Re: [PATCH v3 6/8] drm/msm/dpu: drop DPU_INTF_TE feature flag
Quoting Dmitry Baryshkov (2023-09-03 19:04:52)
Quoted 6 lines
Replace the only user of the
DPU_INTF_TEfeature flag with the direct DPU version comparison.Reviewed-by Marijn Suijten <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>---
PATCH v3 7/8 drm/msm/dpu: drop useless check from dpu_encoder_phys_cmd_te_rd_ptr_irq()
In reply to Dmitry BaryshkovThe dpu_encoder_phys_cmd_te_rd_ptr_irq() function uses neither hw_intf nor hw_pp data, so we can drop the corresponding check.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -8
@@ -108,14 +108,6 @@ static void dpu_encoder_phys_cmd_te_rd_ptr_irq(void *arg, int irq_idx)struct dpu_encoder_phys *phys_enc = arg;struct dpu_encoder_phys_cmd *cmd_enc; -if (phys_enc->has_intf_te) { -if (!phys_enc->hw_intf) -return ; - }else { -if (!phys_enc->hw_pp) -return ; - } -DPU_ATRACE_BEGIN ("rd_ptr_irq" ); cmd_enc =to_dpu_encoder_phys_cmd (phys_enc);
Signature · 1 line
2.39.2
Re: [PATCH v3 7/8] drm/msm/dpu: drop useless check from dpu_encoder_phys_cmd_te_rd_ptr_irq()
Quoting Dmitry Baryshkov (2023-09-03 19:04:53)
Quoted 6 lines
The
dpu_encoder_phys_cmd_te_rd_ptr_irq()function uses neitherhw_intfnorhw_ppdata, so we can drop the corresponding check.Reviewed-by Marijn Suijten <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>---
PATCH v3 8/8 drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init
In reply to Dmitry BaryshkovAs the INTF is fixed at the encoder creation time, we can move the check whether INTF supports tearchck to dpu_encoder_phys_cmd_init(). This function can return an error if INTF doesn't have required feature. Performing this check in dpu_encoder_phys_cmd_tearcheck_config() is less useful, as this function returns void.
--- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +23 -16
@@ -325,24 +325,21 @@ static void dpu_encoder_phys_cmd_tearcheck_config(unsigned long vsync_hz;struct dpu_kms *dpu_kms; -if (phys_enc->has_intf_te) { -if (!phys_enc->hw_intf || - !phys_enc->hw_intf->ops.enable_tearcheck) { -DPU_DEBUG_CMDENC (cmd_enc,"tearcheck not supported\n" ); -return ; - } - -DPU_DEBUG_CMDENC (cmd_enc,"" ); - }else { -if (!phys_enc->hw_pp || - !phys_enc->hw_pp->ops.enable_tearcheck) { -DPU_DEBUG_CMDENC (cmd_enc,"tearcheck not supported\n" ); -return ; - } - -DPU_DEBUG_CMDENC (cmd_enc,"pp %d\n" , phys_enc->hw_pp->idx -PINGPONG_0 ); +/* +* TODO: if/when resource allocation is refactored, move this to a +* place where the driver can actually return an error. +*/ +if (!phys_enc->has_intf_te && + (!phys_enc->hw_pp || + !phys_enc->hw_pp->ops.enable_tearcheck)) { +DPU_DEBUG_CMDENC (cmd_enc,"tearcheck not supported\n" ); +return ; } +DPU_DEBUG_CMDENC (cmd_enc,"intf %d pp %d\n" , + phys_enc->hw_intf ? phys_enc->hw_intf->idx -INTF_0 :-1 , + phys_enc->hw_pp ? phys_enc->hw_pp->idx -PINGPONG_0 :-1 ); + mode = &phys_enc->cached_mode; dpu_kms = phys_enc->dpu_kms;
@@ -768,10 +765,20 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( phys_enc->intf_mode =INTF_MODE_CMD ; cmd_enc->stream_sel =0 ; +if (!phys_enc->hw_intf) { +DPU_ERROR_CMDENC (cmd_enc,"no INTF provided\n" ); +return ERR_PTR (-EINVAL ); + } +/* DPU before 5.0 use PINGPONG for TE handling */ if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >=5 ) phys_enc->has_intf_te = true; +if (phys_enc->has_intf_te && !phys_enc->hw_intf->ops.enable_tearcheck) { +DPU_ERROR_CMDENC (cmd_enc,"tearcheck not supported\n" ); +return ERR_PTR (-EINVAL ); + } +atomic_set (&cmd_enc->pending_vblank_cnt,0 );init_waitqueue_head (&cmd_enc->pending_vblank_wq);
Signature · 1 line
2.39.2
Re: [PATCH v3 8/8] drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init
Quoting Dmitry Baryshkov (2023-09-03 19:04:54)
Quoted 8 lines
As the INTF is fixed at the encoder creation time, we can move the check whether INTF supports tearchck to
dpu_encoder_phys_cmd_init(). This function can return an error if INTF doesn't have required feature. Performing this check indpu_encoder_phys_cmd_tearcheck_config()is less useful, as this function returns void.Signed-off-by Dmitry Baryshkov <[email protected]>---
Of course this should be 'drm/msm/dpu: drop DPU_INTF_TE and DPU_PINGPONG_TE' series
Quoted 34 lines · Dmitry Baryshkov
rop two feature flags,
DPU_INTF_TEandDPU_PINGPONG_TE, in favour of performing the MDSS revision checks instead.Changes since v2:
- Added guarding checks forhw_intfandhw_ppin debug print (Marijn)
- Removed extra empty lines (Marijn)Changes since v1:
- Added missing patch
- Reworked commit messages (following suggestions by Marijn)
- Changed code to check for major & INTF type rather than checking for intr presence in catalog. Added WARN_ON()s instead. (Marijn)
- Added severall comments & TODO item.Dmitry Baryshkov (8):
drm/msm/dpu: inline_setup_pingpong_ops()
drm/msm/dpu: enable PINGPONG TE operations only when supported by HW drm/msm/dpu: drop theDPU_PINGPONG_TEflag
drm/msm/dpu: inline_setup_intf_ops()
drm/msm/dpu: enable INTF TE operations only when supported by HW drm/msm/dpu: dropDPU_INTF_TEfeature flag
drm/msm/dpu: drop useless check from
dpu_encoder_phys_cmd_te_rd_ptr_irq()
drm/msm/dpu: move INTF tearing checks todpu_encoder_phys_cmd_init.../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 52 +++++++++---------- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 3 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 6 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 51 +++++++++--------- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 41 +++++++-------- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 3 +- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- 7 files changed, 75 insertions(+), 83 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Dmitry Baryshkov
AppliedQuoted 8 lines · Dmitry Baryshkov
rop two feature flags,
DPU_INTF_TEandDPU_PINGPONG_TE, in favour of performing the MDSS revision checks instead.Changes since v2:
- Added guarding checks forhw_intfandhw_ppin debug print (Marijn)
- Removed extra empty lines (Marijn)[...]
Applied, thanks!
[1/8] drm/msm/dpu: inline _setup_pingpong_ops()
https://gitlab.freedesktop.org/lumag/msm/-/commit/536cb755ae62 [2/8] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW https://gitlab.freedesktop.org/lumag/msm/-/commit/feb77ef1518e [3/8] drm/msm/dpu: drop the DPU_PINGPONG_TE flag https://gitlab.freedesktop.org/lumag/msm/-/commit/ec6a2b7ea1a4 [4/8] drm/msm/dpu: inline _setup_intf_ops() https://gitlab.freedesktop.org/lumag/msm/-/commit/3d6253c215c1 [5/8] drm/msm/dpu: enable INTF TE operations only when supported by HW https://gitlab.freedesktop.org/lumag/msm/-/commit/72e72051c9f3 [6/8] drm/msm/dpu: drop DPU_INTF_TE feature flag https://gitlab.freedesktop.org/lumag/msm/-/commit/6a0903388dcb [7/8] drm/msm/dpu: drop useless check from dpu_encoder_phys_cmd_te_rd_ptr_irq() https://gitlab.freedesktop.org/lumag/msm/-/commit/b9898213ae5a [8/8] drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init https://gitlab.freedesktop.org/lumag/msm/-/commit/4e2bbf17f41c
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>