]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915/bdw: Ring idle and stop with logical rings
authorOscar Mateo <oscar.mateo@intel.com>
Thu, 24 Jul 2014 16:04:30 +0000 (17:04 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 11 Aug 2014 20:57:38 +0000 (22:57 +0200)
This is a hard one, since there is no direct hardware ring to
control when in Execlists.

We reuse intel_ring_idle here, but it should be fine as long
as i915_add_request does the ring thing.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_lrc.c

index a88fa6e9360b2e9ba6f7f74f97e6c6ddea4997e4..8a524baa8a6b8ec5e18ad8fbd089c58cbf625bec 100644 (file)
@@ -105,7 +105,24 @@ int intel_execlists_submission(struct drm_device *dev, struct drm_file *file,
 
 void intel_logical_ring_stop(struct intel_engine_cs *ring)
 {
-       /* TODO */
+       struct drm_i915_private *dev_priv = ring->dev->dev_private;
+       int ret;
+
+       if (!intel_ring_initialized(ring))
+               return;
+
+       ret = intel_ring_idle(ring);
+       if (ret && !i915_reset_in_progress(&to_i915(ring->dev)->gpu_error))
+               DRM_ERROR("failed to quiesce %s whilst cleaning up: %d\n",
+                         ring->name, ret);
+
+       /* TODO: Is this correct with Execlists enabled? */
+       I915_WRITE_MODE(ring, _MASKED_BIT_ENABLE(STOP_RING));
+       if (wait_for_atomic((I915_READ_MODE(ring) & MODE_IDLE) != 0, 1000)) {
+               DRM_ERROR("%s :timed out trying to stop ring\n", ring->name);
+               return;
+       }
+       I915_WRITE_MODE(ring, _MASKED_BIT_DISABLE(STOP_RING));
 }
 
 void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf)
@@ -458,10 +475,13 @@ static int gen8_emit_request(struct intel_ringbuffer *ringbuf)
 
 void intel_logical_ring_cleanup(struct intel_engine_cs *ring)
 {
+       struct drm_i915_private *dev_priv = ring->dev->dev_private;
+
        if (!intel_ring_initialized(ring))
                return;
 
-       /* TODO: make sure the ring is stopped */
+       intel_logical_ring_stop(ring);
+       WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0);
        ring->preallocated_lazy_request = NULL;
        ring->outstanding_lazy_seqno = 0;