Re: [PATCH 2/2] drm/i915: Make mmio flip wait for seqno in the work function

Chris Wilson
2014-11-06T07:48:06Z

On Thu, Nov 06, 2014 at 09:26:39AM +0200, Ander Conselvan de Oliveira wrote:
> @@ -9424,73 +9424,24 @@ static void intel_do_mmio_flip(struct intel_crtc *intel_crtc)
>
> if (atomic_update)
> intel_pipe_update_end(intel_crtc, start_vbl_count);
> -
> - spin_lock_irq(&dev_priv->mmio_flip_lock);
> - intel_crtc->mmio_flip.status = INTEL_MMIO_FLIP_IDLE;
> - spin_unlock_irq(&dev_priv->mmio_flip_lock);
> }
>
> static void intel_mmio_flip_work_func(struct work_struct *work)
> {
> struct intel_crtc *intel_crtc =
> container_of(work, struct intel_crtc, mmio_flip.work);
> -
> - intel_do_mmio_flip(intel_crtc);
> -}
> -
> -static int intel_postpone_flip(struct drm_i915_gem_object *obj)
> -{
> struct intel_engine_cs *ring;
> - int ret;
> -
> - lockdep_assert_held(&obj->base.dev->struct_mutex);
> -
> - if (!obj->last_write_seqno)
> - return 0;
> -
> - ring = obj->ring;
> -
> - if (i915_seqno_passed(ring->get_seqno(ring, true),
> - obj->last_write_seqno))
> - return 0;
> -
> - ret = i915_gem_check_olr(ring, obj->last_write_seqno);
> - if (ret)
> - return ret;
> -
> - if (WARN_ON(!ring->irq_get(ring)))
> - return 0;
> -
> - return 1;
> -}
> + uint32_t seqno;
>
> -void intel_notify_mmio_flip(struct intel_engine_cs *ring)
> -{
> - struct drm_i915_private *dev_priv = to_i915(ring->dev);
> - struct intel_crtc *intel_crtc;
> - unsigned long irq_flags;
> - u32 seqno;
> -
> - seqno = ring->get_seqno(ring, false);
> + seqno = intel_crtc->mmio_flip.seqno;
> + ring = intel_crtc->mmio_flip.ring;
>
> - spin_lock_irqsave(&dev_priv->mmio_flip_lock, irq_flags);
> - for_each_intel_crtc(ring->dev, intel_crtc) {
> - struct intel_mmio_flip *mmio_flip;
> + if (seqno)
> + WARN_ON(__i915_wait_seqno(ring, seqno,
> + intel_crtc->reset_counter,
> + true, NULL, NULL) != 0);

interruptible needs to be false

That's the only thing I spotted wrong.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre