]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/i915: Update alloc_request to return the allocated request
authorJohn Harrison <John.C.Harrison@Intel.com>
Fri, 29 May 2015 16:43:29 +0000 (17:43 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 23 Jun 2015 12:02:00 +0000 (14:02 +0200)
The alloc_request() function does not actually return the newly allocated
request. Instead, it must be pulled from ring->outstanding_lazy_request. This
patch fixes this so that code can create a request and start using it knowing
exactly which request it actually owns.

v2: Updated for new i915_gem_request_alloc() scheme.

For: VIZ-5115
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Tomas Elf <tomas.elf@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c

index fdb185da2eef83707b8c3a521f30bc5bbd9fb44d..c439461db9af75f9ed368905cf46e9b876eb155f 100644 (file)
@@ -2206,7 +2206,8 @@ struct drm_i915_gem_request {
 };
 
 int i915_gem_request_alloc(struct intel_engine_cs *ring,
-                          struct intel_context *ctx);
+                          struct intel_context *ctx,
+                          struct drm_i915_gem_request **req_out);
 void i915_gem_request_cancel(struct drm_i915_gem_request *req);
 void i915_gem_request_free(struct kref *req_ref);
 
index 80705dee92d6c7e71e3dc0226b6948e7d8cca625..a0f51478581f0537e1289fb1c85bb57d8403a5ba 100644 (file)
@@ -2634,13 +2634,17 @@ void i915_gem_request_free(struct kref *req_ref)
 }
 
 int i915_gem_request_alloc(struct intel_engine_cs *ring,
-                          struct intel_context *ctx)
+                          struct intel_context *ctx,
+                          struct drm_i915_gem_request **req_out)
 {
        struct drm_i915_private *dev_priv = to_i915(ring->dev);
        struct drm_i915_gem_request *req;
        int ret;
 
-       if (ring->outstanding_lazy_request)
+       if (!req_out)
+               return -EINVAL;
+
+       if ((*req_out = ring->outstanding_lazy_request) != NULL)
                return 0;
 
        req = kmem_cache_zalloc(dev_priv->requests, GFP_KERNEL);
@@ -2686,7 +2690,7 @@ int i915_gem_request_alloc(struct intel_engine_cs *ring,
         */
        intel_ring_reserved_space_reserve(req->ringbuf, MIN_SPACE_FOR_ADD_REQUEST);
 
-       ring->outstanding_lazy_request = req;
+       *req_out = ring->outstanding_lazy_request = req;
        return 0;
 
 err:
index 4bd10df1911ceb0592fab823d38d630eb0d6f93f..9c9e20ace5e3352fdc6be0688bf24bfc62982701 100644 (file)
@@ -1415,6 +1415,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        struct i915_address_space *vm;
        struct i915_execbuffer_params params_master; /* XXX: will be removed later */
        struct i915_execbuffer_params *params = &params_master;
+       struct drm_i915_gem_request *request;
        const u32 ctx_id = i915_execbuffer2_get_context_id(*args);
        u32 dispatch_flags;
        int ret;
@@ -1614,7 +1615,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                params->batch_obj_vm_offset = i915_gem_obj_offset(batch_obj, vm);
 
        /* Allocate a request for this batch buffer nice and early. */
-       ret = i915_gem_request_alloc(ring, ctx);
+       ret = i915_gem_request_alloc(ring, ctx, &request);
        if (ret)
                goto err_batch_unpin;
 
index 54654d25608a60a8fb22bb9b275df2a490cfae89..8af35889740b3708dd1f6e9cbb1e720c75879c8c 100644 (file)
@@ -818,6 +818,7 @@ static int logical_ring_prepare(struct intel_ringbuffer *ringbuf,
 static int intel_logical_ring_begin(struct intel_ringbuffer *ringbuf,
                                    struct intel_context *ctx, int num_dwords)
 {
+       struct drm_i915_gem_request *req;
        struct intel_engine_cs *ring = ringbuf->ring;
        struct drm_device *dev = ring->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -833,7 +834,7 @@ static int intel_logical_ring_begin(struct intel_ringbuffer *ringbuf,
                return ret;
 
        /* Preallocate the olr before touching the ring */
-       ret = i915_gem_request_alloc(ring, ctx);
+       ret = i915_gem_request_alloc(ring, ctx, &req);
        if (ret)
                return ret;
 
index b48aea12acc4f8ccd3d84407d65d447d4f9026eb..13eab17579728d750e4ded1612858b98d1c1e1c3 100644 (file)
@@ -2277,6 +2277,7 @@ static int __intel_ring_prepare(struct intel_engine_cs *ring, int bytes)
 int intel_ring_begin(struct intel_engine_cs *ring,
                     int num_dwords)
 {
+       struct drm_i915_gem_request *req;
        struct drm_i915_private *dev_priv = ring->dev->dev_private;
        int ret;
 
@@ -2290,7 +2291,7 @@ int intel_ring_begin(struct intel_engine_cs *ring,
                return ret;
 
        /* Preallocate the olr before touching the ring */
-       ret = i915_gem_request_alloc(ring, ring->default_context);
+       ret = i915_gem_request_alloc(ring, ring->default_context, &req);
        if (ret)
                return ret;