From: John Harrison <john.c.harri...@intel.com>

Now that all callers of i915_add_request() have a request pointer to hand, it is
possible to update the add request function to take a request pointer rather
than pulling it out of the OLR.

For: VIZ-5115
Signed-off-by: John Harrison <john.c.harri...@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h            |   10 +++++-----
 drivers/gpu/drm/i915/i915_gem.c            |   24 ++++++++++++------------
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |    2 +-
 drivers/gpu/drm/i915/intel_display.c       |    2 +-
 drivers/gpu/drm/i915/intel_lrc.c           |    2 +-
 drivers/gpu/drm/i915/intel_overlay.c       |    4 ++--
 drivers/gpu/drm/i915/intel_ringbuffer.c    |    3 ++-
 7 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 34fd338..9206328 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2830,14 +2830,14 @@ void i915_gem_init_swizzling(struct drm_device *dev);
 void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
 int __must_check i915_gpu_idle(struct drm_device *dev);
 int __must_check i915_gem_suspend(struct drm_device *dev);
-int __i915_add_request(struct intel_engine_cs *ring,
+int __i915_add_request(struct drm_i915_gem_request *req,
                       struct drm_file *file,
                       struct drm_i915_gem_object *batch_obj,
                       bool flush_caches);
-#define i915_add_request(ring) \
-       __i915_add_request(ring, NULL, NULL, true)
-#define i915_add_request_no_flush(ring) \
-       __i915_add_request(ring, NULL, NULL, false)
+#define i915_add_request(req) \
+       __i915_add_request(req, NULL, NULL, true)
+#define i915_add_request_no_flush(req) \
+       __i915_add_request(req, NULL, NULL, false)
 int __i915_wait_request(struct drm_i915_gem_request *req,
                        unsigned reset_counter,
                        bool interruptible,
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0c7e1bd..24fb7b9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1162,7 +1162,7 @@ i915_gem_check_olr(struct drm_i915_gem_request *req)
 
        ret = 0;
        if (req == req->ring->outstanding_lazy_request)
-               ret = i915_add_request(req->ring);
+               ret = i915_add_request(req);
 
        return ret;
 }
@@ -2407,25 +2407,25 @@ i915_gem_get_seqno(struct drm_device *dev, u32 *seqno)
        return 0;
 }
 
-int __i915_add_request(struct intel_engine_cs *ring,
+int __i915_add_request(struct drm_i915_gem_request *request,
                       struct drm_file *file,
                       struct drm_i915_gem_object *obj,
                       bool flush_caches)
 {
-       struct drm_i915_private *dev_priv = ring->dev->dev_private;
-       struct drm_i915_gem_request *request;
+       struct intel_engine_cs *ring;
+       struct drm_i915_private *dev_priv;
        struct intel_ringbuffer *ringbuf;
        u32 request_start;
        int ret;
 
-       request = ring->outstanding_lazy_request;
        if (WARN_ON(request == NULL))
                return -ENOMEM;
 
-       if (i915.enable_execlists) {
-               ringbuf = request->ctx->engine[ring->id].ringbuf;
-       } else
-               ringbuf = ring->buffer;
+       ring = request->ring;
+       dev_priv = ring->dev->dev_private;
+       ringbuf = request->ringbuf;
+
+       WARN_ON(request != ring->outstanding_lazy_request);
 
        request_start = intel_ring_get_tail(ringbuf);
        /*
@@ -3118,7 +3118,7 @@ int i915_gpu_idle(struct drm_device *dev)
                                return ret;
                        }
 
-                       ret = i915_add_request_no_flush(req->ring);
+                       ret = i915_add_request_no_flush(req);
                        if (ret) {
                                i915_gem_request_unreference(req);
                                return ret;
@@ -3966,7 +3966,7 @@ i915_gem_object_pin_to_display_plane(struct 
drm_i915_gem_object *obj,
                        if (ret)
                                return ret;
 
-                       ret = i915_add_request_no_flush(req->ring);
+                       ret = i915_add_request_no_flush(req);
                        if (ret)
                                return ret;
                }
@@ -4884,7 +4884,7 @@ i915_gem_init_hw(struct drm_device *dev)
                        return ret;
                }
 
-               ret = i915_add_request_no_flush(ring);
+               ret = i915_add_request_no_flush(req);
                if (ret) {
                        DRM_ERROR("Add request ring #%d failed: %d\n", i, ret);
                        i915_gem_request_unreference(req);
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 1e2fc80..15e33a9 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -996,7 +996,7 @@ i915_gem_execbuffer_retire_commands(struct 
i915_execbuffer_params *params)
        params->ring->gpu_caches_dirty = true;
 
        /* Add a breadcrumb for the completion of the batch buffer */
-       return __i915_add_request(params->ring, params->file,
+       return __i915_add_request(params->request, params->file,
                                  params->batch_obj, true);
 }
 
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index c32bc0c..9cbfb93 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9840,7 +9840,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 
                i915_gem_request_assign(&work->flip_queued_req, request);
 
-               ret = i915_add_request_no_flush(request->ring);
+               ret = i915_add_request_no_flush(request);
                if (ret)
                        goto cleanup_request_assign;
        }
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index f0bb98a..3b4393c 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1942,7 +1942,7 @@ int intel_lr_context_deferred_create(struct intel_context 
*ctx,
                                goto error;
                        }
 
-                       ret = i915_add_request_no_flush(req->ring);
+                       ret = i915_add_request_no_flush(req);
                        if (ret) {
                                DRM_ERROR("ring init context: %d\n", ret);
                                i915_gem_request_unreference(req);
diff --git a/drivers/gpu/drm/i915/intel_overlay.c 
b/drivers/gpu/drm/i915/intel_overlay.c
index dc209bf..228c9d1 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -217,7 +217,7 @@ static int intel_overlay_do_wait_request(struct 
intel_overlay *overlay,
 
        BUG_ON(overlay->last_flip_req);
        i915_gem_request_assign(&overlay->last_flip_req, req);
-       ret = i915_add_request(req->ring);
+       ret = i915_add_request(req);
        if (ret) {
                i915_gem_request_unreference(req);
                return ret;
@@ -304,7 +304,7 @@ static int intel_overlay_continue(struct intel_overlay 
*overlay,
 
        WARN_ON(overlay->last_flip_req);
        i915_gem_request_assign(&overlay->last_flip_req, req);
-       ret = i915_add_request(req->ring);
+       ret = i915_add_request(req);
        if (ret)
                i915_gem_request_unreference(req);
 
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 18d12a5..508d7d8 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2145,8 +2145,9 @@ int intel_ring_idle(struct intel_engine_cs *ring)
        int ret;
 
        /* We need to add any requests required to flush the objects and ring */
+       WARN_ON(ring->outstanding_lazy_request);
        if (ring->outstanding_lazy_request) {
-               ret = i915_add_request(ring);
+               ret = i915_add_request(ring->outstanding_lazy_request);
                if (ret)
                        return ret;
        }
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to