[v2,4/6] drm/msm: Issue queued events when disabling crtc

Submitted by Sean Paul on March 28, 2018, 7:06 p.m.

Details

Message ID 20180328190657.218661-5-seanpaul@chromium.org
State New
Headers show
Series "drm/msm: Switch to atomic helpers" ( rev: 2 ) in DRI devel

Not browsing as part of any series.

Commit Message

Sean Paul March 28, 2018, 7:06 p.m.
Ensure that any queued events are issued when disabling the crtc. This
avoids timeouts when we come back and wait for dependencies (like the
previous frame's flip_done).

Changes in v2:
- None

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 76b96081916f..10271359789e 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -430,6 +430,7 @@  static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 	struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
 	struct mdp5_kms *mdp5_kms = get_kms(crtc);
 	struct device *dev = &mdp5_kms->pdev->dev;
+	unsigned long flags;
 
 	DBG("%s", crtc->name);
 
@@ -445,6 +446,14 @@  static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 	mdp_irq_unregister(&mdp5_kms->base, &mdp5_crtc->err);
 	pm_runtime_put_sync(dev);
 
+	if (crtc->state->event && !crtc->state->active) {
+		WARN_ON(mdp5_crtc->event);
+		spin_lock_irqsave(&mdp5_kms->dev->event_lock, flags);
+		drm_crtc_send_vblank_event(crtc, crtc->state->event);
+		crtc->state->event = NULL;
+		spin_unlock_irqrestore(&mdp5_kms->dev->event_lock, flags);
+	}
+
 	mdp5_crtc->enabled = false;
 }
 

Comments

On Thursday 29 March 2018 12:36 AM, Sean Paul wrote:
> Ensure that any queued events are issued when disabling the crtc. This
> avoids timeouts when we come back and wait for dependencies (like the
> previous frame's flip_done).

Reviewed-by: Archit Taneja <architt@codeaurora.org>

> 
> Changes in v2:
> - None
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> index 76b96081916f..10271359789e 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> @@ -430,6 +430,7 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
>   	struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
>   	struct mdp5_kms *mdp5_kms = get_kms(crtc);
>   	struct device *dev = &mdp5_kms->pdev->dev;
> +	unsigned long flags;
>   
>   	DBG("%s", crtc->name);
>   
> @@ -445,6 +446,14 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
>   	mdp_irq_unregister(&mdp5_kms->base, &mdp5_crtc->err);
>   	pm_runtime_put_sync(dev);
>   
> +	if (crtc->state->event && !crtc->state->active) {
> +		WARN_ON(mdp5_crtc->event);
> +		spin_lock_irqsave(&mdp5_kms->dev->event_lock, flags);
> +		drm_crtc_send_vblank_event(crtc, crtc->state->event);
> +		crtc->state->event = NULL;
> +		spin_unlock_irqrestore(&mdp5_kms->dev->event_lock, flags);
> +	}
> +
>   	mdp5_crtc->enabled = false;
>   }
>   
>