igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] igt/prime_vgem: Ask the shrinker to purge a vgem bo from inside i915
Date: Wed, 8 Aug 2018 13:45:39 +0100	[thread overview]
Message-ID: <c95afedb-fb99-6469-0bef-cf317607acbe@linux.intel.com> (raw)
In-Reply-To: <20180807154414.25773-1-chris@chris-wilson.co.uk>


On 07/08/2018 16:44, Chris Wilson wrote:
> Link a vgem dmabuf into an i915 bo and then ask the i915 shrinker to
> purge/invalidate its pages. This should establish the lockdep link from
> the fs_reclaim shrinker section to whatever locks are used to
> acquire/release dmabuf mappings; if any are required ofc.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>   tests/prime_vgem.c | 29 +++++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
> 
> diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
> index d886044a4..3b3dcc910 100644
> --- a/tests/prime_vgem.c
> +++ b/tests/prime_vgem.c
> @@ -237,6 +237,32 @@ static void test_gtt(int vgem, int i915)
>   	gem_close(vgem, scratch.handle);
>   }
>   
> +static void test_shrink(int vgem, int i915)
> +{
> +	struct vgem_bo scratch = {
> +		.width = 1024,
> +		.height = 1024,
> +		.bpp = 32
> +	};
> +	int dmabuf;
> +
> +	vgem_create(vgem, &scratch);
> +
> +	dmabuf = prime_handle_to_fd(vgem, scratch.handle);
> +	gem_close(vgem, scratch.handle);
> +
> +	scratch.handle = prime_fd_to_handle(i915, dmabuf);
> +	close(dmabuf);
> +
> +	/* Populate the i915_bo->pages. */
> +	gem_set_domain(i915, scratch.handle, I915_GEM_DOMAIN_GTT, 0);
> +
> +	/* Now evict them, establising the link from i915:shrinker to vgem. */
> +	igt_drop_caches_set(i915, DROP_SHRINK_ALL);
> +
> +	gem_close(i915, scratch.handle);
> +}
> +
>   static bool is_coherent(int i915)
>   {
>   	int val = 1; /* by default, we assume GTT is coherent, hence the test */
> @@ -794,6 +820,9 @@ igt_main
>   	igt_subtest("basic-gtt")
>   		test_gtt(vgem, i915);
>   
> +	igt_subtest("shrink")
> +		test_shrink(vgem, i915);
> +
>   	igt_subtest("coherency-gtt")
>   		test_gtt_interleaved(vgem, i915);
>   
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2018-08-08 12:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 15:44 [Intel-gfx] [PATCH i-g-t] igt/prime_vgem: Ask the shrinker to purge a vgem bo from inside i915 Chris Wilson
2018-08-07 16:10 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-08-08 12:45 ` Tvrtko Ursulin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c95afedb-fb99-6469-0bef-cf317607acbe@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).