[igt-dev] [PATCH i-g-t] tests/i915/gem_userptr_blits: Update for discrete

priyanka.dandamudi at intel.com priyanka.dandamudi at intel.com
Fri Oct 22 10:31:50 UTC 2021


From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>

The set_caching ioctl returns -ENODEV for discrete.
Update the relocations and set-cache-level subtest.

Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
Cc: Matthew Auld <matthew.auld at intel.com>
---
 tests/i915/gem_userptr_blits.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 93e4b25b..3d99aa2e 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1111,8 +1111,12 @@ static void test_relocations(int fd)
 	memset(&obj, 0, sizeof(obj));
 	igt_assert(posix_memalign(&ptr, PAGE_SIZE, size) == 0);
 	gem_userptr(fd, ptr, size, 0, userptr_flags, &obj.handle);
-	if (!gem_has_llc(fd))
-		gem_set_caching(fd, obj.handle, 0);
+	if (!gem_has_llc(fd)){
+		int err;
+		int expect = gem_has_lmem(fd) ? -ENODEV : 0;
+		err = __gem_set_caching(fd, obj.handle, 0);
+		igt_require(err == expect);
+		}
 	*(uint32_t *)ptr = MI_BATCH_BUFFER_END;
 
 	reloc = (typeof(reloc))((char *)ptr + PAGE_SIZE);
@@ -2064,7 +2068,9 @@ static void test_set_caching(int i915)
 	for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) {
 		gem_userptr(i915, page, 4096, 0, 0, &handle);
 		ret = __gem_set_caching(i915, handle, levels[idx]);
-		if (levels[idx] == I915_CACHING_NONE) {
+		if (gem_has_lmem(i915))
+			igt_assert_eq(ret, -ENODEV);
+		else if (levels[idx] == I915_CACHING_NONE) {
 			if(ret != 0)
 				igt_assert_eq(ret, -ENXIO);
 			else
@@ -2078,7 +2084,9 @@ static void test_set_caching(int i915)
 	gem_userptr(i915, page, 4096, 0, 0, &handle);
 	for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) {
 		ret = __gem_set_caching(i915, handle, levels[idx]);
-		if (levels[idx] == I915_CACHING_NONE) {
+		if (gem_has_lmem(i915))
+                        igt_assert_eq(ret, -ENODEV);
+		else if (levels[idx] == I915_CACHING_NONE) {
 			if (ret != 0)
 			        igt_assert_eq(ret, -ENXIO);
 		} else {
@@ -2087,7 +2095,9 @@ static void test_set_caching(int i915)
 	}
 	for (int idx = 0; idx < ARRAY_SIZE(levels); idx++) {
 		ret = __gem_set_caching(i915, handle, levels[idx]);
-		if (levels[idx] == I915_CACHING_NONE) {
+		if (gem_has_lmem(i915))
+                        igt_assert_eq(ret, -ENODEV);
+		else if (levels[idx] == I915_CACHING_NONE) {
 			if (ret != 0)
 				igt_assert_eq(ret, -ENXIO);
 		} else {
-- 
2.25.1



More information about the igt-dev mailing list