drm/i915: Export a function to flush the context upon pinning
For legacy contexts we employ an optimisation to only flush the context when binding into the global GTT. This avoids stalling on the GPU when reloading an active context. Wrap this detail up into a helper and export it for a potential third user. (Longer term, context pinning needs to be reworked as the current handling of switch context pins too late and so risks eviction and corrupting the request. Plans, plans, plans.) v2: Expand the comment explaining the optimisation for avoiding the stall on active contexts. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20161030132820.32163-1-chris@chris-wilson.co.uk Reviewed-by: Matthew Auld <matthew.auld@intel.com>
This commit is contained in:
@@ -1949,14 +1949,13 @@ static int intel_ring_context_pin(struct i915_gem_context *ctx,
|
||||
return 0;
|
||||
|
||||
if (ce->state) {
|
||||
ret = i915_gem_object_set_to_gtt_domain(ce->state->obj, false);
|
||||
if (ret)
|
||||
goto error;
|
||||
struct i915_vma *vma;
|
||||
|
||||
ret = i915_vma_pin(ce->state, 0, ctx->ggtt_alignment,
|
||||
PIN_GLOBAL | PIN_HIGH);
|
||||
if (ret)
|
||||
vma = i915_gem_context_pin_legacy(ctx, PIN_HIGH);
|
||||
if (IS_ERR(vma)) {
|
||||
ret = PTR_ERR(vma);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* The kernel context is only used as a placeholder for flushing the
|
||||
|
Reference in New Issue
Block a user