drm/i915: Grab the vblank evasion lock around the entire evasion.
Subsystems (2)
cover drm/i915: Grab the vblank evasion lock around the entire evasion.
Some cleanups to move the uncore.lock around vblank evasion, so run to completion without racing on uncore.lock. Hopefully this will reduce the chance of underruns, and perhaps allows us to decrease VBLANK_EVASION_TIME_US as well as a followup patch.
Tested on KBL and BSW.
Maarten Lankhorst (5):
drm/i915: Keep vblank irq enabled during vblank evasion. drm/i915: Grab uncore.lock around enabling vblank evasion drm/i915: Call i915_pipe_update_start with uncore.lock held. drm/i915: Move all locking for plane updates to caller drm/i915: Use DOUBLE_BUFFER_CTL on top of vblank evasion for GEN9+.
drivers/gpu/drm/i915/i915_irq.c | 68 ++++++++++++++++++++++++------ drivers/gpu/drm/i915/i915_reg.h | 3 ++ drivers/gpu/drm/i915/i915_trace.h | 20 ++++----- drivers/gpu/drm/i915/intel_display.c | 74 +++++++++++++------------------- drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_pm.c | 16 +++---- drivers/gpu/drm/i915/intel_sprite.c | 81 ++++++++++-------------------------- 7 files changed, 128 insertions(+), 136 deletions(-)
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 drm/i915: Keep vblank irq enabled during vblank evasion.
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the event.
--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_sprite.c +4 -7
@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ; crtc->debug.min_vbl = min;
@@ -146,8 +146,6 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)finish_wait (wq, &wait); -drm_crtc_vblank_put (&crtc->base); -/* * On VLV/CHV DSI the scanline counter would appear to * increment approx. 1/3 of a scanline before start of vblank.
@@ -197,14 +195,13 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)* event outside of the critical section - the spinlock might spin for a * while ... */ if (new_crtc_state->base.event) { -WARN_ON (drm_crtc_vblank_get (&crtc->base) !=0 ); -spin_lock (&crtc->base.dev->event_lock);drm_crtc_arm_vblank_event (&crtc->base, new_crtc_state->base.event);spin_unlock (&crtc->base.dev->event_lock); new_crtc_state->base.event =NULL ; - } + }else +drm_crtc_vblank_put (&crtc->base);local_irq_enable ();
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the event.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;
The corresponding vblank_put is the one later in update_start(), right? I don't think you intended to keep this chunk.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 22 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 21 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ;
Quoted 7 lines
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1-if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-Chris
I'm not sure what you mean? The vblank_put is now in pipe_update_end, except if the event takes over the reference. I think the code is correct. :)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 31 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 22 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 21 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ;Quoted 7 lines
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1-if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-Chris
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)
Then it's unbalanced in the case of error still.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-Chris
Quoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-Chris
It already would have been for events, hence the WARN_ON there. I don't think we can do anything about it, this shouldn't ever happen in practice, could be a BUG_ON for all I care. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 32 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-Chris
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Op 12-02-18 om 16:31 schreef Chris Wilson:
Quoted 40 lines
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 32 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-ChrisQuoted 7 lines
Quoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)
Quoted 6 lines
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
I'm not sure why we get a reference to the vblank counter here. Perhaps Ville does?
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoted 41 lines · Maarten Lankhorst
Op 12-02-18 om 16:31 schreef Chris Wilson:
Quoted 40 lines
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 39 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-ChrisQuoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)
Quoted 7 lines
Quoted 6 lines
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
I'm not sure why we get a reference to the vblank counter here. Perhaps Ville does?
We need the vblank irq to be enabled before we check the scanline since otherwise we may end up doing:
1. check scanline
3. vblank irq fires
2. enable vblank irq
3. wait for the next vblank
So we'd end up wasting an entire frame.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoting Ville Syrjälä (2018-02-12 16:55:28)
Quoted 53 lines · Maarten Lankhorst
Quoted 41 lines
Op 12-02-18 om 16:31 schreef Chris Wilson:
Quoted 40 lines
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 39 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-ChrisQuoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)Quoted 7 lines
Quoted 6 lines
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
I'm not sure why we get a reference to the vblank counter here. Perhaps Ville does?
We need the vblank irq to be enabled before we check the scanline since otherwise we may end up doing:
Quoted 6 lines
1. check scanline
3. vblank irq fires
2. enable vblank irq
3. wait for the next vblankSo we'd end up wasting an entire frame.
Step: 2.5, check_scanline?
Something like,
drivers/gpu/drm/i915/intel_sprite.c +6 -5
@@ -97,6 +97,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) &&intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +bool have_vblank_irq = false; vblank_start = adjusted_mode->crtc_vblank_start;if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE )
@@ -112,9 +113,6 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)if (min <=0 || max <=0 )return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) -return ; - crtc->debug.min_vbl = min; crtc->debug.max_vbl = max;trace_i915_pipe_update_start (crtc);
@@ -127,6 +125,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)*/ prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); +if (!have_vblank_irq) + have_vblank_irq = !drm_crtc_vblank_get (&crtc->base); + scanline =intel_get_crtc_scanline (crtc);if (scanline < min || scanline > max)break ;
@@ -145,8 +147,8 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) }finish_wait (wq, &wait); - -drm_crtc_vblank_put (&crtc->base); +if (have_vblank_irq) +drm_crtc_vblank_put (&crtc->base);/* * On VLV/CHV DSI the scanline counter would appear to
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoted 88 lines · Chris Wilson
Quoting Ville Syrjälä (2018-02-12 16:55:28)
Quoted 53 lines · Maarten Lankhorst
Quoted 41 lines
Op 12-02-18 om 16:31 schreef Chris Wilson:
Quoted 40 lines
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 39 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-ChrisQuoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)Quoted 7 lines
Quoted 6 lines
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
I'm not sure why we get a reference to the vblank counter here. Perhaps Ville does?
We need the vblank irq to be enabled before we check the scanline since otherwise we may end up doing:
Quoted 6 lines
1. check scanline
3. vblank irq fires
2. enable vblank irq
3. wait for the next vblankSo we'd end up wasting an entire frame.
Step: 2.5,
check_scanline?Something like,
drivers/gpu/drm/i915/intel_sprite.c +1
-3@@ -97,6 +97,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) &&intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +bool have_vblank_irq = false; vblank_start = adjusted_mode->crtc_vblank_start;if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE )@@ -112,9 +113,6 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)if (min <=0 || max <=0 )return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) -return ; - crtc->debug.min_vbl = min; crtc->debug.max_vbl = max;trace_i915_pipe_update_start (crtc);
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 130
Quoted 6 lines
drivers/gpu/drm/i915/intel_sprite.c +3
-0@@ -127,6 +125,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)*/ prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); +if (!have_vblank_irq) + have_vblank_irq = !drm_crtc_vblank_get (&crtc->base); +
This doesn't seem to change anything.
Did you mean something like this perhaps?
for (;;) {
prepare_to_wait();
if (scanline ok)
break;
if (!have_vbl_irq) {
have_vbl_irq = !vbl_get();
/*
* Check the scanline again to make sure
* we didn't just miss the vblank interrupt.
*/
continue;
}
local_irq_enable();
schedule_timeout();
local_irq_disable();
}I guess something like that might work. Though if we're actually worried about the vbl_get() failing, we'll need another flag besides have_vbl_irq to avoid the inifinite loop.
Quoted 14 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2scanline =intel_get_crtc_scanline (crtc);if (scanline < min || scanline > max)break ;@@ -145,8 +147,8 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) }finish_wait (wq, &wait); - -drm_crtc_vblank_put (&crtc->base); +if (have_vblank_irq) +drm_crtc_vblank_put (&crtc->base);/* * On VLV/CHV DSI the scanline counter would appear to
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Quoting Ville Syrjälä (2018-02-12 18:06:58)
Quoted 92 lines · Chris Wilson
Quoted 91 lines
Quoting Ville Syrjälä (2018-02-12 16:55:28)
Quoted 53 lines · Maarten Lankhorst
Quoted 41 lines
Op 12-02-18 om 16:31 schreef Chris Wilson:
Quoted 40 lines
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 39 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-ChrisQuoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)Quoted 7 lines
Quoted 6 lines
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
I'm not sure why we get a reference to the vblank counter here. Perhaps Ville does?
We need the vblank irq to be enabled before we check the scanline since otherwise we may end up doing:
Quoted 6 lines
1. check scanline
3. vblank irq fires
2. enable vblank irq
3. wait for the next vblankSo we'd end up wasting an entire frame.
Step: 2.5,
check_scanline?Something like,
drivers/gpu/drm/i915/intel_sprite.c +1
-3@@ -97,6 +97,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) &&intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +bool have_vblank_irq = false; vblank_start = adjusted_mode->crtc_vblank_start;if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE )@@ -112,9 +113,6 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)if (min <=0 || max <=0 )return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) -return ; - crtc->debug.min_vbl = min; crtc->debug.max_vbl = max;trace_i915_pipe_update_start (crtc);@@ -127,6 +125,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)*/ prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE );
Quoted 5 lines
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 130
Quoted 3 lines
drivers/gpu/drm/i915/intel_sprite.c +3
-0+if (!have_vblank_irq) + have_vblank_irq = !drm_crtc_vblank_get (&crtc->base); +This doesn't seem to change anything.
Nothing wrt to the existing code :)
The idea is that we have to enable the vblank-irq before doing the scanline check in order to not miss the interrupt, which as I understand it was the danger you highlighted with trying to avoid taking the vblank-irq.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Keep vblank irq enabled during vblank evasion.
Op 12-02-18 om 21:55 schreef Chris Wilson:
Quoted 95 lines
Quoting Ville Syrjälä (2018-02-12 18:06:58)
Quoted 90 lines · Chris Wilson
Quoted 89 lines
Quoting Ville Syrjälä (2018-02-12 16:55:28)
Quoted 52 lines · Maarten Lankhorst
Quoted 41 lines
Op 12-02-18 om 16:31 schreef Chris Wilson:
Quoted 40 lines
Quoting Maarten Lankhorst (2018-02-12 15:27:34)
Quoted 39 lines
Op 12-02-18 om 16:22 schreef Chris Wilson:
Quoted 31 lines
Quoting Maarten Lankhorst (2018-02-12 15:16:39)
Quoted 30 lines
Op 12-02-18 om 16:10 schreef Chris Wilson:
Quoted 29 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:00)
Quoted 15 lines
This is a nice preparation for grabbing the uncore lock during evasion. Grabbing the spinlock with the lock held messes up the locking, so it's easier to handover the reference to the eve
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -109,10 +109,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 117
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2local_irq_disable (); -if (min <=0 || max <=0 ) +if (WARN_ON (drm_crtc_vblank_get (&crtc->base)))return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) +if (min <=0 || max <=0 )return ;The corresponding
vblank_putis the one later inupdate_start(), right? I don't think you intended to keep this chunk.
-ChrisQuoted 4 lines
Quoted 2 lines
I'm not sure what you mean? The
vblank_putis now inpipe_update_end, except if the event takes over the reference. I think the code is correct. :)Then it's unbalanced in the case of error still.
-ChrisIt already would have been for events, hence the
WARN_ONthere. I don't think we can do anything about it, this shouldn't ever happen in practice, could be aBUG_ONfor all I care. :)Quoted 7 lines
Quoted 6 lines
I would much prefer that over intentionally bad code.
But do we really need to enable the vblank irq here? If the event requires it, doesn't it already enable the vblank. Here, we only need it when sleeping, can we not determine we have enough time before the vblank without enabling the interrupt?
I'm not sure why we get a reference to the vblank counter here. Perhaps Ville does?
We need the vblank irq to be enabled before we check the scanline since otherwise we may end up doing:
Quoted 6 lines
1. check scanline
3. vblank irq fires
2. enable vblank irq
3. wait for the next vblankSo we'd end up wasting an entire frame.
Step: 2.5,
check_scanline?Something like,
drivers/gpu/drm/i915/intel_sprite.c +1
-3@@ -97,6 +97,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) &&intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +bool have_vblank_irq = false; vblank_start = adjusted_mode->crtc_vblank_start;if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE )@@ -112,9 +113,6 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)if (min <=0 || max <=0 )return ; -if (WARN_ON (drm_crtc_vblank_get (&crtc->base))) -return ; - crtc->debug.min_vbl = min; crtc->debug.max_vbl = max;trace_i915_pipe_update_start (crtc);@@ -127,6 +125,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)*/ prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE );Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 130
Quoted 3 lines
drivers/gpu/drm/i915/intel_sprite.c +3
-0+if (!have_vblank_irq) + have_vblank_irq = !drm_crtc_vblank_get (&crtc->base); +This doesn't seem to change anything.
Quoted 7 lines
Nothing wrt to the existing code :)
The idea is that we have to enable the vblank-irq before doing the scanline check in order to not miss the interrupt, which as I understand it was the danger you highlighted with trying to avoid taking the vblank-irq.
-Chris
I've taken a look at the code, and most of the time we set crtc_state->event. Either through calls like pageflip, or if not set we always allocate one in drm_atomic_helper_setup_commit() except for legacy cursor updates.
Because of this I think the original patch is fine, and I kind of like having everything prepared in pipe_update_start, while pipe_update_end only has to release it.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: Grab uncore.lock around enabling vblank evasion
In reply to Maarten Lankhorst--- drivers/gpu/drm/i915/i915_irq.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -845,7 +845,7 @@ static u32 __intel_get_crtc_scanline_from_timestamp(struct intel_crtc *crtc) }/* I915_READ_FW, only for fast reads of display block, no need for forcewake etc. */ -static int __intel_get_crtc_scanline (struct intel_crtc *crtc) +int __intel_get_crtc_scanline (struct intel_crtc *crtc) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1340,6 +1340,7 @@ static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv) }int intel_get_crtc_scanline (struct intel_crtc *crtc); +int __intel_get_crtc_scanline (struct intel_crtc *crtc);void gen8_irq_power_well_post_enable (struct drm_i915_private *dev_priv,u8 pipe_mask); void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_sprite.c +6 -4
@@ -119,6 +119,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) crtc->debug.max_vbl = max;trace_i915_pipe_update_start (crtc); +spin_lock (&dev_priv->uncore.lock);for (;;) {/* * prepare_to_wait() has a memory barrier, which guarantees
@@ -127,7 +128,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)*/ prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); - scanline =intel_get_crtc_scanline (crtc); + scanline =__intel_get_crtc_scanline (crtc);if (scanline < min || scanline > max)break ;
@@ -137,11 +138,11 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)break ; } -local_irq_enable (); +spin_unlock_irq (&dev_priv->uncore.lock); timeout =schedule_timeout (timeout); -local_irq_disable (); +spin_lock_irq (&dev_priv->uncore.lock); }finish_wait (wq, &wait);
@@ -162,8 +163,9 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)* FIXME figure out if BXT+ DSI suffers from this as well */ while (need_vlv_dsi_wa && scanline == vblank_start) - scanline =intel_get_crtc_scanline (crtc); + scanline =__intel_get_crtc_scanline (crtc); +spin_unlock (&dev_priv->uncore.lock); crtc->debug.scanline_start = scanline; crtc->debug.start_vbl_time =ktime_get (); crtc->debug.start_vbl_count =intel_crtc_get_vblank_counter (crtc);
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/5] drm/i915: Grab uncore.lock around enabling vblank evasion
Quoting Maarten Lankhorst (2018-02-09 09:54:01)
Quoted 57 lines
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_irq.c +1
-1@@ -845,7 +845,7 @@ static u32 __intel_get_crtc_scanline_from_timestamp(struct intel_crtc *crtc) }/* I915_READ_FW, only for fast reads of display block, no need for forcewake etc. */ -static int __intel_get_crtc_scanline (struct intel_crtc *crtc) +int __intel_get_crtc_scanline (struct intel_crtc *crtc) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev);drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1340,6 +1340,7 @@ static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv) }int intel_get_crtc_scanline (struct intel_crtc *crtc); +int __intel_get_crtc_scanline (struct intel_crtc *crtc);void gen8_irq_power_well_post_enable (struct drm_i915_private *dev_priv,u8 pipe_mask); void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,drivers/gpu/drm/i915/intel_sprite.c +2
-1@@ -119,6 +119,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) crtc->debug.max_vbl = max;trace_i915_pipe_update_start (crtc); +spin_lock (&dev_priv->uncore.lock);for (;;) {/* * prepare_to_wait() has a memory barrier, which guarantees @@ -127,7 +128,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)*/ prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); - scanline =intel_get_crtc_scanline (crtc); + scanline =__intel_get_crtc_scanline (crtc);if (scanline < min || scanline > max)break ;@@ -137,11 +138,11 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)break ; }
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 148
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2-local_irq_enable (); +spin_unlock_irq (&dev_priv->uncore.lock); timeout =schedule_timeout (timeout); -local_irq_disable (); +spin_lock_irq (&dev_priv->uncore.lock); }finish_wait (wq, &wait);
There's no danger that drm_crtc_vblank_put() does something crazy here. (Feels like a layering violation to call into DRM with the low level uncore.lock held at least.) It looks like the driver can be tricked into called ->disable_vblank()?
Overall though, I think it is just this need_vlv_dsi_wa chunk that has any benefit here (although trading lock_irq for lock_irqsave is enough to justify a change if frequently hit).
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915: Call i915_pipe_update_start with uncore.lock held.
In reply to Maarten LankhorstThis requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +55 -11
@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */ -static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode; htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;
@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure
@@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;
@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ; } +static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +return I915_READ_FW (PIPE_FRMCOUNT_G4X (crtc->pipe)); +} +static u32 g4x_get_vblank_counter (struct drm_device *dev,unsigned int pipe) {struct drm_i915_private *dev_priv =to_i915 (dev); +struct intel_crtc *crtc =intel_get_crtc_for_pipe (dev_priv, pipe); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =__g4x_get_vblank_counter (crtc); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +u32 __intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +if (IS_G4X (dev_priv) ||INTEL_GEN (dev_priv) >=5 ) +return __g4x_get_vblank_counter (crtc); +else if (IS_GEN2 (dev_priv)) +return 0 ; +else +return __i915_get_vblank_counter (crtc); +} + +u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_device *dev = crtc->base.dev; + +if (!dev->max_vblank_count) +return drm_crtc_accurate_vblank_count (&crtc->base); -return I915_READ (PIPE_FRMCOUNT_G4X (pipe)); +return dev->driver->get_vblank_counter (dev, crtc->pipe); }/*
drivers/gpu/drm/i915/i915_trace.h +2 -3
@@ -280,9 +280,8 @@ TRACE_EVENT(i915_pipe_update_start,TP_fast_assign ( __entry->pipe = crtc->pipe; - __entry->frame = crtc->base.dev->driver->get_vblank_counter (crtc->base.dev, - crtc->pipe); - __entry->scanline =intel_get_crtc_scanline (crtc); + __entry->frame =__intel_crtc_get_vblank_counter (crtc); + __entry->scanline =__intel_get_crtc_scanline (crtc); __entry->min = crtc->debug.min_vbl; __entry->max = crtc->debug.max_vbl; ),
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1489,6 +1489,7 @@ intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, int pipe) }u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc); +u32 __intel_crtc_get_vblank_counter (struct intel_crtc *crtc);int ironlake_get_lanes_required (int target_clock,int link_bw,int bpp); void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_sprite.c +2 -1
@@ -117,9 +117,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) crtc->debug.min_vbl = min; crtc->debug.max_vbl = max; -trace_i915_pipe_update_start (crtc);spin_lock (&dev_priv->uncore.lock); +trace_i915_pipe_update_start (crtc); +for (;;) {/* * prepare_to_wait() has a memory barrier, which guarantees
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
Quoted 58 lines · Maarten Lankhorst
This requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_irq.c +5
-10@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */ -static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode; htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure @@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ;
drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 791
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +8
-0} +static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe);
Shouldn't this be __i915_get_vblank_counter ?
Quoted 101 lines
drivers/gpu/drm/i915/i915_irq.c +42
-1+spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +return I915_READ_FW (PIPE_FRMCOUNT_G4X (crtc->pipe)); +} +static u32 g4x_get_vblank_counter (struct drm_device *dev,unsigned int pipe) {struct drm_i915_private *dev_priv =to_i915 (dev); +struct intel_crtc *crtc =intel_get_crtc_for_pipe (dev_priv, pipe); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =__g4x_get_vblank_counter (crtc); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +u32 __intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +if (IS_G4X (dev_priv) ||INTEL_GEN (dev_priv) >=5 ) +return __g4x_get_vblank_counter (crtc); +else if (IS_GEN2 (dev_priv)) +return 0 ; +else +return __i915_get_vblank_counter (crtc); +} + +u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_device *dev = crtc->base.dev; + +if (!dev->max_vblank_count) +return drm_crtc_accurate_vblank_count (&crtc->base); -return I915_READ (PIPE_FRMCOUNT_G4X (pipe)); +return dev->driver->get_vblank_counter (dev, crtc->pipe); }/* drivers/gpu/drm/i915/i915_trace.h +2
-3@@ -280,9 +280,8 @@ TRACE_EVENT(i915_pipe_update_start,TP_fast_assign ( __entry->pipe = crtc->pipe; - __entry->frame = crtc->base.dev->driver->get_vblank_counter (crtc->base.dev, - crtc->pipe); - __entry->scanline =intel_get_crtc_scanline (crtc); + __entry->frame =__intel_crtc_get_vblank_counter (crtc); + __entry->scanline =__intel_get_crtc_scanline (crtc); __entry->min = crtc->debug.min_vbl; __entry->max = crtc->debug.max_vbl; ),drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1489,6 +1489,7 @@ intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, int pipe) }u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc); +u32 __intel_crtc_get_vblank_counter (struct intel_crtc *crtc);int ironlake_get_lanes_required (int target_clock,int link_bw,int bpp); void vlv_wait_port_ready(struct drm_i915_private *dev_priv,drivers/gpu/drm/i915/intel_sprite.c +2
-1@@ -117,9 +117,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) crtc->debug.min_vbl = min; crtc->debug.max_vbl = max; -trace_i915_pipe_update_start (crtc);spin_lock (&dev_priv->uncore.lock); +trace_i915_pipe_update_start (crtc); +for (;;) {/* * prepare_to_wait() has a memory barrier, which guarantees Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
Op 10-02-18 om 00:08 schreef James Ausmus:
Quoted 61 lines · Maarten Lankhorst
Quoted 60 lines
This requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_irq.c +5
-10@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */ -static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode; htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure @@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ; }
Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 791
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +8
-0+static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe);Shouldn't this be
__i915_get_vblank_counter?
Good catch, it shouldn't have passed BAT. I guess we don't have a g4 or gen3 system there.
~Maarten
Quoted 98 lines
Quoted 98 lines
drivers/gpu/drm/i915/i915_irq.c +42
-1+spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +return I915_READ_FW (PIPE_FRMCOUNT_G4X (crtc->pipe)); +} +static u32 g4x_get_vblank_counter (struct drm_device *dev,unsigned int pipe) {struct drm_i915_private *dev_priv =to_i915 (dev); +struct intel_crtc *crtc =intel_get_crtc_for_pipe (dev_priv, pipe); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =__g4x_get_vblank_counter (crtc); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +u32 __intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +if (IS_G4X (dev_priv) ||INTEL_GEN (dev_priv) >=5 ) +return __g4x_get_vblank_counter (crtc); +else if (IS_GEN2 (dev_priv)) +return 0 ; +else +return __i915_get_vblank_counter (crtc); +} + +u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_device *dev = crtc->base.dev; + +if (!dev->max_vblank_count) +return drm_crtc_accurate_vblank_count (&crtc->base); -return I915_READ (PIPE_FRMCOUNT_G4X (pipe)); +return dev->driver->get_vblank_counter (dev, crtc->pipe); }/* drivers/gpu/drm/i915/i915_trace.h +2
-3@@ -280,9 +280,8 @@ TRACE_EVENT(i915_pipe_update_start,TP_fast_assign ( __entry->pipe = crtc->pipe; - __entry->frame = crtc->base.dev->driver->get_vblank_counter (crtc->base.dev, - crtc->pipe); - __entry->scanline =intel_get_crtc_scanline (crtc); + __entry->frame =__intel_crtc_get_vblank_counter (crtc); + __entry->scanline =__intel_get_crtc_scanline (crtc); __entry->min = crtc->debug.min_vbl; __entry->max = crtc->debug.max_vbl; ),drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1489,6 +1489,7 @@ intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, int pipe) }u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc); +u32 __intel_crtc_get_vblank_counter (struct intel_crtc *crtc);int ironlake_get_lanes_required (int target_clock,int link_bw,int bpp); void vlv_wait_port_ready(struct drm_i915_private *dev_priv,drivers/gpu/drm/i915/intel_sprite.c +2
-1@@ -117,9 +117,10 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) crtc->debug.min_vbl = min; crtc->debug.max_vbl = max; -trace_i915_pipe_update_start (crtc);spin_lock (&dev_priv->uncore.lock); +trace_i915_pipe_update_start (crtc); +for (;;) {/* * prepare_to_wait() has a memory barrier, which guarantees Signature · 1 line
2.16.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
Quoting Maarten Lankhorst (2018-02-10 08:46:14)
Quoted 11 lines
Op 10-02-18 om 00:08 schreef James Ausmus:
Quoted 10 lines · Maarten Lankhorst
drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 791
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +8
-0+static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe);Shouldn't this be
__i915_get_vblank_counter?
Quoted 1 line
Good catch, it shouldn't have passed BAT. I guess we don't have a g4 or gen3 system there.
You killed them!
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
In reply to Maarten LankhorstQuoting Maarten Lankhorst (2018-02-09 09:54:02)
Quoted 21 lines
This requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */
drivers/gpu/drm/i915/i915_irq.c static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv) · line 744
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +3
-4-static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode;
lockdep_assert_held(&dev_priv->uncore.lock);
Quoted 35 lines
drivers/gpu/drm/i915/i915_irq.c +8
-6htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure @@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ; } +static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; +
drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 799
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10
-0+spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
lockdep_assert_held(&dev_priv->uncore.lock); ?
Ok, why do we need uncore.lock held here at all? Serialisation of mmio access to the same cacheline is the age old reason, can we guarantee that doesn't happen anyway? (Probably not, but really most callers do not need the mmio w/a.)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
Op 12-02-18 om 16:19 schreef Chris Wilson:
Quoted 81 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:02)
Quoted 21 lines
This requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */ drivers/gpu/drm/i915/i915_irq.c static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv) · line 744
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +3
-4-static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode;
lockdep_assert_held(&dev_priv->uncore.lock);Quoted 35 lines
drivers/gpu/drm/i915/i915_irq.c +8
-6htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure @@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ; } +static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; +drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 799
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10
-0+spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
lockdep_assert_held(&dev_priv->uncore.lock); ?
Quoted 4 lines
Ok, why do we need uncore.lock held here at all? Serialisation of mmio access to the same cacheline is the age old reason, can we guarantee that doesn't happen anyway? (Probably not, but really most callers do not need the mmio w/a.)
Is the serialization only needed for writing?
The only thing that can race with nonblocking atomic commits are legacy cursor updates, but those can only happen if the cursor plane are not part of the previous atomic commit. Those are also protected by plane->mutex, so in theory same cache lines on the same pipes probably can't race..
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
Quoting Maarten Lankhorst (2018-02-12 15:39:16)
Quoted 82 lines
Op 12-02-18 om 16:19 schreef Chris Wilson:
Quoted 81 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:02)
Quoted 21 lines
This requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */ drivers/gpu/drm/i915/i915_irq.c static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv) · line 744
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +3
-4-static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode;
lockdep_assert_held(&dev_priv->uncore.lock);Quoted 35 lines
drivers/gpu/drm/i915/i915_irq.c +8
-6htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure @@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ; } +static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; +drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 799
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10
-0+spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
lockdep_assert_held(&dev_priv->uncore.lock); ?
Quoted 6 lines
Quoted 4 lines
Ok, why do we need uncore.lock held here at all? Serialisation of mmio access to the same cacheline is the age old reason, can we guarantee that doesn't happen anyway? (Probably not, but really most callers do not need the mmio w/a.)
Is the serialization only needed for writing?
No, sadly not. Concurrent access of any type to the same cacheline is the trigger. (Supposed to be ivb-only.)
Quoted 4 lines
The only thing that can race with nonblocking atomic commits are legacy cursor updates, but those can only happen if the cursor plane are not part of the previous atomic commit. Those are also protected by
plane->mutex, so in theory same cache lines on the same pipes probably can't race..
At worst, we could just use a vblank->spinlock?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Call i915_pipe_update_start with uncore.lock held.
Op 12-02-18 om 16:44 schreef Chris Wilson:
Quoted 83 lines
Quoting Maarten Lankhorst (2018-02-12 15:39:16)
Quoted 82 lines
Op 12-02-18 om 16:19 schreef Chris Wilson:
Quoted 81 lines
Quoting Maarten Lankhorst (2018-02-09 09:54:02)
Quoted 21 lines
This requires being able to read the vblank counter with the uncore.lock already held. This is also a preparation for being able to run the entire vblank update sequence with the uncore lock held.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 66 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_trace.h | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 3 +- 4 files changed, 60 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -736,13 +736,12 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)/* Called from drm generic code, passed a 'crtc', which * we use as a pipe index */ drivers/gpu/drm/i915/i915_irq.c static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv) · line 744
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +3
-4-static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +static u32 __i915_get_vblank_counter (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode; -unsigned long irqflags; +const struct drm_display_mode *mode = &crtc->base.dev->vblank[crtc->pipe].hwmode;
lockdep_assert_held(&dev_priv->uncore.lock);Quoted 35 lines
drivers/gpu/drm/i915/i915_irq.c +8
-6htotal = mode->crtc_htotal; hsync_start = mode->crtc_hsync_start;@@ -756,10 +755,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)/* Start of vblank event occurs at start of hsync */ vbl_start -= htotal - hsync_start; - high_frame =PIPEFRAME (pipe); - low_frame =PIPEFRAMEPIXEL (pipe); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + high_frame =PIPEFRAME (crtc->pipe); + low_frame =PIPEFRAMEPIXEL (crtc->pipe);/* * High & low register fields aren't synchronized, so make sure @@ -772,8 +769,6 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) high2 =I915_READ_FW (high_frame) &PIPE_FRAME_HIGH_MASK ; }while (high1 != high2); -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); - high1 >>=PIPE_FRAME_HIGH_SHIFT ; pixel = low &PIPE_PIXEL_MASK ; low >>=PIPE_FRAME_LOW_SHIFT ;@@ -786,11 +781,60 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)return (((high1 <<8 ) | low) + (pixel >= vbl_start)) &0xffffff ; } +static u32 i915_get_vblank_counter (struct drm_device *dev,unsigned int pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (dev); +unsigned long irqflags; +u32 ret; +drivers/gpu/drm/i915/i915_irq.c static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · line 799
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10
-0+spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + ret =i915_get_vblank_counter (dev, pipe); +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); + +return ret; +} + +static u32 __g4x_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
lockdep_assert_held(&dev_priv->uncore.lock); ?
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Ok, why do we need uncore.lock held here at all? Serialisation of mmio access to the same cacheline is the age old reason, can we guarantee that doesn't happen anyway? (Probably not, but really most callers do not need the mmio w/a.)
Is the serialization only needed for writing?
No, sadly not. Concurrent access of any type to the same cacheline is the trigger. (Supposed to be ivb-only.)
It's gonna be a pain to find all users, so I think keeping the uncore lock is good enough for now, or we need to split off the display engine lock..
Quoted 6 lines
Quoted 5 lines
The only thing that can race with nonblocking atomic commits are legacy cursor updates, but those can only happen if the cursor plane are not part of the previous atomic commit. Those are also protected by
plane->mutex, so in theory same cache lines on the same pipes probably can't race..At worst, we could just use a
vblank->spinlock?
Perhaps, but the amount of registers isn't exactly small, so I feel better if we use the same lock consistently..
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Move all locking for plane updates to caller
In reply to Maarten Lankhorst--- drivers/gpu/drm/i915/i915_trace.h | 15 +++----- drivers/gpu/drm/i915/intel_display.c | 74 ++++++++++++++---------------------- drivers/gpu/drm/i915/intel_pm.c | 16 ++++---- drivers/gpu/drm/i915/intel_sprite.c | 61 +++++------------------------ 4 files changed, 52 insertions(+), 114 deletions(-)
drivers/gpu/drm/i915/i915_trace.h +6 -9
@@ -194,9 +194,8 @@ TRACE_EVENT(vlv_fifo_size,TP_fast_assign ( __entry->pipe = crtc->pipe; - __entry->frame = crtc->base.dev->driver->get_vblank_counter (crtc->base.dev, - crtc->pipe); - __entry->scanline =intel_get_crtc_scanline (crtc); + __entry->frame =__intel_crtc_get_vblank_counter (crtc); + __entry->scanline =__intel_get_crtc_scanline (crtc); __entry->sprite0_start = sprite0_start; __entry->sprite1_start = sprite1_start; __entry->fifo_size = fifo_size;
@@ -226,9 +225,8 @@ TRACE_EVENT(intel_update_plane,TP_fast_assign ( __entry->pipe = crtc->pipe; __entry->name = plane->name; - __entry->frame = crtc->base.dev->driver->get_vblank_counter (crtc->base.dev, - crtc->pipe); - __entry->scanline =intel_get_crtc_scanline (crtc); + __entry->frame =__intel_crtc_get_vblank_counter (crtc); + __entry->scanline =__intel_get_crtc_scanline (crtc);memcpy (__entry->src, &plane->state->src,sizeof (__entry->src));memcpy (__entry->dst, &plane->state->dst,sizeof (__entry->dst)); ),
@@ -254,9 +252,8 @@ TRACE_EVENT(intel_disable_plane,TP_fast_assign ( __entry->pipe = crtc->pipe; __entry->name = plane->name; - __entry->frame = crtc->base.dev->driver->get_vblank_counter (crtc->base.dev, - crtc->pipe); - __entry->scanline =intel_get_crtc_scanline (crtc); + __entry->frame =__intel_crtc_get_vblank_counter (crtc); + __entry->scanline =__intel_get_crtc_scanline (crtc); ), TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
drivers/gpu/drm/i915/intel_display.c +28 -46
239 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pm.c +8 -8
@@ -1964,7 +1964,6 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,* intel_pipe_update_start() has already disabled interrupts * for us, so a plain spin_lock() is sufficient here. */ -spin_lock (&dev_priv->uncore.lock);switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;
@@ -2024,8 +2023,6 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state, }POSTING_READ_FW (DSPARB ); - -spin_unlock (&dev_priv->uncore.lock); }#undef VLV_FIFO
@@ -4795,9 +4792,9 @@ static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, const struct skl_ddb_entry *entry) {if (entry->end) -I915_WRITE (reg, (entry->end -1 ) <<16 | entry->start); +I915_WRITE_FW (reg, (entry->end -1 ) <<16 | entry->start);else -I915_WRITE (reg,0 ); +I915_WRITE_FW (reg,0 ); } static void skl_write_wm_level(struct drm_i915_private *dev_priv,
@@ -4812,7 +4809,7 @@ static void skl_write_wm_level(struct drm_i915_private *dev_priv, val |= level->plane_res_l <<PLANE_WM_LINES_SHIFT ; } -I915_WRITE (reg, val); +I915_WRITE_FW (reg, val); } static void skl_write_plane_wm(struct intel_crtc *intel_crtc,
@@ -5181,7 +5178,7 @@ static void skl_atomic_update_crtc_wm(struct intel_atomic_state *state,if (!(state->wm_results.dirty_pipes &drm_crtc_mask (&crtc->base)))return ; -I915_WRITE (PIPE_WM_LINETIME (pipe), pipe_wm->linetime); +I915_WRITE_FW (PIPE_WM_LINETIME (pipe), pipe_wm->linetime);for_each_plane_id_on_crtc (crtc, plane_id) {if (plane_id !=PLANE_CURSOR )
@@ -5208,8 +5205,11 @@ static void skl_initial_wm(struct intel_atomic_state *state,mutex_lock (&dev_priv->wm.wm_mutex); -if (cstate->base.active_changed) +if (cstate->base.active_changed) { +spin_lock_irq (&dev_priv->uncore.lock);skl_atomic_update_crtc_wm (state, cstate); +spin_unlock_irq (&dev_priv->uncore.lock); + }skl_copy_wm_for_pipe (hw_vals, results, pipe);
drivers/gpu/drm/i915/intel_sprite.c +10 -51
227 lines not on this page · raw message
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: Use DOUBLE_BUFFER_CTL on top of vblank evasion for GEN9+.
In reply to Maarten LankhorstThis way, if somehow we wait too long there won't be much damage done..
--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_sprite.c | 6 ++++++ 2 files changed, 9 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -6588,6 +6588,9 @@ enum {#define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0)#define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0) +#define DOUBLE_BUFFER_CTL _MMIO(0x44500) +#define DOUBLE_BUFFER_CTL_GLOBAL_DISABLE (1 << 0) +/* refresh rate hardware control */ #define RR_HW_CTL _MMIO(0x45300)#define RR_HW_LOW_POWER_FRAMES_MASK 0xff
drivers/gpu/drm/i915/intel_sprite.c +6 -0
@@ -169,6 +169,9 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) crtc->debug.start_vbl_time =ktime_get (); crtc->debug.start_vbl_count =__intel_crtc_get_vblank_counter (crtc); +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE_FW (DOUBLE_BUFFER_CTL ,DOUBLE_BUFFER_CTL_GLOBAL_DISABLE ); +trace_i915_pipe_update_vblank_evaded (crtc); }
@@ -191,6 +194,9 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)trace_i915_pipe_update_end (crtc, end_vbl_count, scanline_end); +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE_FW (DOUBLE_BUFFER_CTL ,0 ); +/* We're still in the vblank-evade critical section, this can't race. * Would be slightly nice to just grab the vblank count and arm the * event outside of the critical section - the spinlock might spin for a
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Maarten Lankhorst (2018-02-09 09:53:59)
Quoted 6 lines
Some cleanups to move the uncore.lock around vblank evasion, so run to completion without racing on uncore.lock. Hopefully this will reduce the chance of underruns, and perhaps allows us to decrease
VBLANK_EVASION_TIME_USas well as a followup patch.Tested on KBL and BSW.
* shivers
uncore.lock is a brutally contested lock. Ville's patches did work on splitting the uncore.lock into forcewake and display variants, which cuts down on the nasty side effects.
Latency profiling, another item for the CI/QA wishlist. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 09-02-18 om 11:04 schreef Chris Wilson:
Quoted 7 lines
Quoting Maarten Lankhorst (2018-02-09 09:53:59)
Quoted 6 lines
Some cleanups to move the uncore.lock around vblank evasion, so run to completion without racing on uncore.lock. Hopefully this will reduce the chance of underruns, and perhaps allows us to decrease
VBLANK_EVASION_TIME_USas well as a followup patch.Tested on KBL and BSW.
Quoted 8 lines
* shivers
uncore.lock is a brutally contested lock. Ville's patches did work on splitting the uncore.lock into forcewake and display variants, which cuts down on the nasty side effects.
Latency profiling, another item for the CI/QA wishlist. -Chris
Yeah, unfortunately this is not different from status quo. We already require everything inside vblank evasion to run as fast as possible, and it's down to a list of register writes and a few reads. Those already need the uncore.lock, so all we do now is being more explicit about when we take it and eliminate contention when we write out the register values.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 17 lines · Maarten Lankhorst
Op 09-02-18 om 11:04 schreef Chris Wilson:
Quoted 7 lines
Quoting Maarten Lankhorst (2018-02-09 09:53:59)
Quoted 6 lines
Some cleanups to move the uncore.lock around vblank evasion, so run to completion without racing on uncore.lock. Hopefully this will reduce the chance of underruns, and perhaps allows us to decrease
VBLANK_EVASION_TIME_USas well as a followup patch.Tested on KBL and BSW.
Quoted 8 lines
* shivers
uncore.lock is a brutally contested lock. Ville's patches did work on splitting the uncore.lock into forcewake and display variants, which cuts down on the nasty side effects.
Latency profiling, another item for the CI/QA wishlist. -Chris
Quoted 6 lines
Yeah, unfortunately this is not different from status quo. We already require everything inside vblank evasion to run as fast as possible, and it's down to a list of register writes and a few reads. Those already need the uncore.lock, so all we do now is being more explicit about when we take it and eliminate contention when we write out the register values.
Would be nice to have some results for this though. IIRC when I was benchmarking my update optimizations and the de_lock stuff I was simply logging how long the updates take, and staring at histograms of that after running a bunch of igts and whatnot. I'm not sure I have the results anymore, but IIRC I did see some improvement.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 12-02-18 om 18:01 schreef Ville Syrjälä:
Quoted 23 lines · Maarten Lankhorst
Quoted 14 lines
Op 09-02-18 om 11:04 schreef Chris Wilson:
Quoted 13 lines
Quoting Maarten Lankhorst (2018-02-09 09:53:59)
Quoted 6 lines
Some cleanups to move the uncore.lock around vblank evasion, so run to completion without racing on uncore.lock. Hopefully this will reduce the chance of underruns, and perhaps allows us to decrease
VBLANK_EVASION_TIME_USas well as a followup patch.Tested on KBL and BSW.
* shivers
uncore.lock is a brutally contested lock. Ville's patches did work on splitting the uncore.lock into forcewake and display variants, which cuts down on the nasty side effects.
Quoted 8 lines
Quoted 2 lines
Latency profiling, another item for the CI/QA wishlist. -Chris
Yeah, unfortunately this is not different from status quo. We already require everything inside vblank evasion to run as fast as possible, and it's down to a list of register writes and a few reads. Those already need the uncore.lock, so all we do now is being more explicit about when we take it and eliminate contention when we write out the register values.
Quoted 6 lines
Would be nice to have some results for this though. IIRC when I was benchmarking my update optimizations and the
de_lockstuff I was simply logging how long the updates take, and staring at histograms of that after running a bunch of igts and whatnot. I'm not sure I have the results anymore, but IIRC I did see some improvement.
When testing with KBL and BSW, this patch series most updates complete in <40 us even with all debug options set, with the highest amount of time being a single update of 93 us for BSW.
Because we take all locking including the vblank reference in advance, latency from acquiring locks no longer affects the time critical part of vblank evasion.
Tested with kms_rotation_crc,
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Maarten Lankhorst (2018-02-13 10:19:42)
Quoted 24 lines
Op 12-02-18 om 18:01 schreef Ville Syrjälä:
Quoted 23 lines · Maarten Lankhorst
Quoted 22 lines
Op 09-02-18 om 11:04 schreef Chris Wilson:
Quoted 7 lines
Quoting Maarten Lankhorst (2018-02-09 09:53:59)
Quoted 6 lines
Some cleanups to move the uncore.lock around vblank evasion, so run to completion without racing on uncore.lock. Hopefully this will reduce the chance of underruns, and perhaps allows us to decrease
VBLANK_EVASION_TIME_USas well as a followup patch.Tested on KBL and BSW.
Quoted 8 lines
* shivers
uncore.lock is a brutally contested lock. Ville's patches did work on splitting the uncore.lock into forcewake and display variants, which cuts down on the nasty side effects.
Latency profiling, another item for the CI/QA wishlist. -Chris
Yeah, unfortunately this is not different from status quo. We already require everything inside vblank evasion to run as fast as possible, and it's down to a list of register writes and a few reads. Those already need the uncore.lock, so all we do now is being more explicit about when we take it and eliminate contention when we write out the register values.
Quoted 8 lines
Quoted 6 lines
Would be nice to have some results for this though. IIRC when I was benchmarking my update optimizations and the
de_lockstuff I was simply logging how long the updates take, and staring at histograms of that after running a bunch of igts and whatnot. I'm not sure I have the results anymore, but IIRC I did see some improvement.When testing with KBL and BSW, this patch series most updates complete in <40 us even with all debug options set, with the highest amount of time being a single update of 93 us for BSW.
To put that into perspective, that's a 4% delay in submission (ok, once every 16ms so ~.25% amoritized). They start to notice and complain at about a .5% drop in throughput, but fortunately they also don't tend to run with outputs enabled.
That being said, if we can say this is capped to less than 50us, sure. Although I reserve the right to complain later when we get response targets less than 50us.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Grab the vblank evasion lock around the entire evasion.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915: Grab the vblank evasion lock around the entire evasion.
URL : https://patchwork.freedesktop.org/series/37986/
State : failure
== Summary ==
Series 37986v1 drm/i915: Grab the vblank evasion lock around the entire evasion.
https://patchwork.freedesktop.org/api/1.0/series/37986/revisions/1/mbox/
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> DMESG-FAIL (fi-kbl-7567u)
Subgroup suspend-read-crc-pipe-b:
incomplete -> PASS (fi-snb-2520m) fdo#103713
pass -> SKIP (fi-kbl-7567u)
Subgroup suspend-read-crc-pipe-c:
pass -> SKIP (fi-kbl-7567u)
Test pm_rpm:
Subgroup basic-pci-d3-state:
pass -> SKIP (fi-kbl-7567u)
Subgroup basic-rte:
pass -> SKIP (fi-kbl-7567u)
Test prime_vgem:
Subgroup basic-fence-flip:
pass -> SKIP (fi-kbl-7567u)
Test drv_module_reload:
Subgroup basic-reload:
pass -> DMESG-WARN (fi-kbl-7567u)
Subgroup basic-no-display:
pass -> DMESG-WARN (fi-kbl-7567u)
Subgroup basic-reload-inject:
pass -> DMESG-WARN (fi-kbl-7567u)fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:417s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:428s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:489s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:483s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:485s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:468s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:456s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:570s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:582s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:411s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:509s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:388s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:412s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:461s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:416s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:455s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:496s fi-kbl-7567u total:288 pass:259 dwarn:3 dfail:1 fail:0 skip:25 time:409s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:501s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:425s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:506s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:522s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:484s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:470s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:415s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:429s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:531s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:400s
Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:470s
6c10ba221576c523e2574d83e75a87cdc7b0bc1e drm-tip: 2018y-02m-08d-19h-13m-44s UTC integration manifest 576df4828086 drm/i915: Use DOUBLE_BUFFER_CTL on top of vblank evasion for GEN9+. ed09ed8129b3 drm/i915: Move all locking for plane updates to callereb336be9bdce drm/i915: Call i915_pipe_update_start with uncore.lock held. b9e946cfb283 drm/i915: Grab uncore.lock around enabling vblank evasion976a99c13014 drm/i915: Keep vblank irq enabled during vblank evasion.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7964/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Grab the vblank evasion lock around the entire evasion.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915: Grab the vblank evasion lock around the entire evasion.
URL : https://patchwork.freedesktop.org/series/37986/
State : success
== Summary ==
Series 37986v1 drm/i915: Grab the vblank evasion lock around the entire evasion.
https://patchwork.freedesktop.org/api/1.0/series/37986/revisions/1/mbox/
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
incomplete -> PASS (fi-skl-6260u)
Test prime_vgem:
Subgroup basic-fence-flip:
fail -> PASS (fi-ilk-650)fi-bdw-5557u total:288 pass:265 dwarn:0 dfail:0 fail:2 skip:21 time:446s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:422s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:504s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:482s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:490s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:473s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:465s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:568s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:574s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:417s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:512s fi-hsw-4770 total:288 pass:259 dwarn:0 dfail:0 fail:2 skip:27 time:414s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:413s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:453s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:419s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:460s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:496s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:501s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:430s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:510s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:527s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:487s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:486s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:415s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:430s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:520s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:399s
Blacklisted hosts:
fi-glk-dsi total:117 pass:105 dwarn:0 dfail:0 fail:0 skip:12
817d13e99013266e1dc5e7fc056faa960e9a53dc drm-tip: 2018y-02m-12d-13h-34m-48s UTC integration manifest c178e786a11c drm/i915: Use DOUBLE_BUFFER_CTL on top of vblank evasion for GEN9+. a5c32a2c2484 drm/i915: Move all locking for plane updates to callerdc25ed08f485 drm/i915: Call i915_pipe_update_start with uncore.lock held. 01ef705a11de drm/i915: Grab uncore.lock around enabling vblank evasion7b997261ce22 drm/i915: Keep vblank irq enabled during vblank evasion.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7979/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for drm/i915: Grab the vblank evasion lock around the entire evasion.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915: Grab the vblank evasion lock around the entire evasion.
URL : https://patchwork.freedesktop.org/series/37986/
State : warning
== Summary ==
Test gem_eio:
Subgroup in-flight:
pass -> DMESG-WARN (shard-snb) fdo#104058
Test pm_rpm:
Subgroup gem-evict-pwrite:
fail -> PASS (shard-hsw)
Subgroup pm-caching:
fail -> PASS (shard-hsw)
Subgroup universal-planes-dpms:
fail -> PASS (shard-hsw)
Test kms_frontbuffer_tracking:
Subgroup fbc-2p-primscrn-pri-indfb-draw-pwrite:
pass -> SKIP (shard-hsw)
Test drv_suspend:
Subgroup fence-restore-untiled:
pass -> SKIP (shard-snb)fdo#104058 https://bugs.freedesktop.org/show_bug.cgi?id=104058
shard-apl total:3391 pass:1763 dwarn:1 dfail:0 fail:20 skip:1606 time:12575s shard-hsw total:3444 pass:1719 dwarn:1 dfail:0 fail:52 skip:1671 time:11907s shard-snb total:3444 pass:1349 dwarn:2 dfail:0 fail:10 skip:2083 time:6712s
Blacklisted hosts:
shard-kbl total:3444 pass:1914 dwarn:1 dfail:0 fail:21 skip:1508 time:9740s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7979/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx