[igt-dev] [PATCH i-g-t 2/6] i915/gem_ctx_shared: Prebind both context images

Andi Shyti andi.shyti at intel.com
Tue Sep 3 15:25:06 UTC 2019


Hi Chris,

On Mon, Sep 02, 2019 at 05:15:44AM +0100, Chris Wilson wrote:
> If we are using an aliasing-ppgtt, the context images are in the same
> virtual address space as our target objects. We have to be careful that
> cloning and using a new context does not evict our unreferenced target
> object. To avoid that, we first bind both context images while creating
> the hole in the address space to ensure that the hole is still available
> later on.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  tests/i915/gem_ctx_shared.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/i915/gem_ctx_shared.c b/tests/i915/gem_ctx_shared.c
> index b073bdfc9..c9e7b8a1a 100644
> --- a/tests/i915/gem_ctx_shared.c
> +++ b/tests/i915/gem_ctx_shared.c
> @@ -191,6 +191,7 @@ static void exec_shared_gtt(int i915, unsigned int ring)
>  		.buffer_count = 1,
>  		.flags = ring,
>  	};
> +	uint32_t clone;
>  	uint32_t scratch, *s;
>  	uint32_t batch, cs[16];
>  	uint64_t offset;
> @@ -199,13 +200,18 @@ static void exec_shared_gtt(int i915, unsigned int ring)
>  	gem_require_ring(i915, ring);
>  	igt_require(gem_can_store_dword(i915, ring));
>  
> +	clone = gem_context_clone(i915, 0, I915_CONTEXT_CLONE_VM, 0);
> +
>  	/* Find a hole big enough for both objects later */
> -	scratch = gem_create(i915, 16384);
> +	scratch = gem_create(i915, 64<<10);

I guess this is a leftover, right?

Reviewed-by: Andi Shyti <andi.shyti at intel.com>

Andi


More information about the igt-dev mailing list