Commit 72b72ae4 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Always pin contexts into the high GGTT

Now that we have fast top-down insertion into the drm_mm, we can use it
for frequent runtime operations like insertion of the context object,
whereas before we limited it to the one-off insertion of the pinned
kernel context. Keeping the active context objects out of the mappable
region of the global GTT (except under memory pressure) improves our
ability to allocate mappable aperture region without triggering a GPU
stall.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170210101422.1598-1-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
parent 370a81fb
...@@ -773,11 +773,9 @@ static int execlists_context_pin(struct intel_engine_cs *engine, ...@@ -773,11 +773,9 @@ static int execlists_context_pin(struct intel_engine_cs *engine,
} }
GEM_BUG_ON(!ce->state); GEM_BUG_ON(!ce->state);
flags = PIN_GLOBAL; flags = PIN_GLOBAL | PIN_HIGH;
if (ctx->ggtt_offset_bias) if (ctx->ggtt_offset_bias)
flags |= PIN_OFFSET_BIAS | ctx->ggtt_offset_bias; flags |= PIN_OFFSET_BIAS | ctx->ggtt_offset_bias;
if (i915_gem_context_is_kernel(ctx))
flags |= PIN_HIGH;
ret = i915_vma_pin(ce->state, 0, GEN8_LR_CONTEXT_ALIGN, flags); ret = i915_vma_pin(ce->state, 0, GEN8_LR_CONTEXT_ALIGN, flags);
if (ret) if (ret)
......
...@@ -2004,7 +2004,7 @@ intel_ring_free(struct intel_ring *ring) ...@@ -2004,7 +2004,7 @@ intel_ring_free(struct intel_ring *ring)
kfree(ring); kfree(ring);
} }
static int context_pin(struct i915_gem_context *ctx, unsigned int flags) static int context_pin(struct i915_gem_context *ctx)
{ {
struct i915_vma *vma = ctx->engine[RCS].state; struct i915_vma *vma = ctx->engine[RCS].state;
int ret; int ret;
...@@ -2019,7 +2019,7 @@ static int context_pin(struct i915_gem_context *ctx, unsigned int flags) ...@@ -2019,7 +2019,7 @@ static int context_pin(struct i915_gem_context *ctx, unsigned int flags)
return ret; return ret;
} }
return i915_vma_pin(vma, 0, ctx->ggtt_alignment, PIN_GLOBAL | flags); return i915_vma_pin(vma, 0, ctx->ggtt_alignment, PIN_GLOBAL | PIN_HIGH);
} }
static int intel_ring_context_pin(struct intel_engine_cs *engine, static int intel_ring_context_pin(struct intel_engine_cs *engine,
...@@ -2034,13 +2034,7 @@ static int intel_ring_context_pin(struct intel_engine_cs *engine, ...@@ -2034,13 +2034,7 @@ static int intel_ring_context_pin(struct intel_engine_cs *engine,
return 0; return 0;
if (ce->state) { if (ce->state) {
unsigned int flags; ret = context_pin(ctx);
flags = 0;
if (i915_gem_context_is_kernel(ctx))
flags = PIN_HIGH;
ret = context_pin(ctx, flags);
if (ret) if (ret)
goto error; goto error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment