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: [igt-dev] [Intel-gfx] [PATCH i-g-t] i915/gem_ctx_shared: Check for a large enough hole in the GTT
Date: Mon, 17 Jun 2019 15:25:05 +0100 [thread overview]
Message-ID: <b2b26762-5c52-442a-2278-7588bb6190b4@linux.intel.com> (raw)
In-Reply-To: <20190617111457.9226-1-chris@chris-wilson.co.uk>
On 17/06/2019 12:14, Chris Wilson wrote:
> In the exec-shared-gtt test, we cheekily try to reference an object we
> placed in the GTT in an earlier execbuf (and avoid declaring it in the
> later call). For a global GTT, where there may be existing objects, we
> have to find a hole large enough to fit both and avoid and implicit
> guard pages.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110876
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> tests/i915/gem_ctx_shared.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/tests/i915/gem_ctx_shared.c b/tests/i915/gem_ctx_shared.c
> index ed43e8903..4b1020b96 100644
> --- a/tests/i915/gem_ctx_shared.c
> +++ b/tests/i915/gem_ctx_shared.c
> @@ -184,6 +184,7 @@ static void exhaust_shared_gtt(int i915, unsigned int flags)
> static void exec_shared_gtt(int i915, unsigned int ring)
> {
> const int gen = intel_gen(intel_get_drm_devid(i915));
> + const uint32_t bbe = MI_BATCH_BUFFER_END;
> struct drm_i915_gem_exec_object2 obj = {};
> struct drm_i915_gem_execbuffer2 execbuf = {
> .buffers_ptr = to_user_pointer(&obj),
> @@ -197,11 +198,19 @@ static void exec_shared_gtt(int i915, unsigned int ring)
> gem_require_ring(i915, ring);
> igt_require(gem_can_store_dword(i915, ring));
>
> + /* Find a hole big enough for both objects later */
> + scratch = gem_create(i915, 16384);
> + gem_write(i915, scratch, 0, &bbe, sizeof(bbe));
> + obj.handle = scratch;
> + gem_execbuf(i915, &execbuf);
> + gem_close(i915, scratch);
> + obj.flags |= EXEC_OBJECT_PINNED; /* reuse this address */
> +
> scratch = gem_create(i915, 4096);
> s = gem_mmap__cpu(i915, scratch, 0, 4096, PROT_WRITE);
>
> gem_set_domain(i915, scratch, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
> - *s = MI_BATCH_BUFFER_END;
> + *s = bbe;
>
> /* Load object into place in the GTT */
> obj.handle = scratch;
> @@ -224,11 +233,10 @@ static void exec_shared_gtt(int i915, unsigned int ring)
> batch[++i] = obj.offset;
> }
> batch[++i] = 0xc0ffee;
> - batch[++i] = MI_BATCH_BUFFER_END;
> + batch[++i] = bbe;
> gem_write(i915, obj.handle, 0, batch, sizeof(batch));
>
> - obj.offset += 4096; /* make sure we don't cause an eviction! */
> - obj.flags |= EXEC_OBJECT_PINNED;
> + obj.offset += 8192; /* make sure we don't cause an eviction! */
> execbuf.rsvd1 = gem_context_clone(i915, 0, I915_CONTEXT_CLONE_VM, 0);
> if (gen > 3 && gen < 6)
> execbuf.flags |= I915_EXEC_SECURE;
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-06-17 14:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 11:14 [igt-dev] [PATCH i-g-t] i915/gem_ctx_shared: Check for a large enough hole in the GTT Chris Wilson
2019-06-17 13:31 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-06-17 14:25 ` Tvrtko Ursulin [this message]
2019-06-17 20:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=b2b26762-5c52-442a-2278-7588bb6190b4@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