drm/i915: Convert 'last_flip_req' to be a request not a seqno
authorJohn Harrison <John.C.Harrison@Intel.com>
Mon, 24 Nov 2014 18:49:31 +0000 (18:49 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 3 Dec 2014 08:35:17 +0000 (09:35 +0100)
Converted 'last_flip_req' to be an actual request rather than a seqno value as
part of the on going seqno to request changes. This includes reference counting
the request being saved away to ensure it can not be retired and freed while the
overlay code is still waiting on it.

For: VIZ-4377
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Thomas Daniel <Thomas.Daniel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_overlay.c

index dc2f4f26c961e0849c19551ad3cf4385ee76b599..5defc37d8adb1092cc955c07629ffa2c2c93d423 100644 (file)
@@ -182,7 +182,7 @@ struct intel_overlay {
        u32 flip_addr;
        struct drm_i915_gem_object *reg_bo;
        /* flip handling */
-       uint32_t last_flip_req;
+       struct drm_i915_gem_request *last_flip_req;
        void (*flip_tail)(struct intel_overlay *);
 };
 
@@ -217,17 +217,20 @@ static int intel_overlay_do_wait_request(struct intel_overlay *overlay,
        int ret;
 
        BUG_ON(overlay->last_flip_req);
-       ret = i915_add_request(ring, &overlay->last_flip_req);
+       i915_gem_request_assign(&overlay->last_flip_req,
+                                            ring->outstanding_lazy_request);
+       ret = i915_add_request(ring, NULL);
        if (ret)
                return ret;
 
        overlay->flip_tail = tail;
-       ret = i915_wait_seqno(ring, overlay->last_flip_req);
+       ret = i915_wait_seqno(ring,
+                        i915_gem_request_get_seqno(overlay->last_flip_req));
        if (ret)
                return ret;
        i915_gem_retire_requests(dev);
 
-       overlay->last_flip_req = 0;
+       i915_gem_request_assign(&overlay->last_flip_req, NULL);
        return 0;
 }
 
@@ -286,7 +289,10 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
        intel_ring_emit(ring, flip_addr);
        intel_ring_advance(ring);
 
-       return i915_add_request(ring, &overlay->last_flip_req);
+       WARN_ON(overlay->last_flip_req);
+       i915_gem_request_assign(&overlay->last_flip_req,
+                                            ring->outstanding_lazy_request);
+       return i915_add_request(ring, NULL);
 }
 
 static void intel_overlay_release_old_vid_tail(struct intel_overlay *overlay)
@@ -366,10 +372,11 @@ static int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay)
        struct intel_engine_cs *ring = &dev_priv->ring[RCS];
        int ret;
 
-       if (overlay->last_flip_req == 0)
+       if (overlay->last_flip_req == NULL)
                return 0;
 
-       ret = i915_wait_seqno(ring, overlay->last_flip_req);
+       ret = i915_wait_seqno(ring,
+                        i915_gem_request_get_seqno(overlay->last_flip_req));
        if (ret)
                return ret;
        i915_gem_retire_requests(dev);
@@ -377,7 +384,7 @@ static int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay)
        if (overlay->flip_tail)
                overlay->flip_tail(overlay);
 
-       overlay->last_flip_req = 0;
+       i915_gem_request_assign(&overlay->last_flip_req, NULL);
        return 0;
 }