drm/msm/dpu: remove dpu_encoder_phys_ops::atomic_mode_set callback
v4 cover drm/msm/dpu: remove dpu_encoder_phys_ops::atomic_mode_set callback
The dpu_encoder_phys_ops::atomic_mode_set() callback is mostly redundant. Implementations only set the IRQ indices there. Move statically allocated IRQs to dpu_encoder_phys_*_init() and set dynamically allocated IRQs in the irq_enable() callback.
The writeback backend of the dpu_encoder is the only user of the dpu_encoder_phys_ops::atomic_check() callback. Move corresponding code to the DPU's drm_writeback_connector implementation (dpu_writeback.c) and drop corresponding callback code.
Changes since v3:
- Fixed the crash in dpu_wb_conn_atomic_check (Abhinav)
Changes since v2:
- Rebase on top of linux-next
- Also incorporate the dpu_encoder_phys::atomic_check series
Changes since v1:
- Split trace events into enable/disable pairs (Abhinav).
Dmitry Baryshkov (5):
drm/msm/dpu: split irq_control into irq_enable and _disable drm/msm/dpu: split _dpu_encoder_resource_control_helper() drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c drm/msm/dpu: drop dpu_encoder_phys_ops::atomic_check()
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 94 ++++++++++-------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 15 +-- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 95 +++++++++---------- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 59 ++++++------ .../drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 88 ++++------------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 +- drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 74 +++++++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 57 ++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.h | 3 +- 9 files changed, 270 insertions(+), 224 deletions(-)
--
2.39.2
---
Dmitry Baryshkov (5):
drm/msm/dpu: split irq_control into irq_enable and _disable drm/msm/dpu: split _dpu_encoder_resource_control_helper() drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c drm/msm/dpu: drop dpu_encoder_phys_ops::atomic_check()
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 94 ++++++++++++--------- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 15 +--- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 95 +++++++++++----------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 59 ++++++-------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 88 ++++---------------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 +- drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 74 +++++++++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 61 +++++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.h | 3 +- 9 files changed, 274 insertions(+), 224 deletions(-)
---
base-commit: b1d3a0e70c3881d2f8cf6692ccf7c2a4fb2d030d
change-id: 20240208-fd_remove_phys_ops_atomic_mode_set-ab706706b374
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>
PATCH v4 1/5 drm/msm/dpu: split irq_control into irq_enable and _disable
The single helper for both enable and disable cases is too complicated, especially if we start adding more code to these helpers. Split it into irq_enable and irq_disable cases.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 36 +++++++++--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 6 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 65 +++++++++++----------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 46 ++++++++------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 29 +++++++--- drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 62 ++++++++++++++++----- 6 files changed, 158 insertions(+), 86 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +27 -9
@@ -714,7 +714,7 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, } } -static void _dpu_encoder_irq_control (struct drm_encoder *drm_enc,bool enable) +static void _dpu_encoder_irq_enable (struct drm_encoder *drm_enc) {struct dpu_encoder_virt *dpu_enc;int i;
@@ -726,14 +726,32 @@ static void _dpu_encoder_irq_control(struct drm_encoder *drm_enc, bool enable) dpu_enc =to_dpu_encoder_virt (drm_enc); -DPU_DEBUG_ENC (dpu_enc,"enable:%d\n" , enable); +DPU_DEBUG_ENC (dpu_enc,"\n" );for (i =0 ; i < dpu_enc->num_phys_encs; i++) {struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; -if (phys->ops.irq_control) - phys->ops.irq_control (phys, enable); + phys->ops.irq_enable (phys); + } +} + +static void _dpu_encoder_irq_disable (struct drm_encoder *drm_enc) +{ +struct dpu_encoder_virt *dpu_enc; +int i; + +if (!drm_enc) { +DPU_ERROR ("invalid encoder\n" ); +return ; } + dpu_enc =to_dpu_encoder_virt (drm_enc); + +DPU_DEBUG_ENC (dpu_enc,"\n" ); +for (i =0 ; i < dpu_enc->num_phys_encs; i++) { +struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; + + phys->ops.irq_disable (phys); + } } static void _dpu_encoder_resource_control_helper(struct drm_encoder *drm_enc,
@@ -759,11 +777,11 @@ static void _dpu_encoder_resource_control_helper(struct drm_encoder *drm_enc,pm_runtime_get_sync (&dpu_kms->pdev->dev);/* enable all the irq */ -_dpu_encoder_irq_control (drm_enc, true); +_dpu_encoder_irq_enable (drm_enc); }else {/* disable all the irq */ -_dpu_encoder_irq_control (drm_enc, false); +_dpu_encoder_irq_disable (drm_enc);/* disable DPU core clks */ pm_runtime_put_sync (&dpu_kms->pdev->dev);
@@ -824,7 +842,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc, }if (is_vid_mode && dpu_enc->rc_state ==DPU_ENC_RC_STATE_IDLE ) -_dpu_encoder_irq_control (drm_enc, true); +_dpu_encoder_irq_enable (drm_enc);else _dpu_encoder_resource_control_helper (drm_enc, true);
@@ -879,7 +897,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,if (is_vid_mode && dpu_enc->rc_state ==DPU_ENC_RC_STATE_IDLE ) { -_dpu_encoder_irq_control (drm_enc, true); +_dpu_encoder_irq_enable (drm_enc); }/* skip if is already OFF or IDLE, resources are off already */ else if (dpu_enc->rc_state == DPU_ENC_RC_STATE_OFF ||
@@ -954,7 +972,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc, }if (is_vid_mode) -_dpu_encoder_irq_control (drm_enc, false); +_dpu_encoder_irq_disable (drm_enc);else _dpu_encoder_resource_control_helper (drm_enc, false);
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +4 -2
@@ -85,7 +85,8 @@ struct dpu_encoder_phys;* @handle_post_kickoff: Do any work necessary post-kickoff work * @trigger_start: Process start event on physical encoder * @needs_single_flush: Whether encoder slaves need to be flushed -* @irq_control: Handler to enable/disable all the encoder IRQs +* @irq_enable: Handler to enable all the encoder IRQs +* @irq_disable: Handler to disable all the encoder IRQs * @prepare_idle_pc: phys encoder can update the vsync_enable status * on idle power collapse prepare * @restore: Restore all the encoder configs.
@@ -110,7 +111,8 @@ struct dpu_encoder_phys_ops {void (*handle_post_kickoff)(struct dpu_encoder_phys *phys_enc);void (*trigger_start)(struct dpu_encoder_phys *phys_enc);bool (*needs_single_flush)(struct dpu_encoder_phys *phys_enc); -void (*irq_control)(struct dpu_encoder_phys *phys,bool enable); +void (*irq_enable)(struct dpu_encoder_phys *phys); +void (*irq_disable)(struct dpu_encoder_phys *phys);void (*prepare_idle_pc)(struct dpu_encoder_phys *phys_enc);void (*restore)(struct dpu_encoder_phys *phys);int (*get_line_count)(struct dpu_encoder_phys *phys);
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +34 -31
81 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +25 -21
62 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +20 -9
@@ -511,21 +511,31 @@ static void dpu_encoder_phys_wb_done_irq(void *arg) }/** -* dpu_encoder_phys_wb_irq_ctrl - irq control of WB +* dpu_encoder_phys_wb_irq_enable - irq control of WB * @phys: Pointer to physical encoder -* @enable: indicates enable or disable interrupts */ -static void dpu_encoder_phys_wb_irq_ctrl ( -struct dpu_encoder_phys *phys,bool enable) +static void dpu_encoder_phys_wb_irq_enable (struct dpu_encoder_phys *phys) {struct dpu_encoder_phys_wb *wb_enc =to_dpu_encoder_phys_wb (phys); -if (enable &&atomic_inc_return (&wb_enc->wbirq_refcount) ==1 ) +if (atomic_inc_return (&wb_enc->wbirq_refcount) ==1 )dpu_core_irq_register_callback (phys->dpu_kms, - phys->irq[INTR_IDX_WB_DONE ], dpu_encoder_phys_wb_done_irq, phys); -else if (!enable && -atomic_dec_return (&wb_enc->wbirq_refcount) ==0 ) + phys->irq[INTR_IDX_WB_DONE ], + dpu_encoder_phys_wb_done_irq, + phys); +} + +/** +* dpu_encoder_phys_wb_irq_disable - irq control of WB +* @phys: Pointer to physical encoder +*/ +static void dpu_encoder_phys_wb_irq_disable (struct dpu_encoder_phys *phys) +{ + +struct dpu_encoder_phys_wb *wb_enc =to_dpu_encoder_phys_wb (phys); + +if (atomic_dec_return (&wb_enc->wbirq_refcount) ==0 )dpu_core_irq_unregister_callback (phys->dpu_kms, phys->irq[INTR_IDX_WB_DONE ]); }
@@ -785,7 +795,8 @@ static void dpu_encoder_phys_wb_init_ops(struct dpu_encoder_phys_ops *ops) ops->trigger_start = dpu_encoder_helper_trigger_start; ops->prepare_wb_job = dpu_encoder_phys_wb_prepare_wb_job; ops->cleanup_wb_job = dpu_encoder_phys_wb_cleanup_wb_job; - ops->irq_control = dpu_encoder_phys_wb_irq_ctrl; + ops->irq_enable = dpu_encoder_phys_wb_irq_enable; + ops->irq_disable = dpu_encoder_phys_wb_irq_disable; ops->is_valid_for_commit = dpu_encoder_phys_wb_is_valid_for_commit; }
drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h +48 -14
96 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [PATCH v4 1/5] drm/msm/dpu: split irq_control into irq_enable and _disable
Quoted 6 lines · Dmitry Baryshkov
The single helper for both enable and disable cases is too complicated, especially if we start adding more code to these helpers. Split it into
irq_enableandirq_disablecases.Reviewed-by Abhinav Kumar <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
PATCH v4 2/5 drm/msm/dpu: split _dpu_encoder_resource_control_helper()
In reply to Dmitry BaryshkovFollow the _dpu_encoder_irq_control() change and split the _dpu_encoder_resource_control_helper() into enable and disable parts.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 45 +++++++++++++++++++---------- drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 12 +++++--- 2 files changed, 37 insertions(+), 20 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +29 -16
@@ -754,8 +754,7 @@ static void _dpu_encoder_irq_disable(struct drm_encoder *drm_enc) } } -static void _dpu_encoder_resource_control_helper (struct drm_encoder *drm_enc, -bool enable) +static void _dpu_encoder_resource_enable (struct drm_encoder *drm_enc) {struct msm_drm_private *priv;struct dpu_kms *dpu_kms;
@@ -765,28 +764,42 @@ static void _dpu_encoder_resource_control_helper(struct drm_encoder *drm_enc, priv = drm_enc->dev->dev_private; dpu_kms =to_dpu_kms (priv->kms); -trace_dpu_enc_rc_helper (DRMID (drm_enc), enable); +trace_dpu_enc_rc_enable (DRMID (drm_enc));if (!dpu_enc->cur_master) {DPU_ERROR ("encoder master not set\n" );return ; } -if (enable) { -/* enable DPU core clks */ -pm_runtime_get_sync (&dpu_kms->pdev->dev); +/* enable DPU core clks */ +pm_runtime_get_sync (&dpu_kms->pdev->dev); -/* enable all the irq */ -_dpu_encoder_irq_enable (drm_enc); +/* enable all the irq */ +_dpu_encoder_irq_enable (drm_enc); +} - }else { -/* disable all the irq */ -_dpu_encoder_irq_disable (drm_enc); +static void _dpu_encoder_resource_disable (struct drm_encoder *drm_enc) +{ +struct msm_drm_private *priv; +struct dpu_kms *dpu_kms; +struct dpu_encoder_virt *dpu_enc; -/* disable DPU core clks */ -pm_runtime_put_sync (&dpu_kms->pdev->dev); + dpu_enc =to_dpu_encoder_virt (drm_enc); + priv = drm_enc->dev->dev_private; + dpu_kms =to_dpu_kms (priv->kms); + +trace_dpu_enc_rc_disable (DRMID (drm_enc)); + +if (!dpu_enc->cur_master) { +DPU_ERROR ("encoder master not set\n" ); +return ; } +/* disable all the irq */ +_dpu_encoder_irq_disable (drm_enc); + +/* disable DPU core clks */ +pm_runtime_put_sync (&dpu_kms->pdev->dev); } static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,
@@ -844,7 +857,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,if (is_vid_mode && dpu_enc->rc_state ==DPU_ENC_RC_STATE_IDLE )_dpu_encoder_irq_enable (drm_enc);else -_dpu_encoder_resource_control_helper (drm_enc, true); +_dpu_encoder_resource_enable (drm_enc); dpu_enc->rc_state =DPU_ENC_RC_STATE_ON ;
@@ -939,7 +952,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,* and in IDLE state the resources are already disabled */ if (dpu_enc->rc_state ==DPU_ENC_RC_STATE_PRE_OFF ) -_dpu_encoder_resource_control_helper (drm_enc, false); +_dpu_encoder_resource_disable (drm_enc); dpu_enc->rc_state =DPU_ENC_RC_STATE_OFF ;
@@ -974,7 +987,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,if (is_vid_mode)_dpu_encoder_irq_disable (drm_enc);else -_dpu_encoder_resource_control_helper (drm_enc, false); +_dpu_encoder_resource_disable (drm_enc); dpu_enc->rc_state =DPU_ENC_RC_STATE_IDLE ;
drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h +8 -4
@@ -273,6 +273,14 @@ DEFINE_EVENT(dpu_drm_obj_template, dpu_crtc_runtime_resume, TP_PROTO(uint32_t drm_id), TP_ARGS(drm_id) ); +DEFINE_EVENT (dpu_drm_obj_template, dpu_enc_rc_enable, + TP_PROTO(uint32_t drm_id), +TP_ARGS (drm_id) +); +DEFINE_EVENT (dpu_drm_obj_template, dpu_enc_rc_disable, + TP_PROTO(uint32_t drm_id), +TP_ARGS (drm_id) +); TRACE_EVENT(dpu_enc_enable, TP_PROTO(uint32_t drm_id, int hdisplay, int vdisplay),
@@ -342,10 +350,6 @@ DECLARE_EVENT_CLASS(dpu_enc_id_enable_template,TP_printk ("id=%u, enable=%s" , __entry->drm_id, __entry->enable ?"true" :"false" ) ); -DEFINE_EVENT (dpu_enc_id_enable_template, dpu_enc_rc_helper, - TP_PROTO(uint32_t drm_id, bool enable), -TP_ARGS (drm_id, enable) -);DEFINE_EVENT (dpu_enc_id_enable_template, dpu_enc_vblank_cb, TP_PROTO(uint32_t drm_id, bool enable), TP_ARGS(drm_id, enable)
Signature · 1 line
2.39.2
Re: [PATCH v4 2/5] drm/msm/dpu: split _dpu_encoder_resource_control_helper()
Quoted 5 lines · Dmitry Baryshkov
Follow the
_dpu_encoder_irq_control()change and split the_dpu_encoder_resource_control_helper()into enable and disable parts.Reviewed-by Abhinav Kumar <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
PATCH v4 3/5 drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set
In reply to Dmitry BaryshkovThe atomic_mode_set() callback only sets the phys_enc's IRQ data. As the INTF and WB are statically allocated to each encoder/phys_enc, drop the atomic_mode_set callback and set the IRQs during encoder init.
For the CMD panel usecase some of IRQ indexes depend on the selected resources. Move setting them to the irq_enable() callback.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 5 ---- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 32 ++++++++++------------ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 13 ++------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 11 +------- 5 files changed, 17 insertions(+), 46 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -2
@@ -1152,8 +1152,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, phys->hw_ctl =to_dpu_hw_ctl (hw_ctl[i]); phys->cached_mode = crtc_state->adjusted_mode; -if (phys->ops.atomic_mode_set) - phys->ops.atomic_mode_set (phys, crtc_state, conn_state); } }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +0 -5
@@ -69,8 +69,6 @@ struct dpu_encoder_phys;* @is_master: Whether this phys_enc is the current master * encoder. Can be switched at enable time. Based * on split_role and current mode (CMD/VID). -* @atomic_mode_set: DRM Call. Set a DRM mode. -* This likely caches the mode, for use at enable. * @enable: DRM Call. Enable a DRM mode. * @disable: DRM Call. Disable mode. * @atomic_check: DRM Call. Atomic check new DRM state.
@@ -96,9 +94,6 @@ struct dpu_encoder_phys;struct dpu_encoder_phys_ops {void (*prepare_commit)(struct dpu_encoder_phys *encoder);bool (*is_master)(struct dpu_encoder_phys *encoder); -void (*atomic_mode_set)(struct dpu_encoder_phys *encoder, -struct drm_crtc_state *crtc_state, -struct drm_connector_state *conn_state);void (*enable)(struct dpu_encoder_phys *encoder);void (*disable)(struct dpu_encoder_phys *encoder); int (*atomic_check)(struct dpu_encoder_phys *encoder,
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +14 -18
@@ -142,23 +142,6 @@ static void dpu_encoder_phys_cmd_underrun_irq(void *arg)dpu_encoder_underrun_callback (phys_enc->parent, phys_enc); } -static void dpu_encoder_phys_cmd_atomic_mode_set ( -struct dpu_encoder_phys *phys_enc, -struct drm_crtc_state *crtc_state, -struct drm_connector_state *conn_state) -{ - phys_enc->irq[INTR_IDX_CTL_START ] = phys_enc->hw_ctl->caps->intr_start; - - phys_enc->irq[INTR_IDX_PINGPONG ] = phys_enc->hw_pp->caps->intr_done; - -if (phys_enc->has_intf_te) - phys_enc->irq[INTR_IDX_RDPTR ] = phys_enc->hw_intf->cap->intr_tear_rd_ptr; -else - phys_enc->irq[INTR_IDX_RDPTR ] = phys_enc->hw_pp->caps->intr_rdptr; - - phys_enc->irq[INTR_IDX_UNDERRUN ] = phys_enc->hw_intf->cap->intr_underrun; -} -static int _dpu_encoder_phys_cmd_handle_ppdone_timeout (struct dpu_encoder_phys *phys_enc) {
@@ -297,6 +280,14 @@ static void dpu_encoder_phys_cmd_irq_enable(struct dpu_encoder_phys *phys_enc) phys_enc->hw_pp->idx -PINGPONG_0 , phys_enc->vblank_refcount); + phys_enc->irq[INTR_IDX_CTL_START ] = phys_enc->hw_ctl->caps->intr_start; + phys_enc->irq[INTR_IDX_PINGPONG ] = phys_enc->hw_pp->caps->intr_done; + +if (phys_enc->has_intf_te) + phys_enc->irq[INTR_IDX_RDPTR ] = phys_enc->hw_intf->cap->intr_tear_rd_ptr; +else + phys_enc->irq[INTR_IDX_RDPTR ] = phys_enc->hw_pp->caps->intr_rdptr; + dpu_core_irq_register_callback(phys_enc->dpu_kms, phys_enc->irq[INTR_IDX_PINGPONG], dpu_encoder_phys_cmd_pp_tx_done_irq,
@@ -327,6 +318,10 @@ static void dpu_encoder_phys_cmd_irq_disable(struct dpu_encoder_phys *phys_enc)dpu_core_irq_unregister_callback (phys_enc->dpu_kms, phys_enc->irq[INTR_IDX_UNDERRUN ]);dpu_encoder_phys_cmd_control_vblank_irq (phys_enc, false);dpu_core_irq_unregister_callback (phys_enc->dpu_kms, phys_enc->irq[INTR_IDX_PINGPONG ]); + + phys_enc->irq[INTR_IDX_CTL_START ] =0 ; + phys_enc->irq[INTR_IDX_PINGPONG ] =0 ; + phys_enc->irq[INTR_IDX_RDPTR ] =0 ; } static void dpu_encoder_phys_cmd_tearcheck_config(
@@ -706,7 +701,6 @@ static void dpu_encoder_phys_cmd_init_ops( struct dpu_encoder_phys_ops *ops) { ops->is_master = dpu_encoder_phys_cmd_is_master; - ops->atomic_mode_set = dpu_encoder_phys_cmd_atomic_mode_set; ops->enable = dpu_encoder_phys_cmd_enable; ops->disable = dpu_encoder_phys_cmd_disable; ops->control_vblank_irq = dpu_encoder_phys_cmd_control_vblank_irq;
@@ -745,6 +739,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(struct drm_device *dev,dpu_encoder_phys_cmd_init_ops (&phys_enc->ops); phys_enc->intf_mode =INTF_MODE_CMD ; + phys_enc->irq[INTR_IDX_UNDERRUN ] = phys_enc->hw_intf->cap->intr_underrun; + cmd_enc->stream_sel =0 ;if (!phys_enc->hw_intf) {
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +2 -11
@@ -349,16 +349,6 @@ static bool dpu_encoder_phys_vid_needs_single_flush(return phys_enc->split_role !=ENC_ROLE_SOLO ; } -static void dpu_encoder_phys_vid_atomic_mode_set ( -struct dpu_encoder_phys *phys_enc, -struct drm_crtc_state *crtc_state, -struct drm_connector_state *conn_state) -{ - phys_enc->irq[INTR_IDX_VSYNC ] = phys_enc->hw_intf->cap->intr_vsync; - - phys_enc->irq[INTR_IDX_UNDERRUN ] = phys_enc->hw_intf->cap->intr_underrun; -} -static int dpu_encoder_phys_vid_control_vblank_irq (struct dpu_encoder_phys *phys_enc,bool enable)
@@ -686,7 +676,6 @@ static int dpu_encoder_phys_vid_get_frame_count(static void dpu_encoder_phys_vid_init_ops (struct dpu_encoder_phys_ops *ops) { ops->is_master = dpu_encoder_phys_vid_is_master; - ops->atomic_mode_set = dpu_encoder_phys_vid_atomic_mode_set; ops->enable = dpu_encoder_phys_vid_enable; ops->disable = dpu_encoder_phys_vid_disable; ops->control_vblank_irq = dpu_encoder_phys_vid_control_vblank_irq;
@@ -725,6 +714,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_vid_init(struct drm_device *dev,dpu_encoder_phys_vid_init_ops (&phys_enc->ops); phys_enc->intf_mode =INTF_MODE_VIDEO ; + phys_enc->irq[INTR_IDX_VSYNC ] = phys_enc->hw_intf->cap->intr_vsync; + phys_enc->irq[INTR_IDX_UNDERRUN ] = phys_enc->hw_intf->cap->intr_underrun;DPU_DEBUG_VIDENC (phys_enc,"created intf idx:%d\n" , p->hw_intf->idx);
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +1 -10
@@ -539,15 +539,6 @@ static void dpu_encoder_phys_wb_irq_disable(struct dpu_encoder_phys *phys)dpu_core_irq_unregister_callback (phys->dpu_kms, phys->irq[INTR_IDX_WB_DONE ]); } -static void dpu_encoder_phys_wb_atomic_mode_set ( -struct dpu_encoder_phys *phys_enc, -struct drm_crtc_state *crtc_state, -struct drm_connector_state *conn_state) -{ - - phys_enc->irq[INTR_IDX_WB_DONE ] = phys_enc->hw_wb->caps->intr_wb_done; -} -static void _dpu_encoder_phys_wb_handle_wbdone_timeout (struct dpu_encoder_phys *phys_enc) {
@@ -784,7 +775,6 @@ static bool dpu_encoder_phys_wb_is_valid_for_commit(struct dpu_encoder_phys *phystatic void dpu_encoder_phys_wb_init_ops (struct dpu_encoder_phys_ops *ops) { ops->is_master = dpu_encoder_phys_wb_is_master; - ops->atomic_mode_set = dpu_encoder_phys_wb_atomic_mode_set; ops->enable = dpu_encoder_phys_wb_enable; ops->disable = dpu_encoder_phys_wb_disable; ops->atomic_check = dpu_encoder_phys_wb_atomic_check;
@@ -831,6 +821,7 @@ struct dpu_encoder_phys *dpu_encoder_phys_wb_init(struct drm_device *dev,dpu_encoder_phys_wb_init_ops (&phys_enc->ops); phys_enc->intf_mode =INTF_MODE_WB_LINE ; + phys_enc->irq[INTR_IDX_WB_DONE ] = phys_enc->hw_wb->caps->intr_wb_done;atomic_set (&wb_enc->wbirq_refcount,0 );
Signature · 1 line
2.39.2
Re: [PATCH v4 3/5] drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set
Quoted 10 lines · Dmitry Baryshkov
The
atomic_mode_set()callback only sets the phys_enc's IRQ data. As the INTF and WB are statically allocated to each encoder/phys_enc, drop theatomic_mode_setcallback and set the IRQs during encoder init.For the CMD panel usecase some of IRQ indexes depend on the selected resources. Move setting them to the
irq_enable()callback.Reviewed-by Abhinav Kumar <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
PATCH v4 4/5 drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c
In reply to Dmitry Baryshkovdpu_encoder_phys_wb is the only user of encoder's atomic_check callback. Move corresponding checks to drm_writeback_connector's implementation and drop the dpu_encoder_phys_wb_atomic_check() function.
--- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 54 ------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 61 +++++++++++++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.h | 3 +- 4 files changed, 68 insertions(+), 59 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +0 -54
@@ -354,59 +354,6 @@ static void dpu_encoder_helper_phys_setup_cdm(struct dpu_encoder_phys *phys_enc) } } -/** -* dpu_encoder_phys_wb_atomic_check - verify and fixup given atomic states -* @phys_enc: Pointer to physical encoder -* @crtc_state: Pointer to CRTC atomic state -* @conn_state: Pointer to connector atomic state -*/ -static int dpu_encoder_phys_wb_atomic_check ( -struct dpu_encoder_phys *phys_enc, -struct drm_crtc_state *crtc_state, -struct drm_connector_state *conn_state) -{ -struct drm_framebuffer *fb; -const struct drm_display_mode *mode = &crtc_state->mode; - -DPU_DEBUG ("[atomic_check:%d, \"%s\",%d,%d]\n" , - phys_enc->hw_wb->idx, mode->name, mode->hdisplay, mode->vdisplay); - -if (!conn_state || !conn_state->connector) { -DPU_ERROR ("invalid connector state\n" ); -return -EINVAL ; - }else if (conn_state->connector->status != - connector_status_connected) { -DPU_ERROR ("connector not connected %d\n" , - conn_state->connector->status); -return -EINVAL ; - } - -if (!conn_state->writeback_job || !conn_state->writeback_job->fb) -return 0 ; - - fb = conn_state->writeback_job->fb; - -DPU_DEBUG ("[fb_id:%u][fb:%u,%u]\n" , fb->base.id, - fb->width, fb->height); - -if (fb->width != mode->hdisplay) { -DPU_ERROR ("invalid fb w=%d, mode w=%d\n" , fb->width, - mode->hdisplay); -return -EINVAL ; - }else if (fb->height != mode->vdisplay) { -DPU_ERROR ("invalid fb h=%d, mode h=%d\n" , fb->height, - mode->vdisplay); -return -EINVAL ; - }else if (fb->width > phys_enc->hw_wb->caps->maxlinewidth) { -DPU_ERROR ("invalid fb w=%d, maxlinewidth=%u\n" , - fb->width, phys_enc->hw_wb->caps->maxlinewidth); -return -EINVAL ; - } - -return drm_atomic_helper_check_wb_connector_state (conn_state->connector, conn_state->state); -} - -/** * _dpu_encoder_phys_wb_update_flush - flush hardware update * @phys_enc: Pointer to physical encoder
@@ -777,7 +724,6 @@ static void dpu_encoder_phys_wb_init_ops(struct dpu_encoder_phys_ops *ops) ops->is_master = dpu_encoder_phys_wb_is_master; ops->enable = dpu_encoder_phys_wb_enable; ops->disable = dpu_encoder_phys_wb_disable; - ops->atomic_check = dpu_encoder_phys_wb_atomic_check; ops->wait_for_commit_done = dpu_encoder_phys_wb_wait_for_commit_done; ops->prepare_for_kickoff = dpu_encoder_phys_wb_prepare_for_kickoff; ops->handle_post_kickoff = dpu_encoder_phys_wb_handle_post_kickoff;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +6 -3
@@ -630,23 +630,26 @@ static int _dpu_kms_initialize_writeback(struct drm_device *dev, {struct drm_encoder *encoder =NULL ;struct msm_display_info info; +const enum dpu_wb wb_idx =WB_2 ; +u32 maxlinewidth;int rc;memset (&info,0 ,sizeof (info)); info.num_of_h_tiles =1 ;/* use only WB idx 2 instance for DPU */ - info.h_tile_instance[0 ] =WB_2 ; + info.h_tile_instance[0 ] = wb_idx; info.intf_type =INTF_WB ; + maxlinewidth =dpu_rm_get_wb (&dpu_kms->rm, info.h_tile_instance[0 ])->caps->maxlinewidth; + encoder =dpu_encoder_init (dev,DRM_MODE_ENCODER_VIRTUAL , &info);if (IS_ERR (encoder)) {DPU_ERROR ("encoder init failed for dsi display\n" );return PTR_ERR (encoder); } - rc =dpu_writeback_init (dev, encoder, wb_formats, - n_formats); + rc =dpu_writeback_init (dev, encoder, wb_formats, n_formats, maxlinewidth);if (rc) {DPU_ERROR ("dpu_writeback_init, rc = %d\n" , rc);return rc;
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +60 -1
90 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.h +2 -1
@@ -18,6 +18,7 @@struct dpu_wb_connector {struct drm_writeback_connector base;struct drm_encoder *wb_enc; +u32 maxlinewidth; };static inline struct dpu_wb_connector *to_dpu_wb_conn (struct drm_writeback_connector *conn)
@@ -26,6 +27,6 @@ static inline struct dpu_wb_connector *to_dpu_wb_conn(struct drm_writeback_conne }int dpu_writeback_init (struct drm_device *dev,struct drm_encoder *enc, -const u32 *format_list,u32 num_formats); +const u32 *format_list,u32 num_formats,u32 maxlinewidth);#endif /*_DPU_WRITEBACK_H */
Signature · 1 line
2.39.2
Re: [PATCH v4 4/5] drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c
Quoted 12 lines · Dmitry Baryshkov
dpu_encoder_phys_wbis the only user of encoder'satomic_checkcallback. Move corresponding checks to drm_writeback_connector's implementation and drop thedpu_encoder_phys_wb_atomic_check()function.Signed-off-by Dmitry Baryshkov <[email protected]>--- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 54 ------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 61 +++++++++++++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.h | 3 +- 4 files changed, 68 insertions(+), 59 deletions(-)
<Snip>
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c static int dpu_wb_conn_get_modes(struct drm_connector *connector) · line 53
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +5
-0+ + crtc = conn_state->crtc; +if (!crtc) +return 0 ; +
This should fix the crash and rest of the change LGTM
Please give us a couple of days to re-test this and give our Tested-by as we plan to rebase CDM over DP on top of this and post V2.
Paloma Arellano
Tested-byRe: [PATCH v4 4/5] drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c
Quoted 28 lines · Abhinav Kumar
Quoted 14 lines · Dmitry Baryshkov
dpu_encoder_phys_wbis the only user of encoder'satomic_checkcallback. Move corresponding checks to drm_writeback_connector's implementation and drop thedpu_encoder_phys_wb_atomic_check()function.Signed-off-by Dmitry Baryshkov <[email protected]>---
.../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 54
-------------------
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 61
+++++++++++++++++++++-
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.h | 3 +-4 files changed, 68 insertions(+), 59 deletions(-)<Snip>
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c static int dpu_wb_conn_get_modes(struct drm_connector *connector) · line 53
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +5
-0+ + crtc = conn_state->crtc; + if (!crtc) + return 0; +This should fix the crash and rest of the change LGTM
Quoted 1 line
Reviewed-by Abhinav Kumar <[email protected]>
Quoted 3 lines
Please give us a couple of days to re-test this and give our Tested-by as we plan to rebase CDM over DP on top of this and post V2.
Re: [PATCH v4 4/5] drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c
In reply to Dmitry BaryshkovQuoted 5 lines · Dmitry Baryshkov
dpu_encoder_phys_wbis the only user of encoder'satomic_checkcallback. Move corresponding checks to drm_writeback_connector's implementation and drop thedpu_encoder_phys_wb_atomic_check()function.Signed-off-by Dmitry Baryshkov <[email protected]>
PATCH v4 5/5 drm/msm/dpu: drop dpu_encoder_phys_ops::atomic_check()
In reply to Dmitry BaryshkovWriteback was the last user of dpu_encoder_phys_ops's atomic_check() callback. As the code was moved to the dpu_writeback.c, the callback becomes unused. Drop it now.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 15 --------------- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 4 ---- 2 files changed, 19 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -15
@@ -584,7 +584,6 @@ static int dpu_encoder_virt_atomic_check(struct dpu_global_state *global_state;struct drm_framebuffer *fb;struct drm_dsc_config *dsc; -int i =0 ;int ret =0 ;if (!drm_enc || !crtc_state || !conn_state) {
@@ -605,20 +604,6 @@ static int dpu_encoder_virt_atomic_check(trace_dpu_enc_atomic_check (DRMID (drm_enc)); -/* perform atomic check on the first physical encoder (master) */ -for (i =0 ; i < dpu_enc->num_phys_encs; i++) { -struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; - -if (phys->ops.atomic_check) - ret = phys->ops.atomic_check (phys, crtc_state, - conn_state); -if (ret) { -DPU_ERROR_ENC (dpu_enc, -"mode unsupported, phys idx %d\n" , i); -return ret; - } - } - dsc =dpu_encoder_get_dsc_config (drm_enc); topology =dpu_encoder_get_topology (dpu_enc, dpu_kms, adj_mode, crtc_state, dsc);
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +0 -4
@@ -71,7 +71,6 @@ struct dpu_encoder_phys;* on split_role and current mode (CMD/VID). * @enable: DRM Call. Enable a DRM mode. * @disable: DRM Call. Disable mode. -* @atomic_check: DRM Call. Atomic check new DRM state. * @control_vblank_irq Register/Deregister for VBLANK IRQ * @wait_for_commit_done: Wait for hardware to have flushed the * current pending frames to hardware
@@ -96,9 +95,6 @@ struct dpu_encoder_phys_ops {bool (*is_master)(struct dpu_encoder_phys *encoder);void (*enable)(struct dpu_encoder_phys *encoder);void (*disable)(struct dpu_encoder_phys *encoder); -int (*atomic_check)(struct dpu_encoder_phys *encoder, -struct drm_crtc_state *crtc_state, -struct drm_connector_state *conn_state);int (*control_vblank_irq)(struct dpu_encoder_phys *enc,bool enable);int (*wait_for_commit_done)(struct dpu_encoder_phys *phys_enc);int (*wait_for_tx_complete)(struct dpu_encoder_phys *phys_enc);
Signature · 1 line
2.39.2
Re: [PATCH v4 5/5] drm/msm/dpu: drop dpu_encoder_phys_ops::atomic_check()
Quoted 6 lines · Dmitry Baryshkov
Writeback was the last user of dpu_encoder_phys_ops's
atomic_check()callback. As the code was moved to thedpu_writeback.c, the callback becomes unused. Drop it now.Reviewed-by Abhinav Kumar <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
Dmitry Baryshkov
AppliedQuoted 11 lines · Dmitry Baryshkov
The
dpu_encoder_phys_ops::atomic_mode_set()callback is mostly redundant. Implementations only set the IRQ indices there. Move statically allocated IRQs to dpu_encoder_phys_*_init() and set dynamically allocated IRQs in theirq_enable()callback.The writeback backend of the
dpu_encoderis the only user of thedpu_encoder_phys_ops::atomic_check()callback. Move corresponding code to the DPU'sdrm_writeback_connectorimplementation (dpu_writeback.c) and drop corresponding callback code.[...]
Applied, thanks!
[1/5] drm/msm/dpu: split irq_control into irq_enable and _disable
https://gitlab.freedesktop.org/lumag/msm/-/commit/c6f60037bfa0 [2/5] drm/msm/dpu: split _dpu_encoder_resource_control_helper() https://gitlab.freedesktop.org/lumag/msm/-/commit/ca8c1fd3eed8 [3/5] drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set https://gitlab.freedesktop.org/lumag/msm/-/commit/d13f638c9b88 [4/5] drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c https://gitlab.freedesktop.org/lumag/msm/-/commit/71174f362d67 [5/5] drm/msm/dpu: drop dpu_encoder_phys_ops::atomic_check() https://gitlab.freedesktop.org/lumag/msm/-/commit/b0b621f41b45
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>