drm/rockchip: vop: power off until vop standby take effect
Subsystems (4)
PATCH 1/1 drm/rockchip: vop: power off until vop standby take effect
Vop standby will take effect end of current frame, if dsp_hold_valid_irq happen, it means vop standby complete.
we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +63 -13
@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;
@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled); + +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (1 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} + +static void vop_dsp_hold_valid_irq_disable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled); + +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (0 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} +static void vop_enable (struct drm_crtc *crtc) {struct vop *vop =to_vop (crtc);
@@ -454,26 +483,36 @@ static void vop_disable(struct drm_crtc *crtc)drm_vblank_off (crtc->dev, vop->pipe); -disable_irq (vop->irq); -/* -* TODO: Since standby doesn't take effect until the next vblank, -* when we turn off dclk below, the vop is probably still active. +* Vop standby will take effect until end of current frame, +* if dsp hold valid irq happen, it means standby complete. +* +* we must wait standby complete when we want to disable aclk, +* if not, memory bus maybe dead. */ +reinit_completion (&vop->dsp_hold_completion); +vop_dsp_hold_valid_irq_enable (vop); +spin_lock (&vop->reg_lock);VOP_CTRL_SET (vop, standby,1 );spin_unlock (&vop->reg_lock); +wait_for_completion (&vop->dsp_hold_completion); + +vop_dsp_hold_valid_irq_disable (vop); + +disable_irq (vop->irq); + vop->is_enabled = false; +/* -* disable dclk to stop frame scan, so we can safely detach iommu, +* vop standby complete, so iommu detach is safe. */ -clk_disable (vop->dclk); -rockchip_drm_dma_detach_device (vop->drm_dev, vop->dev); +clk_disable (vop->dclk);clk_disable (vop->aclk);clk_disable (vop->hclk); }
@@ -1086,6 +1125,7 @@ static irqreturn_t vop_isr(int irq, void *data)struct vop *vop = data;uint32_t intr0_reg, active_irqs;unsigned long flags; +int ret =IRQ_NONE ;/* * INTR_CTRL0 register has interrupt status, enable and clear bits, we
@@ -1104,15 +1144,24 @@ static irqreturn_t vop_isr(int irq, void *data)if (!active_irqs)return IRQ_NONE ; -/* Only Frame Start Interrupt is enabled; other irqs are spurious. */ -if (!(active_irqs &FS_INTR )) { -DRM_ERROR ("Unknown VOP IRQs: %#02x\n" , active_irqs); -return IRQ_NONE ; +if (active_irqs &DSP_HOLD_VALID_INTR ) { +if (!completion_done (&vop->dsp_hold_completion)) +complete (&vop->dsp_hold_completion); + active_irqs &= ~DSP_HOLD_VALID_INTR ; + ret =IRQ_HANDLED ; } -drm_handle_vblank (vop->drm_dev, vop->pipe); +if (active_irqs &FS_INTR ) { +drm_handle_vblank (vop->drm_dev, vop->pipe); + active_irqs &= ~FS_INTR ; + ret = (vop->vsync_work_pending) ?IRQ_WAKE_THREAD :IRQ_HANDLED ; + } -return (vop->vsync_work_pending) ?IRQ_WAKE_THREAD :IRQ_HANDLED ; +/* Unhandled irqs are spurious. */ +if (active_irqs) +DRM_ERROR ("Unknown VOP IRQs: %#02x\n" , active_irqs); + +return ret; }static int vop_create_crtc (struct vop *vop)
@@ -1194,6 +1243,7 @@ static int vop_create_crtc(struct vop *vop) goto err_cleanup_crtc; } +init_completion (&vop->dsp_hold_completion); crtc->port = port; vop->pipe =drm_crtc_index (crtc);rockchip_register_crtc_funcs (drm_dev, &private_crtc_funcs, vop->pipe);
Signature · 7 lines
1.7.9.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Mark,
Am Samstag, 31. Januar 2015, 16:41:38 schrieb Mark Yao:
Quoted 25 lines
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)
(quoted diff) +0
-0
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.cindex fb25836..47ea61f 100644drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);
BUG_ON is generally not well liked in general error handling - i.e. in the
!vop->is_enabled
bad things may happen, but this may not always be the case. And BUG_ON effectively kills the machine.
You could simply use a WARN_ON, so people see that something really strange is going on but can still try to recover things.
Quoted 4 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-0+ +spin_lock_irqsave (&vop->irq_lock, flags); + + vop_mask_write(vop, INTR_CTRL0, DSP_HOLD_VALID_INTR_MASK,
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 404
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +10
-0+ DSP_HOLD_VALID_INTR_EN(1)); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} + +static void vop_dsp_hold_valid_irq_disable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);
same here
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 416
Quoted 12 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +9
-0+ +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (0 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} +static void vop_enable (struct drm_crtc *crtc) {struct vop *vop =to_vop (crtc);
except the above
[but take it with a grain of salt, as I'm still new to drm-land :-) ]
Heiko
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 37 lines · Heiko Stübner
Hi Mark,
Am Samstag, 31. Januar 2015, 16:41:38 schrieb Mark Yao:
Quoted 25 lines
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)
(quoted diff) +0
-0
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.cindex fb25836..47ea61f 100644drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);
BUG_ONis generally not well liked in general error handling - i.e. in the
Quoted 6 lines
!vop->is_enabledbad things may happen, but this may not always be the case. And
BUG_ONeffectively kills the machine.You could simply use a
WARN_ON, so people see that something really strange is going on but can still try to recover things.
Right, got it.
Quoted 31 lines
Quoted 5 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-0+ +spin_lock_irqsave (&vop->irq_lock, flags); + + vop_mask_write(vop, INTR_CTRL0, DSP_HOLD_VALID_INTR_MASK,drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 404
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +10
-0+ DSP_HOLD_VALID_INTR_EN(1)); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} + +static void vop_dsp_hold_valid_irq_disable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);same here
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 416
Quoted 12 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +9
-0+ +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (0 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} +static void vop_enable (struct drm_crtc *crtc) {struct vop *vop =to_vop (crtc);except the above
Quoted 3 lines
Reviewed-by Heiko Stuebner <[email protected]>[but take it with a grain of salt, as I'm still new to drm-land :-) ]
Good, I saw your drm patches, I'm interested in those, very good.
Mark
Quoted 5 lines
Heiko
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Mark, Heiko,
Quoted 24 lines · Mark Yao
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);
Re: Heiko "use a WARN_ON":
If the VOP clock is off, then the system will just hang when trying to write the VOP register so in this case, BUG_ON gives a more reliable crash dump than the hang.
Quoted 27 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +23
-0+ +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (1 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} + +static void vop_dsp_hold_valid_irq_disable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled); + +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (0 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} +static void vop_enable (struct drm_crtc *crtc) {struct vop *vop =to_vop (crtc);
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static void vop_disable(struct drm_crtc *crtc) · line 487
Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-4@@ -454,26 +483,36 @@ static void vop_disable(struct drm_crtc *crtc)drm_vblank_off (crtc->dev, vop->pipe); -disable_irq (vop->irq); -/* -* TODO: Since standby doesn't take effect until the next vblank, -* when we turn off dclk below, the vop is probably still active. +* Vop standby will take effect until end of current frame,
"Vop standby will take effect at end of current frame"
Quoted 43 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +17
-3+* if dsp hold valid irq happen, it means standby complete. +* +* we must wait standby complete when we want to disable aclk, +* if not, memory bus maybe dead. */ +reinit_completion (&vop->dsp_hold_completion); +vop_dsp_hold_valid_irq_enable (vop); +spin_lock (&vop->reg_lock);VOP_CTRL_SET (vop, standby,1 );spin_unlock (&vop->reg_lock); +wait_for_completion (&vop->dsp_hold_completion); + +vop_dsp_hold_valid_irq_disable (vop); + +disable_irq (vop->irq); + vop->is_enabled = false; +/* -* disable dclk to stop frame scan, so we can safely detach iommu, +* vop standby complete, so iommu detach is safe. */ -clk_disable (vop->dclk); -rockchip_drm_dma_detach_device (vop->drm_dev, vop->dev); +clk_disable (vop->dclk);clk_disable (vop->aclk);clk_disable (vop->hclk); }@@ -1086,6 +1125,7 @@ static irqreturn_t vop_isr(int irq, void *data)struct vop *vop = data;uint32_t intr0_reg, active_irqs;unsigned long flags; +int ret =IRQ_NONE ;/* * INTR_CTRL0 register has interrupt status, enable and clear bits, we
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1148
Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2
-4@@ -1104,15 +1144,24 @@ static irqreturn_t vop_isr(int irq, void *data)if (!active_irqs)return IRQ_NONE ; -/* Only Frame Start Interrupt is enabled; other irqs are spurious. */ -if (!(active_irqs &FS_INTR )) { -DRM_ERROR ("Unknown VOP IRQs: %#02x\n" , active_irqs); -return IRQ_NONE ; +if (active_irqs &DSP_HOLD_VALID_INTR ) { +if (!completion_done (&vop->dsp_hold_completion))
Why is this "completion_done" check needed?
I guess it doesn't help, but isn't strictly needed, since the dsp_hold_completion is a one shot, right?
In any case, this should work as it is, so:
Quoted 30 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +14
-3+complete (&vop->dsp_hold_completion); + active_irqs &= ~DSP_HOLD_VALID_INTR ; + ret =IRQ_HANDLED ; } -drm_handle_vblank (vop->drm_dev, vop->pipe); +if (active_irqs &FS_INTR ) { +drm_handle_vblank (vop->drm_dev, vop->pipe); + active_irqs &= ~FS_INTR ; + ret = (vop->vsync_work_pending) ?IRQ_WAKE_THREAD :IRQ_HANDLED ; + } -return (vop->vsync_work_pending) ?IRQ_WAKE_THREAD :IRQ_HANDLED ; +/* Unhandled irqs are spurious. */ +if (active_irqs) +DRM_ERROR ("Unknown VOP IRQs: %#02x\n" , active_irqs); + +return ret; }static int vop_create_crtc (struct vop *vop)@@ -1194,6 +1243,7 @@ static int vop_create_crtc(struct vop *vop) goto err_cleanup_crtc; } +init_completion (&vop->dsp_hold_completion); crtc->port = port; vop->pipe =drm_crtc_index (crtc);rockchip_register_crtc_funcs (drm_dev, &private_crtc_funcs, vop->pipe); --
Quoted 3 lines
1.7.9.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 37 lines · Daniel Kurtz
Hi Mark, Heiko,
Quoted 24 lines · Mark Yao
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);Re: Heiko "use a
WARN_ON":
Quoted 3 lines
If the VOP clock is off, then the system will just hang when trying to write the VOP register so in this case,
BUG_ONgives a more reliable crash dump than the hang.
In this way, you are right, if vop clocks is disabled, write vop
register will hang system, and the WARN_ON
crash dump may be have no chance to print.
Quoted 31 lines
Quoted 31 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +23
-0+ +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (1 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} + +static void vop_dsp_hold_valid_irq_disable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled); + +spin_lock_irqsave (&vop->irq_lock, flags); + +vop_mask_write (vop,INTR_CTRL0 ,DSP_HOLD_VALID_INTR_MASK , +DSP_HOLD_VALID_INTR_EN (0 )); + +spin_unlock_irqrestore (&vop->irq_lock, flags); +} +static void vop_enable (struct drm_crtc *crtc) {struct vop *vop =to_vop (crtc);@@ -454,26 +483,36 @@ static void vop_disable(struct drm_crtc *crtc)drm_vblank_off (crtc->dev, vop->pipe);
Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static void vop_disable(struct drm_crtc *crtc) · line 487
Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-4-disable_irq (vop->irq); -/* -* TODO: Since standby doesn't take effect until the next vblank, -* when we turn off dclk below, the vop is probably still active. +* Vop standby will take effect until end of current frame, "Vop standby will take effect at end of current frame"
OK
Quoted 46 lines
Quoted 46 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +17
-3+* if dsp hold valid irq happen, it means standby complete. +* +* we must wait standby complete when we want to disable aclk, +* if not, memory bus maybe dead. */ +reinit_completion (&vop->dsp_hold_completion); +vop_dsp_hold_valid_irq_enable (vop); +spin_lock (&vop->reg_lock);VOP_CTRL_SET (vop, standby,1 );spin_unlock (&vop->reg_lock); +wait_for_completion (&vop->dsp_hold_completion); + +vop_dsp_hold_valid_irq_disable (vop); + +disable_irq (vop->irq); + vop->is_enabled = false; +/* -* disable dclk to stop frame scan, so we can safely detach iommu, +* vop standby complete, so iommu detach is safe. */ -clk_disable (vop->dclk); -rockchip_drm_dma_detach_device (vop->drm_dev, vop->dev); +clk_disable (vop->dclk);clk_disable (vop->aclk);clk_disable (vop->hclk); }@@ -1086,6 +1125,7 @@ static irqreturn_t vop_isr(int irq, void *data)struct vop *vop = data;uint32_t intr0_reg, active_irqs;unsigned long flags; +int ret =IRQ_NONE ;/* * INTR_CTRL0 register has interrupt status, enable and clear bits, we @@ -1104,15 +1144,24 @@ static irqreturn_t vop_isr(int irq, void *data)if (!active_irqs)return IRQ_NONE ;
Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1148
Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2
-4-/* Only Frame Start Interrupt is enabled; other irqs are spurious. */ -if (!(active_irqs &FS_INTR )) { -DRM_ERROR ("Unknown VOP IRQs: %#02x\n" , active_irqs); -return IRQ_NONE ; +if (active_irqs &DSP_HOLD_VALID_INTR ) { +if (!completion_done (&vop->dsp_hold_completion))Why is this "
completion_done" check needed?
I guess it doesn't help, but isn't strictly needed, since thedsp_hold_completionis a one shot, right?
Right, the DSP_HOLD_VALID_INTR only happen when standby complete, one standby one irq.
Mark
Quoted 29 lines
In any case, this should work as it is, so:
Reviewed-by Daniel Kurtz <[email protected]>Quoted 25 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +13
-2+complete (&vop->dsp_hold_completion); + active_irqs &= ~DSP_HOLD_VALID_INTR ; + ret =IRQ_HANDLED ; } -drm_handle_vblank (vop->drm_dev, vop->pipe); +if (active_irqs &FS_INTR ) { +drm_handle_vblank (vop->drm_dev, vop->pipe); + active_irqs &= ~FS_INTR ; + ret = (vop->vsync_work_pending) ?IRQ_WAKE_THREAD :IRQ_HANDLED ; + } -return (vop->vsync_work_pending) ?IRQ_WAKE_THREAD :IRQ_HANDLED ; +/* Unhandled irqs are spurious. */ +if (active_irqs) +DRM_ERROR ("Unknown VOP IRQs: %#02x\n" , active_irqs); + +return ret; }static int vop_create_crtc (struct vop *vop)@@ -1194,6 +1243,7 @@ static int vop_create_crtc(struct vop *vop) goto err_cleanup_crtc; }
Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-1+init_completion (&vop->dsp_hold_completion); crtc->port = port; vop->pipe =drm_crtc_index (crtc);rockchip_register_crtc_funcs (drm_dev, &private_crtc_funcs, vop->pipe); --1.7.9.5
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 38 lines · Mark yao
Quoted 37 lines · Daniel Kurtz
Hi Mark, Heiko,
Quoted 24 lines · Mark Yao
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);Re: Heiko "use a
WARN_ON":
Quoted 5 lines
Quoted 3 lines
If the VOP clock is off, then the system will just hang when trying to write the VOP register so in this case,
BUG_ONgives a more reliable crash dump than the hang.In this way, you are right, if vop clocks is disabled, write vop register
will hang system, and theWARN_ON
if (WARN_ON(cond))
return;
is what we commonly use in i915. Because it's really not any good to use BUG_ON in drm drivers, at least if you expect anyone to use fbcon on top of it (i.e. anything even remotely resembling a normal distro): Then the intial modeset is all done under console_lock, which means that _none_ of your BUG_ON will ever get out over serial console.
The problem is fbcon locking, but no fool yet signed up to fix it (it's horrible, I looked ...).
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 53 lines · Daniel Vetter
Quoted 38 lines · Mark yao
Quoted 37 lines · Daniel Kurtz
Hi Mark, Heiko,
Quoted 24 lines · Mark Yao
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);Re: Heiko "use a
WARN_ON":Quoted 5 lines
Quoted 3 lines
If the VOP clock is off, then the system will just hang when trying to write the VOP register so in this case,
BUG_ONgives a more reliable crash dump than the hang.In this way, you are right, if vop clocks is disabled, write vop register
will hang system, and theWARN_ONif (
WARN_ON(cond))return;is what we commonly use in i915. Because it's really not any good to use
BUG_ONin drm drivers, at least if you expect anyone to use fbcon on top of it (i.e. anything even remotely resembling a normal distro): Then the intial modeset is all done underconsole_lock, which means that _none_ of yourBUG_ONwill ever get out over serial console.
Quoted 3 lines
The problem is fbcon locking, but no fool yet signed up to fix it (it's horrible, I looked ...).
-Daniel
I know this problem, if fbcon locking, and BUG_ON, we can't get any log from serial console, Trouble me many times. So know, if no drm log output, the first thing I do is remove the fbcon lock, and then we can see the crash dump.
But here, I expect to use BUG_ON, because if BUG happen, vop register will hang system, and WARN_ON may be have no chance to output.
Mark
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 66 lines · Mark yao
Quoted 60 lines · Daniel Vetter
Quoted 42 lines · Mark yao
Quoted 40 lines · Daniel Kurtz
Hi Mark, Heiko,
Quoted 25 lines · Mark Yao
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);Re: Heiko "use a
WARN_ON":Quoted 6 lines
Quoted 3 lines
If the VOP clock is off, then the system will just hang when trying to write the VOP register so in this case,
BUG_ONgives a more reliable crash dump than the hang.In this way, you are right, if vop clocks is disabled, write vop register
will hang system, and theWARN_ONif (
WARN_ON(cond))return;is what we commonly use in i915. Because it's really not any good to use
BUG_ONin drm drivers, at least if you expect anyone to use fbcon on top of it (i.e. anything even remotely resembling a normal distro): Then the intial modeset is all done underconsole_lock, which means that _none_ of yourBUG_ONwill ever get out over serial console.Quoted 3 lines
The problem is fbcon locking, but no fool yet signed up to fix it (it's horrible, I looked ...).
-Daniel
Quoted 6 lines
I know this problem, if fbcon locking, and
BUG_ON, we can't get any log from serial console, Trouble me many times. So know, if no drm log output, the first thing I do is remove the fbcon lock, and then we can see the crash dump.But here, I expect to use
BUG_ON, because if BUG happen, vop register will hang system, andWARN_ONmay be have no chance to output.
Yeah, but danvet is suggesting we just return immediately on the WARN_ON condition, to avoid accessing the vop registers and hanging.
Thus, the WARN_ON will have a chance to put out (unless the early return path goes off and finds some other unprotected path goes to access unlocked registers).
-Dan
Quoted 3 lines
Mark
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 64 lines · Daniel Kurtz
Quoted 57 lines · Mark yao
Quoted 53 lines · Daniel Vetter
Quoted 38 lines · Mark yao
Quoted 37 lines · Daniel Kurtz
Hi Mark, Heiko,
Quoted 24 lines · Mark Yao
Vop standby will take effect end of current frame, if
dsp_hold_valid_irqhappen, it means vop standby complete.we must wait standby complete when we want to disable aclk, if not, memory bus maybe dead.
Signed-off-by Mark Yao <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-0@@ -89,6 +89,7 @@ struct vop {/* mutex vsync_ work */ struct mutex vsync_mutex;bool vsync_work_pending; +struct completion dsp_hold_completion;const struct vop_data *data;drivers/gpu/drm/rockchip/rockchip_drm_vop.c static bool is_alpha_support(uint32_t format) · line 390
Quoted 8 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5
-0@@ -382,6 +383,34 @@ static bool is_alpha_support(uint32_t format) } } +static void vop_dsp_hold_valid_irq_enable (struct vop *vop) +{ +unsigned long flags; + +BUG_ON (!vop->is_enabled);Re: Heiko "use a
WARN_ON":Quoted 5 lines
Quoted 3 lines
If the VOP clock is off, then the system will just hang when trying to write the VOP register so in this case,
BUG_ONgives a more reliable crash dump than the hang.In this way, you are right, if vop clocks is disabled, write vop register
will hang system, and theWARN_ONif (
WARN_ON(cond))return;is what we commonly use in i915. Because it's really not any good to use
BUG_ONin drm drivers, at least if you expect anyone to use fbcon on top of it (i.e. anything even remotely resembling a normal distro): Then the intial modeset is all done underconsole_lock, which means that _none_ of yourBUG_ONwill ever get out over serial console.Quoted 3 lines
The problem is fbcon locking, but no fool yet signed up to fix it (it's horrible, I looked ...).
-DanielQuoted 6 lines
I know this problem, if fbcon locking, and
BUG_ON, we can't get any log from serial console, Trouble me many times. So know, if no drm log output, the first thing I do is remove the fbcon lock, and then we can see the crash dump.But here, I expect to use
BUG_ON, because if BUG happen, vop register will hang system, andWARN_ONmay be have no chance to output.
Quoted 8 lines
Yeah, but danvet is suggesting we just return immediately on the
WARN_ONcondition, to avoid accessing the vop registers and hanging.Thus, the
WARN_ONwill have a chance to put out (unless the early return path goes off and finds some other unprotected path goes to access unlocked registers).-Dan
All right, I got it.
Quoted 4 lines
Quoted 2 lines
Mark
Signature · 23 lines
Mark Yao 姚智情 Rockchip 福州瑞芯微电子有限公司 Fuzhou Headquarters Addr:No.21 Building, A District, Fuzhou Software Park, 89 Soft Avenue, Tongpan Road, Gulou District, Fuzhou (350003) 地址:福建省福州市铜盘路软件大道89号软件园A区21号楼 (350003) Tel:(86-0591)83991906 - 8296 E-mail:[email protected] _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel