[PATCH 2/2] igt/gem_stolen: No support for stolen backed objects if Intel RST present

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ankitprasad Sharma <ankitprasad.r.sharma@xxxxxxxxx>

Skip gem_stolen and pread/pwrite on stolen backed objects if Intel
RST device is present.

Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@xxxxxxxxx>
---
 lib/ioctl_wrappers.c | 14 +++++++++++++-
 tests/gem_pread.c    |  3 +++
 tests/gem_pwrite.c   |  2 ++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 4071260..e5ee7ea 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -415,6 +415,18 @@ void gem_sync(int fd, uint32_t handle)
 	errno = 0;
 }
 
+/* Is the Intel RST device present */
+#define RST_PATH "/sys/bus/acpi/devices/INT3392:00"
+
+static bool is_rst_present(void)
+{
+	struct stat st;
+
+	if (stat(RST_PATH, &st) == 0)
+		return true;
+
+	return false;
+}
 
 bool gem_create__has_stolen_support(int fd)
 {
@@ -429,7 +441,7 @@ bool gem_create__has_stolen_support(int fd)
 
 		/* Do we have the extended gem_create_ioctl? */
 		ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-		has_stolen_support = val >= 2;
+		has_stolen_support = val >= 2 && !is_rst_present();
 	}
 
 	return has_stolen_support;
diff --git a/tests/gem_pread.c b/tests/gem_pread.c
index afa072d..f4cf472 100644
--- a/tests/gem_pread.c
+++ b/tests/gem_pread.c
@@ -152,6 +152,7 @@ int main(int argc, char **argv)
 	}
 
 	igt_subtest("stolen-normal") {
+		gem_require_stolen_support(fd);
 		for (count = 1; count <= 1<<17; count <<= 1) {
 			struct timeval start, end;
 
@@ -167,6 +168,7 @@ int main(int argc, char **argv)
 	}
 	for (c = cache; c->level != -1; c++) {
 		igt_subtest_f("stolen-%s", c->name) {
+			gem_require_stolen_support(fd);
 			gem_set_caching(fd, src_stolen, c->level);
 
 			for (count = 1; count <= 1<<17; count <<= 1) {
@@ -190,6 +192,7 @@ int main(int argc, char **argv)
 	 * user space buffer
 	 */
 	igt_subtest("pagefault-pread") {
+		gem_require_stolen_support(fd);
 		large_stolen = gem_create_stolen(fd, LARGE_OBJECT_SIZE);
 		stolen_nopf_user = (uint32_t *) mmap(NULL, LARGE_OBJECT_SIZE,
 						PROT_WRITE,
diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
index 42206d7..5d99b29 100644
--- a/tests/gem_pwrite.c
+++ b/tests/gem_pwrite.c
@@ -206,6 +206,7 @@ int main(int argc, char **argv)
 	}
 
 	igt_subtest("stolen-normal") {
+		gem_require_stolen_support(fd);
 		for (count = 1; count <= 1<<17; count <<= 1) {
 			struct timeval start, end;
 
@@ -222,6 +223,7 @@ int main(int argc, char **argv)
 	}
 
 	for (c = cache; c->level != -1; c++) {
+		gem_require_stolen_support(fd);
 		igt_subtest_f("stolen-%s", c->name) {
 			gem_set_caching(fd, dst, c->level);
 			for (count = 1; count <= 1<<17; count <<= 1) {
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux