Skip to content

Commit

Permalink
drm/i915: Only switch to default context when evicting from GGTT
Browse files Browse the repository at this point in the history
The contexts only pin space within the global GTT. Therefore forcing the
switch to the perma-pinned kernel context only has an effect when trying
to evict from and find room within the global GTT. We can then restrict
the switch to only when operating on the default context. This is mostly
a no-op as full-ppgtt only exists with execlists at present which skips
the context switch anyway.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1466776558-21516-7-git-send-email-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Jun 24, 2016
1 parent 6e5a5be commit 883445d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions drivers/gpu/drm/i915/i915_gem_evict.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
if (pass++ == 0) {
struct drm_i915_private *dev_priv = to_i915(dev);

ret = switch_to_pinned_context(dev_priv);
if (ret)
return ret;
if (i915_is_ggtt(vm)) {
ret = switch_to_pinned_context(dev_priv);
if (ret)
return ret;
}

ret = i915_gem_wait_for_idle(dev_priv);
if (ret)
Expand Down Expand Up @@ -300,9 +302,11 @@ int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle)
if (do_idle) {
struct drm_i915_private *dev_priv = to_i915(vm->dev);

ret = switch_to_pinned_context(dev_priv);
if (ret)
return ret;
if (i915_is_ggtt(vm)) {
ret = switch_to_pinned_context(dev_priv);
if (ret)
return ret;
}

ret = i915_gem_wait_for_idle(dev_priv);
if (ret)
Expand Down

0 comments on commit 883445d

Please sign in to comment.