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

Updated do_switch() to take a request pointer instead of a ring/context pair.

For: VIZ-5115
Signed-off-by: John Harrison <john.c.harri...@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index b326f8d..eedb994 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -556,9 +556,10 @@ mi_set_context(struct intel_engine_cs *ring,
        return ret;
 }
 
-static int do_switch(struct intel_engine_cs *ring,
-                    struct intel_context *to)
+static int do_switch(struct drm_i915_gem_request *req)
 {
+       struct intel_context *to = req->ctx;
+       struct intel_engine_cs *ring = req->ring;
        struct drm_i915_private *dev_priv = ring->dev->dev_private;
        struct intel_context *from = ring->last_context;
        u32 hw_flags = 0;
@@ -591,7 +592,7 @@ static int do_switch(struct intel_engine_cs *ring,
 
        if (to->ppgtt) {
                trace_switch_mm(ring, to);
-               ret = to->ppgtt->switch_mm(to->ppgtt, ring);
+               ret = to->ppgtt->switch_mm(to->ppgtt, req->ring);
                if (ret)
                        goto unpin_out;
        }
@@ -627,7 +628,7 @@ static int do_switch(struct intel_engine_cs *ring,
        if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to))
                hw_flags |= MI_RESTORE_INHIBIT;
 
-       ret = mi_set_context(ring, to, hw_flags);
+       ret = mi_set_context(req->ring, to, hw_flags);
        if (ret)
                goto unpin_out;
 
@@ -635,7 +636,7 @@ static int do_switch(struct intel_engine_cs *ring,
                if (!(to->remap_slice & (1<<i)))
                        continue;
 
-               ret = i915_gem_l3_remap(ring, i);
+               ret = i915_gem_l3_remap(req->ring, i);
                /* If it failed, try again next round */
                if (ret)
                        DRM_DEBUG_DRIVER("L3 remapping failed\n");
@@ -651,7 +652,7 @@ static int do_switch(struct intel_engine_cs *ring,
         */
        if (from != NULL) {
                from->legacy_hw_ctx.rcs_state->base.read_domains = 
I915_GEM_DOMAIN_INSTRUCTION;
-               
i915_vma_move_to_active(i915_gem_obj_to_ggtt(from->legacy_hw_ctx.rcs_state), 
ring);
+               
i915_vma_move_to_active(i915_gem_obj_to_ggtt(from->legacy_hw_ctx.rcs_state), 
req->ring);
                /* As long as MI_SET_CONTEXT is serializing, ie. it flushes the
                 * whole damn pipeline, we don't need to explicitly mark the
                 * object dirty. The only exception is that the context must be
@@ -677,7 +678,7 @@ done:
 
        if (uninitialized) {
                if (ring->init_context) {
-                       ret = ring->init_context(ring, to);
+                       ret = ring->init_context(req->ring, to);
                        if (ret)
                                DRM_ERROR("ring init context: %d\n", ret);
                }
@@ -722,7 +723,7 @@ int i915_switch_context(struct drm_i915_gem_request *req)
                return 0;
        }
 
-       return do_switch(req->ring, req->ctx);
+       return do_switch(req);
 }
 
 static bool contexts_enabled(struct drm_device *dev)
-- 
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