drm/i915: Retire requests along rings
[linux-2.6-block.git] / drivers / gpu / drm / i915 / intel_ringbuffer.c
index 69ffc0dfe92b5529391affe9e7f16c71e105cec1..ae8958007df548b6f8109e09b07022eea246b4fb 100644 (file)
@@ -1066,7 +1066,6 @@ err:
 
 void intel_ring_reset(struct intel_ring *ring, u32 tail)
 {
-       GEM_BUG_ON(!list_empty(&ring->request_list));
        ring->tail = tail;
        ring->head = tail;
        ring->emit = tail;
@@ -1125,6 +1124,7 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size)
 
        GEM_BUG_ON(!is_power_of_2(size));
        GEM_BUG_ON(RING_CTL_SIZE(size) & ~RING_NR_PAGES);
+       lockdep_assert_held(&engine->i915->drm.struct_mutex);
 
        ring = kzalloc(sizeof(*ring), GFP_KERNEL);
        if (!ring)
@@ -1150,6 +1150,8 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size)
        }
        ring->vma = vma;
 
+       list_add(&ring->link, &engine->i915->gt.rings);
+
        return ring;
 }
 
@@ -1161,6 +1163,8 @@ intel_ring_free(struct intel_ring *ring)
        i915_vma_close(ring->vma);
        __i915_gem_object_release_unless_active(obj);
 
+       list_del(&ring->link);
+
        kfree(ring);
 }