drm/i915: Update init_context() to take a request structure
authorJohn Harrison <John.C.Harrison@Intel.com>
Fri, 29 May 2015 16:43:44 +0000 (17:43 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 23 Jun 2015 12:02:12 +0000 (14:02 +0200)
Now that everything above has been converted to use requests, it is possible to
update init_context() to take a request pointer instead of a ring/context pair.

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_gem_context.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h

index 116c98394507b7b1cc9daa7f9b7a0d2e4a3c65e7..4969fc467ac039c02dfa2899357ffc8152e80afa 100644 (file)
@@ -418,7 +418,7 @@ int i915_gem_context_enable(struct drm_i915_gem_request *req)
                if (ring->init_context == NULL)
                        return 0;
 
-               ret = ring->init_context(ring, ring->default_context);
+               ret = ring->init_context(req);
        } else
                ret = i915_switch_context(req);
 
@@ -760,7 +760,7 @@ done:
 
        if (uninitialized) {
                if (ring->init_context) {
-                       ret = ring->init_context(ring, to);
+                       ret = ring->init_context(req);
                        if (ret)
                                DRM_ERROR("ring init context: %d\n", ret);
                }
index 3d60823e2c203e896be123f9cf98cdfef561875e..a8704f3571ffc25a256bb4da4a0f71d8b209d3d6 100644 (file)
@@ -1602,16 +1602,15 @@ out:
        return ret;
 }
 
-static int gen8_init_rcs_context(struct intel_engine_cs *ring,
-                      struct intel_context *ctx)
+static int gen8_init_rcs_context(struct drm_i915_gem_request *req)
 {
        int ret;
 
-       ret = intel_logical_ring_workarounds_emit(ring, ctx);
+       ret = intel_logical_ring_workarounds_emit(req->ring, req->ctx);
        if (ret)
                return ret;
 
-       return intel_lr_context_render_state_init(ring, ctx);
+       return intel_lr_context_render_state_init(req->ring, req->ctx);
 }
 
 /**
@@ -2236,7 +2235,7 @@ int intel_lr_context_deferred_create(struct intel_context *ctx,
                        if (ret)
                                return ret;
 
-                       ret = ring->init_context(req->ring, ctx);
+                       ret = ring->init_context(req);
                        if (ret) {
                                DRM_ERROR("ring init context: %d\n", ret);
                                i915_gem_request_cancel(req);
index 13eab17579728d750e4ded1612858b98d1c1e1c3..1b9b2c06053343ee978c9d21ec54ece5cd65612d 100644 (file)
@@ -742,16 +742,15 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring,
        return 0;
 }
 
-static int intel_rcs_ctx_init(struct intel_engine_cs *ring,
-                             struct intel_context *ctx)
+static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
 {
        int ret;
 
-       ret = intel_ring_workarounds_emit(ring, ctx);
+       ret = intel_ring_workarounds_emit(req->ring, req->ctx);
        if (ret != 0)
                return ret;
 
-       ret = i915_gem_render_state_init(ring);
+       ret = i915_gem_render_state_init(req->ring);
        if (ret)
                DRM_ERROR("init render state: %d\n", ret);
 
index 73db3ae8f237a0e9cae46b5a129d629efb22abd9..2bf58fa024eff9ed3db37f0b1fc57ff3198909a2 100644 (file)
@@ -176,8 +176,7 @@ struct  intel_engine_cs {
 
        int             (*init_hw)(struct intel_engine_cs *ring);
 
-       int             (*init_context)(struct intel_engine_cs *ring,
-                                       struct intel_context *ctx);
+       int             (*init_context)(struct drm_i915_gem_request *req);
 
        void            (*write_tail)(struct intel_engine_cs *ring,
                                      u32 value);