From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_spin_batch: Check for userptr before use Date: Tue, 5 Jan 2021 21:26:06 +0000 [thread overview] Message-ID: <20210105212606.3399854-2-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20210105212606.3399854-1-chris@chris-wilson.co.uk> If the device cannot handle coherent memory, it will disallow userptr. Check before use. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2904 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_spin_batch.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c index c2ce2373b..2ec278857 100644 --- a/tests/i915/gem_spin_batch.c +++ b/tests/i915/gem_spin_batch.c @@ -176,6 +176,25 @@ static void spin_all(int i915, unsigned int flags) } } +static bool has_userptr(int fd) +{ + struct drm_i915_gem_userptr userptr; + int err; + + memset(&userptr, 0, sizeof(userptr)); + userptr.user_size = 8192; + userptr.user_ptr = -4096; + + err = 0; + if (drmIoctl(fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr)) { + err = errno; + igt_assume(err); + } + errno = 0; + + return err == EFAULT; +} + igt_main { const struct intel_execution_engine2 *e2; @@ -235,8 +254,10 @@ igt_main igt_subtest("spin-each") spin_on_all_engines(fd, 0, 3); - igt_subtest("user-each") + igt_subtest("user-each") { + igt_require(has_userptr(fd)); spin_on_all_engines(fd, IGT_SPIN_USERPTR, 3); + } igt_fixture { igt_stop_hang_detector(); -- 2.30.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk> Subject: [igt-dev] [PATCH i-g-t 2/2] i915/gem_spin_batch: Check for userptr before use Date: Tue, 5 Jan 2021 21:26:06 +0000 [thread overview] Message-ID: <20210105212606.3399854-2-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20210105212606.3399854-1-chris@chris-wilson.co.uk> If the device cannot handle coherent memory, it will disallow userptr. Check before use. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2904 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_spin_batch.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c index c2ce2373b..2ec278857 100644 --- a/tests/i915/gem_spin_batch.c +++ b/tests/i915/gem_spin_batch.c @@ -176,6 +176,25 @@ static void spin_all(int i915, unsigned int flags) } } +static bool has_userptr(int fd) +{ + struct drm_i915_gem_userptr userptr; + int err; + + memset(&userptr, 0, sizeof(userptr)); + userptr.user_size = 8192; + userptr.user_ptr = -4096; + + err = 0; + if (drmIoctl(fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr)) { + err = errno; + igt_assume(err); + } + errno = 0; + + return err == EFAULT; +} + igt_main { const struct intel_execution_engine2 *e2; @@ -235,8 +254,10 @@ igt_main igt_subtest("spin-each") spin_on_all_engines(fd, 0, 3); - igt_subtest("user-each") + igt_subtest("user-each") { + igt_require(has_userptr(fd)); spin_on_all_engines(fd, IGT_SPIN_USERPTR, 3); + } igt_fixture { igt_stop_hang_detector(); -- 2.30.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2021-01-05 21:26 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-05 21:26 [Intel-gfx] [PATCH i-g-t 1/2] lib: Immediately cancel a spinner for an expired timeout Chris Wilson 2021-01-05 21:26 ` [igt-dev] " Chris Wilson 2021-01-05 21:26 ` Chris Wilson [this message] 2021-01-05 21:26 ` [igt-dev] [PATCH i-g-t 2/2] i915/gem_spin_batch: Check for userptr before use Chris Wilson 2021-01-05 22:44 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib: Immediately cancel a spinner for an expired timeout Patchwork 2021-01-06 1:33 ` [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=20210105212606.3399854-2-chris@chris-wilson.co.uk \ --to=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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.