[Intel-gfx] [PATCH 10/11] drm/i915/gtt: Only keep gen6 page directories pinned while active

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Jun 5 08:42:16 UTC 2018


Quoting Chris Wilson (2018-06-05 10:19:48)
> In order to be able to evict the gen6 ppgtt, we have to unpin it at some
> point. We can simply use our context activity tracking to know when the
> ppgtt is no longer in use by hardware, and so only keep it pinned while
> being used a request.
> 
> For the kernel_context (and thus aliasing_ppgtt), it remains pinned at
> all times, as the kernel_context itself is pinned at all times.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> Cc: Matthew Auld <matthew.william.auld at gmail.com>

<SNIP>

> @@ -1321,6 +1344,10 @@ __ring_context_pin(struct intel_engine_cs *engine,
>                 ce->state->obj->pin_global++;
>         }
>  
> +       err = __context_pin_ppgtt(ce->gem_context);
> +       if (err)
> +               goto err_unpin;
> +
>         i915_gem_context_get(ctx);
>  
>         /* One ringbuffer to rule them all */
> @@ -1329,6 +1356,9 @@ __ring_context_pin(struct intel_engine_cs *engine,
>  
>         return ce;
>  
> +err_unpin:
> +       if (ce->state)
> +               i915_vma_unpin(ce->state);

Adding __context_unpin and calling it here might cause less confusion.

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

Regards, Joonas

>  err:
>         ce->pin_count = 0;
>         return ERR_PTR(err);
> -- 
> 2.17.1
> 


More information about the Intel-gfx mailing list