diff options
author | Viswa Krishna Raveendra Talabattula <viswax.krishna.raveendra.talabattula@intel.com> | 2021-05-21 12:19:06 +0530 |
---|---|---|
committer | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-05-21 09:37:33 -0700 |
commit | d87087c321da07035d4f96d98c34e451b3ccb809 (patch) | |
tree | dea748a0cab315cbbe1ae0c4acaebea74a76396a /tests/i915/gem_userptr_blits.c | |
parent | a7016bde81f6e6ee9f2ded3c091c56766a6adc46 (diff) |
tests/i915: test pass for no caching case
The userptr memory does not support I915_CACHING_NONE(no caching) level
as per the below commit related to i915 in the kernel
commit 02b64a4a0cb14e414b0be3b7261edc4fabfc0e2c
Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date: Tue Mar 23 16:50:02 2021 +0100
drm/i915: Reject more ioctls for userptr, v2.
So lets make test pass for return value of -ENXIO and 0
Print warning of "Deprecated userptr SET_CACHING behavior" for older kernels
Signed-off-by: Viswa Krishna Raveendra Talabattula <viswax.krishna.raveendra.talabattula@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'tests/i915/gem_userptr_blits.c')
-rw-r--r-- | tests/i915/gem_userptr_blits.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c index aad5f141..2814e3c3 100644 --- a/tests/i915/gem_userptr_blits.c +++ b/tests/i915/gem_userptr_blits.c @@ -2016,6 +2016,7 @@ static void test_set_caching(int i915) }; uint32_t handle; void *page; + int ret; page = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); @@ -2032,15 +2033,37 @@ static void test_set_caching(int i915) for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) { gem_userptr(i915, page, 4096, 0, 0, &handle); - igt_assert_eq(__gem_set_caching(i915, handle, levels[idx]), 0); + ret = __gem_set_caching(i915, handle, levels[idx]); + if (levels[idx] == I915_CACHING_NONE) { + if(ret != 0) + igt_assert_eq(ret, -ENXIO); + else + igt_warn("Deprecated userptr SET_CACHING behavior\n"); + } else { + igt_assert_eq(ret, 0); + } gem_close(i915, handle); } gem_userptr(i915, page, 4096, 0, 0, &handle); - for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) - igt_assert_eq(__gem_set_caching(i915, handle, levels[idx]), 0); - for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) - igt_assert_eq(__gem_set_caching(i915, handle, levels[idx]), 0); + for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) { + ret = __gem_set_caching(i915, handle, levels[idx]); + if (levels[idx] == I915_CACHING_NONE) { + if (ret != 0) + igt_assert_eq(ret, -ENXIO); + } else { + igt_assert_eq(ret, 0); + } + } + for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) { + ret = __gem_set_caching(i915, handle, levels[idx]); + if (levels[idx] == I915_CACHING_NONE) { + if (ret != 0) + igt_assert_eq(ret, -ENXIO); + } else { + igt_assert_eq(ret, 0); + } + } gem_close(i915, handle); munmap(page, 4096); |