[Intel-gfx] [PATCH v3 07/10] drm/i915: Only switch to default context when evicting from GGTT

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Thu May 26 11:33:38 UTC 2016


On to, 2016-05-26 at 09:52 +0100, Chris Wilson wrote:
> 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.
> 

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem_evict.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
> index 5741b58d186c..3c1280ec7ff6 100644
> --- a/drivers/gpu/drm/i915/i915_gem_evict.c
> +++ b/drivers/gpu/drm/i915/i915_gem_evict.c
> @@ -183,9 +183,11 @@ none:
>  	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)
> @@ -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)
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list