diff mbox series

[4/4] drm/msm: dpu: Don't queue the frame_done watchdog for cursor

Message ID 20190128204306.95076-4-sean@poorly.run (mailing list archive)
State Not Applicable, archived
Headers show
Series [1/4] drm/msm: Use drm_mode_vrefresh instead of mode->vrefresh | expand

Commit Message

Sean Paul Jan. 28, 2019, 8:42 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

In the case of an async/cursor update, we don't wait for the frame_done
event, which means handle_frame_done is never called, and the frame_done
watchdog isn't canceled. Currently, this results in a frame_done timeout
every time the cursor moves without a synchronous frame following it up
before the timeout expires. Since we don't wait for frame_done, and
don't handle it, we shouldn't modify the watchdog.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Comments

Fritz Koenig Feb. 5, 2019, 8:13 p.m. UTC | #1
On Mon, Jan 28, 2019 at 12:43 PM Sean Paul <sean@poorly.run> wrote:
>
> From: Sean Paul <seanpaul@chromium.org>
>
> In the case of an async/cursor update, we don't wait for the frame_done
> event, which means handle_frame_done is never called, and the frame_done
> watchdog isn't canceled. Currently, this results in a frame_done timeout
> every time the cursor moves without a synchronous frame following it up
> before the timeout expires. Since we don't wait for frame_done, and
> don't handle it, we shouldn't modify the watchdog.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 51e46b206c73e..05145cf9fb408 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -1794,7 +1794,6 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async)
>  {
>         struct dpu_encoder_virt *dpu_enc;
>         struct dpu_encoder_phys *phys;
> -       unsigned long timeout_ms;
>         ktime_t wakeup_time;
>         unsigned int i;
>
> @@ -1807,12 +1806,20 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async)
>
>         trace_dpu_enc_kickoff(DRMID(drm_enc));
>
> -       timeout_ms = DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES * 1000 /
> -               drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);
> +       /*
> +        * Asynchronous frames don't handle FRAME_DONE events. As such, they
> +        * shouldn't enable the frame_done watchdog since it will always time
> +        * out.
> +        */
> +       if (!async) {
> +               unsigned long timeout_ms;
> +               timeout_ms = DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES * 1000 /
> +                       drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);
>
> -       atomic_set(&dpu_enc->frame_done_timeout_ms, timeout_ms);
> -       mod_timer(&dpu_enc->frame_done_timer,
> -                 jiffies + msecs_to_jiffies(timeout_ms));
> +               atomic_set(&dpu_enc->frame_done_timeout_ms, timeout_ms);
> +               mod_timer(&dpu_enc->frame_done_timer,
> +                         jiffies + msecs_to_jiffies(timeout_ms));
> +       }
>
>         /* All phys encs are ready to go, trigger the kickoff */
>         _dpu_encoder_kickoff_phys(dpu_enc, async);
> --
> Sean Paul, Software Engineer, Google / Chromium OS
>

Reviewed-by: Fritz Koenig <frkoenig@google.com>

> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jeykumar Sankaran Feb. 6, 2019, 7:53 p.m. UTC | #2
On 2019-01-28 12:42, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> In the case of an async/cursor update, we don't wait for the frame_done
> event, which means handle_frame_done is never called, and the 
> frame_done
> watchdog isn't canceled. Currently, this results in a frame_done 
> timeout
> every time the cursor moves without a synchronous frame following it up
> before the timeout expires. Since we don't wait for frame_done, and
> don't handle it, we shouldn't modify the watchdog.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>

>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 51e46b206c73e..05145cf9fb408 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -1794,7 +1794,6 @@ void dpu_encoder_kickoff(struct drm_encoder 
> *drm_enc,
> bool async)
>  {
>  	struct dpu_encoder_virt *dpu_enc;
>  	struct dpu_encoder_phys *phys;
> -	unsigned long timeout_ms;
>  	ktime_t wakeup_time;
>  	unsigned int i;
> 
> @@ -1807,12 +1806,20 @@ void dpu_encoder_kickoff(struct drm_encoder
> *drm_enc, bool async)
> 
>  	trace_dpu_enc_kickoff(DRMID(drm_enc));
> 
> -	timeout_ms = DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES * 1000 /
> -		drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);
> +	/*
> +	 * Asynchronous frames don't handle FRAME_DONE events. As such, they
> +	 * shouldn't enable the frame_done watchdog since it will always time
> +	 * out.
> +	 */
> +	if (!async) {
> +		unsigned long timeout_ms;
> +		timeout_ms = DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES * 1000 /
> +			drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);
> 
> -	atomic_set(&dpu_enc->frame_done_timeout_ms, timeout_ms);
> -	mod_timer(&dpu_enc->frame_done_timer,
> -		  jiffies + msecs_to_jiffies(timeout_ms));
> +		atomic_set(&dpu_enc->frame_done_timeout_ms, timeout_ms);
> +		mod_timer(&dpu_enc->frame_done_timer,
> +			  jiffies + msecs_to_jiffies(timeout_ms));
> +	}
> 
>  	/* All phys encs are ready to go, trigger the kickoff */
>  	_dpu_encoder_kickoff_phys(dpu_enc, async);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 51e46b206c73e..05145cf9fb408 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -1794,7 +1794,6 @@  void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async)
 {
 	struct dpu_encoder_virt *dpu_enc;
 	struct dpu_encoder_phys *phys;
-	unsigned long timeout_ms;
 	ktime_t wakeup_time;
 	unsigned int i;
 
@@ -1807,12 +1806,20 @@  void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async)
 
 	trace_dpu_enc_kickoff(DRMID(drm_enc));
 
-	timeout_ms = DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES * 1000 /
-		drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);
+	/*
+	 * Asynchronous frames don't handle FRAME_DONE events. As such, they
+	 * shouldn't enable the frame_done watchdog since it will always time
+	 * out.
+	 */
+	if (!async) {
+		unsigned long timeout_ms;
+		timeout_ms = DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES * 1000 /
+			drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);
 
-	atomic_set(&dpu_enc->frame_done_timeout_ms, timeout_ms);
-	mod_timer(&dpu_enc->frame_done_timer,
-		  jiffies + msecs_to_jiffies(timeout_ms));
+		atomic_set(&dpu_enc->frame_done_timeout_ms, timeout_ms);
+		mod_timer(&dpu_enc->frame_done_timer,
+			  jiffies + msecs_to_jiffies(timeout_ms));
+	}
 
 	/* All phys encs are ready to go, trigger the kickoff */
 	_dpu_encoder_kickoff_phys(dpu_enc, async);