Re: [igt-dev] [PATCH i-g-t] tests/i915/gem_exec_basic: Skip subtest gtt if gtt mapping is unavailable

Dixit, Ashutosh
2020-01-31T05:25:10Z

On Thu, 30 Jan 2020 16:15:16 -0800, Antonio Argenziano wrote:
>
> The subtest tries to do a gtt mapping but if there is no mappable
> aperture that is not possible.
>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> ---
> tests/i915/gem_exec_basic.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/i915/gem_exec_basic.c b/tests/i915/gem_exec_basic.c
> index 70dce34b..08336168 100644
> --- a/tests/i915/gem_exec_basic.c
> +++ b/tests/i915/gem_exec_basic.c
> @@ -93,6 +93,7 @@ static void gtt(int fd, uint64_t flags)
> struct drm_i915_gem_exec_object2 *exec;
> uint32_t handle;
>
> + gem_require_mappable_ggtt(fd);
> gem_require_ring(fd, flags);
>
> handle = gem_create(fd, 4096);

Since the test is not really using any tiling features of the ggtt perhaps
no need to skip? Instead how about this:

diff --git a/tests/i915/gem_exec_basic.c b/tests/i915/gem_exec_basic.c
index 70dce34b5..73921c1b3 100644
--- a/tests/i915/gem_exec_basic.c
+++ b/tests/i915/gem_exec_basic.c
@@ -98,7 +98,10 @@ static void gtt(int fd, uint64_t flags)
handle = gem_create(fd, 4096);

gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
- execbuf = gem_mmap__gtt(fd, handle, 4096, PROT_WRITE);
+ if (gem_has_mappable_ggtt(fd))
+ execbuf = gem_mmap__gtt(fd, handle, 4096, PROT_WRITE);
+ else
+ execbuf = gem_mmap__device_coherent(fd, handle, 0, 4096, PROT_WRITE);
exec = (struct drm_i915_gem_exec_object2 *)(execbuf + 1);
gem_close(fd, handle);