[Intel-gfx] [PATCH 05/32] drm/i915: Simplify checking of GPU reset_counter in display pageflips
Daniel Vetter
daniel at ffwll.ch
Wed Dec 16 01:31:40 PST 2015
On Fri, Dec 11, 2015 at 11:33:01AM +0000, Chris Wilson wrote:
> If we, when we store the reset_counter for the operation, we ensure that
> it is not in a wedged or in the middle of a reset, we can then assert that
> if any reset occurs the reset_counter must change. Later we can just
> compare the operation's reset epoch against the current counter to see
> if we need to abort the operation (to handle the hang).
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/i915/intel_display.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index cc47c0206294..8b6028cd619f 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3283,14 +3283,12 @@ void intel_finish_reset(struct drm_device *dev)
> static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
> {
> struct drm_device *dev = crtc->dev;
> - struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> unsigned reset_counter;
> bool pending;
>
> - reset_counter = i915_reset_counter(&dev_priv->gpu_error);
> - if (intel_crtc->reset_counter != reset_counter ||
> - __i915_reset_in_progress_or_wedged(reset_counter))
> + reset_counter = i915_reset_counter(&to_i915(dev)->gpu_error);
> + if (intel_crtc->reset_counter != reset_counter)
> return false;
>
> spin_lock_irq(&dev->event_lock);
> @@ -10947,8 +10945,7 @@ static bool page_flip_finished(struct intel_crtc *crtc)
> unsigned reset_counter;
>
> reset_counter = i915_reset_counter(&dev_priv->gpu_error);
> - if (crtc->reset_counter != reset_counter ||
> - __i915_reset_in_progress_or_wedged(reset_counter))
> + if (crtc->reset_counter != reset_counter)
> return true;
>
> /*
> @@ -11604,8 +11601,13 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> if (ret)
> goto cleanup;
>
> - atomic_inc(&intel_crtc->unpin_work_count);
> intel_crtc->reset_counter = i915_reset_counter(&dev_priv->gpu_error);
> + if (__i915_reset_in_progress_or_wedged(intel_crtc->reset_counter)) {
> + ret = -EIO;
> + goto cleanup;
> + }
> +
> + atomic_inc(&intel_crtc->unpin_work_count);
>
> if (INTEL_INFO(dev)->gen >= 5 || IS_G4X(dev))
> work->flip_count = I915_READ(PIPE_FLIPCOUNT_G4X(pipe)) + 1;
> --
> 2.6.3
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list