drm/i915: Assign request ringbuf before pin
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Mon, 6 Jul 2015 08:08:30 +0000 (11:08 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 6 Jul 2015 14:46:07 +0000 (16:46 +0200)
In preparation to make intel_lr_context_pin|unpin to accept
requests, assign ringbuf into request before we call the pinning.

v2: No need to unset ringbuf on error path (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_lrc.c

index 8e1619a06f3b6736a7f303f5058a703e5bc74034..fd285d32f62ae51696942d336e0f1d11cd9c0e9d 100644 (file)
@@ -633,14 +633,14 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 {
        int ret;
 
+       request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
+
        if (request->ctx != request->ring->default_context) {
                ret = intel_lr_context_pin(request->ring, request->ctx);
                if (ret)
                        return ret;
        }
 
-       request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
-
        return 0;
 }