@@ -640,6 +640,24 @@ static int do_switch_xcs(struct intel_engine_cs *ring,
return 0;
}
+static void remap_l3(struct intel_engine_cs *ring,
+ struct intel_context *ctx)
+{
+ int ret, i;
+
+ for (i = 0; i < MAX_L3_SLICES; i++) {
+ if (!(ctx->remap_slice & (1<<i)))
+ continue;
+
+ ret = i915_gem_l3_remap(ring, i);
+ /* If it failed, try again next round */
+ if (ret)
+ DRM_DEBUG_DRIVER("L3 remapping failed\n");
+ else
+ ctx->remap_slice &= ~(1<<i);
+ }
+}
+
static int do_switch_rcs(struct intel_engine_cs *ring,
struct intel_context *from,
struct intel_context *to)
@@ -648,7 +666,7 @@ static int do_switch_rcs(struct intel_engine_cs *ring,
struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to);
u32 hw_flags = 0;
bool uninitialized = false;
- int ret, i;
+ int ret;
if (from != NULL) {
BUG_ON(from->legacy_hw_ctx.rcs_state == NULL);
@@ -699,17 +717,7 @@ static int do_switch_rcs(struct intel_engine_cs *ring,
if (ret)
goto unpin_out;
- for (i = 0; i < MAX_L3_SLICES; i++) {
- if (!(to->remap_slice & (1<<i)))
- continue;
-
- ret = i915_gem_l3_remap(ring, i);
- /* If it failed, try again next round */
- if (ret)
- DRM_DEBUG_DRIVER("L3 remapping failed\n");
- else
- to->remap_slice &= ~(1<<i);
- }
+ remap_l3(ring, to);
/* The backing object for the context is done after switching to the
* *next* context. Therefore we cannot retire the previous context until
This is just a cosmetic change to try to put do_switch_rcs on a diet. As it stands, the function was quite complex, and error prone. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_gem_context.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)