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

ankitprasad.r.sharma at intel.com ankitprasad.r.sharma at intel.com
Thu Mar 17 06:22:50 UTC 2016


From: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>

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

Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
---
 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



More information about the Intel-gfx mailing list