[PATCH] i915: purge i915_gem_create_v2

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

 



The gem_create_v2 uapi was never merged, which would have been a nice
addition to allow userspace to utilise stolen memory. Since it can only
get in the way at this point, let's just remove it.

Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 lib/ioctl_wrappers.c    | 70 -------------------------------
 lib/ioctl_wrappers.h    |  3 --
 tests/i915/gem_create.c | 46 +++-----------------
 tests/i915/gem_pread.c  | 93 -----------------------------------------
 tests/i915/gem_pwrite.c | 43 -------------------
 5 files changed, 5 insertions(+), 250 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 61f93bd8..3781286d 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -469,76 +469,6 @@ void gem_sync(int fd, uint32_t handle)
 	errno = 0;
 }
 
-
-bool gem_create__has_stolen_support(int fd)
-{
-	int has_stolen_support;
-	struct drm_i915_getparam gp;
-	int val = -1;
-
-	memset(&gp, 0, sizeof(gp));
-	gp.param = 38; /* CREATE_VERSION */
-	gp.value = &val;
-
-	/* Do we have the extended gem_create_ioctl? */
-	ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-	has_stolen_support = val >= 2;
-
-	return has_stolen_support;
-}
-
-struct local_i915_gem_create_v2 {
-	uint64_t size;
-	uint32_t handle;
-	uint32_t pad;
-#define I915_CREATE_PLACEMENT_STOLEN (1<<0)
-	uint32_t flags;
-};
-
-#define LOCAL_IOCTL_I915_GEM_CREATE       DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct local_i915_gem_create_v2)
-uint32_t __gem_create_stolen(int fd, uint64_t size)
-{
-	struct local_i915_gem_create_v2 create;
-	int ret;
-
-	memset(&create, 0, sizeof(create));
-	create.handle = 0;
-	create.size = size;
-	create.flags = I915_CREATE_PLACEMENT_STOLEN;
-	ret = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create);
-
-	if (ret < 0)
-		return 0;
-
-	errno = 0;
-	return create.handle;
-}
-
-/**
- * gem_create_stolen:
- * @fd: open i915 drm file descriptor
- * @size: desired size of the buffer
- *
- * This wraps the new GEM_CREATE ioctl, which allocates a new gem buffer
- * object of @size and placement in stolen memory region.
- *
- * Returns: The file-private handle of the created buffer object
- */
-
-uint32_t gem_create_stolen(int fd, uint64_t size)
-{
-	struct local_i915_gem_create_v2 create;
-
-	memset(&create, 0, sizeof(create));
-	create.handle = 0;
-	create.size = size;
-	create.flags = I915_CREATE_PLACEMENT_STOLEN;
-	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create);
-	igt_assert(create.handle);
-
-	return create.handle;
-}
-
 int __gem_create(int fd, uint64_t size, uint32_t *handle)
 {
 	struct drm_i915_gem_create create = {
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 435fc813..870ac8b7 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -75,9 +75,6 @@ int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write);
 void gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write);
 int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns);
 void gem_sync(int fd, uint32_t handle);
-bool gem_create__has_stolen_support(int fd);
-uint32_t __gem_create_stolen(int fd, uint64_t size);
-uint32_t gem_create_stolen(int fd, uint64_t size);
 int __gem_create(int fd, uint64_t size, uint32_t *handle);
 uint32_t gem_create(int fd, uint64_t size);
 void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index e376f8ae..c7444d55 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -27,11 +27,8 @@
 
 /** @file gem_create.c
  *
- * This is a test for the extended and old gem_create ioctl, that
- * includes allocation of object from stolen memory and shmem.
- *
- * The goal is to simply ensure that basics work and invalid input
- * combinations are rejected.
+ * This is a test for the gem_create ioctl. The goal is to simply ensure that
+ * basics work and invalid input combinations are rejected.
  */
 
 #include <stdlib.h>
@@ -59,42 +56,12 @@
 #include "i915/gem_mman.h"
 #include "i915_drm.h"
 
-IGT_TEST_DESCRIPTION("This is a test for the extended & old gem_create ioctl,"
-		     " that includes allocation of object from stolen memory"
-		     " and shmem.");
+IGT_TEST_DESCRIPTION("This is a test for the gem_create ioctl,"
+		     " where the goal is to simply ensure that basics work"
+		     " and invalid input combinations are rejected.");
 
-#define CLEAR(s) memset(&s, 0, sizeof(s))
 #define PAGE_SIZE 4096
 
-struct local_i915_gem_create_v2 {
-	uint64_t size;
-	uint32_t handle;
-	uint32_t pad;
-#define I915_CREATE_PLACEMENT_STOLEN (1<<0)
-	uint32_t flags;
-} create_v2;
-
-#define LOCAL_IOCTL_I915_GEM_CREATE       DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct local_i915_gem_create_v2)
-
-static void invalid_flag_test(int fd)
-{
-	int ret;
-
-	gem_require_stolen_support(fd);
-
-	create_v2.handle = 0;
-	create_v2.size = PAGE_SIZE;
-	create_v2.flags = ~I915_CREATE_PLACEMENT_STOLEN;
-	ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create_v2);
-
-	igt_assert(ret <= 0);
-
-	create_v2.flags = ~0;
-	ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create_v2);
-
-	igt_assert(ret <= 0);
-}
-
 static int create_ioctl(int fd, struct drm_i915_gem_create *create)
 {
         int err = 0;
@@ -278,9 +245,6 @@ igt_main
 		fd = drm_open_driver(DRIVER_INTEL);
 	}
 
-	igt_subtest("stolen-invalid-flag")
-		invalid_flag_test(fd);
-
 	igt_subtest("create-invalid-size")
 		invalid_size_test(fd);
 
diff --git a/tests/i915/gem_pread.c b/tests/i915/gem_pread.c
index 5b926ab0..6d12b8e9 100644
--- a/tests/i915/gem_pread.c
+++ b/tests/i915/gem_pread.c
@@ -73,7 +73,6 @@ static void pread_self(int i915)
 }
 
 #define OBJECT_SIZE 16384
-#define LARGE_OBJECT_SIZE 1024 * 1024
 #define KGRN "\x1B[32m"
 #define KRED "\x1B[31m"
 #define KNRM "\x1B[0m"
@@ -110,10 +109,7 @@ static const char *bytes_per_sec(char *buf, double v)
 	return buf;
 }
 
-
 uint32_t *src, dst;
-uint32_t *dst_user, src_stolen, large_stolen;
-uint32_t *stolen_pf_user, *stolen_nopf_user;
 int fd, count;
 int object_size = 0;
 
@@ -156,8 +152,6 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)
 
 		dst = gem_create(fd, object_size);
 		src = malloc(object_size);
-		src_stolen = gem_create_stolen(fd, object_size);
-		dst_user = malloc(object_size);
 	}
 
 	igt_subtest("bench") {
@@ -197,96 +191,9 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)
 		}
 	}
 
-	igt_subtest("stolen-normal") {
-		gem_require_stolen_support(fd);
-		for (count = 1; count <= 1<<17; count <<= 1) {
-			struct timeval start, end;
-
-			gettimeofday(&start, NULL);
-			do_gem_read(fd, src_stolen, dst_user, object_size, count);
-			gettimeofday(&end, NULL);
-			usecs = elapsed(&start, &end, count);
-			bps = bytes_per_sec(buf, object_size/usecs*1e6);
-			igt_info("Time to pread %d bytes x %6d:	%7.3fµs, %s\n",
-				 object_size, count, usecs, bps);
-			fflush(stdout);
-		}
-	}
-	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) {
-				struct timeval start, end;
-
-				gettimeofday(&start, NULL);
-				do_gem_read(fd, src_stolen, dst_user,
-					    object_size, count);
-				gettimeofday(&end, NULL);
-				usecs = elapsed(&start, &end, count);
-				bps = bytes_per_sec(buf, object_size/usecs*1e6);
-				igt_info("Time to stolen-%s pread %d bytes x %6d:      %7.3fµs, %s\n",
-					 c->name, object_size, count, usecs, bps);
-				fflush(stdout);
-			}
-		}
-	}
-
-	/* List the time taken in pread operation for stolen objects, with
-	 * and without the overhead of page fault handling on accessing the
-	 * 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,
-						MAP_ANONYMOUS|MAP_PRIVATE,
-						-1, 0);
-		igt_assert(stolen_nopf_user);
-
-		for (count = 1; count <= 10; count ++) {
-			struct timeval start, end;
-			double t_elapsed = 0;
-
-			gettimeofday(&start, NULL);
-			do_gem_read(fd, large_stolen, stolen_nopf_user,
-				    LARGE_OBJECT_SIZE, 1);
-			gettimeofday(&end, NULL);
-			t_elapsed = elapsed(&start, &end, count);
-			bps = bytes_per_sec(buf, object_size/t_elapsed*1e6);
-			igt_info("Pagefault-N - Time to pread %d bytes: %7.3fµs, %s\n",
-				 LARGE_OBJECT_SIZE, t_elapsed, bps);
-
-			stolen_pf_user = (uint32_t *) mmap(NULL, LARGE_OBJECT_SIZE,
-						      PROT_WRITE,
-						      MAP_ANONYMOUS|MAP_PRIVATE,
-						      -1, 0);
-			igt_assert(stolen_pf_user);
-
-			gettimeofday(&start, NULL);
-			do_gem_read(fd, large_stolen, stolen_pf_user,
-				    LARGE_OBJECT_SIZE, 1);
-			gettimeofday(&end, NULL);
-			usecs = elapsed(&start, &end, count);
-			bps = bytes_per_sec(buf, object_size/usecs*1e6);
-			igt_info("Pagefault-Y - Time to pread %d bytes: %7.3fµs, %s%s%s\n",
-				 LARGE_OBJECT_SIZE, usecs,
-				 t_elapsed < usecs ? KGRN : KRED, bps, KNRM);
-			fflush(stdout);
-			munmap(stolen_pf_user, LARGE_OBJECT_SIZE);
-		}
-		munmap(stolen_nopf_user, LARGE_OBJECT_SIZE);
-		gem_close(fd, large_stolen);
-	}
-
-
 	igt_fixture {
 		free(src);
 		gem_close(fd, dst);
-		free(dst_user);
-		gem_close(fd, src_stolen);
 
 		close(fd);
 	}
diff --git a/tests/i915/gem_pwrite.c b/tests/i915/gem_pwrite.c
index 20e9728b..e491263f 100644
--- a/tests/i915/gem_pwrite.c
+++ b/tests/i915/gem_pwrite.c
@@ -277,7 +277,6 @@ static void test_random(int fd)
 }
 
 uint32_t *src, dst;
-uint32_t *src_user, dst_stolen;
 int fd;
 int object_size = 0;
 
@@ -321,8 +320,6 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)
 
 		dst = gem_create(fd, object_size);
 		src = malloc(object_size);
-		dst_stolen = gem_create_stolen(fd, object_size);
-		src_user = malloc(object_size);
 	}
 
 	igt_subtest("bench") {
@@ -362,49 +359,9 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)
 		}
 	}
 
-	igt_subtest("stolen-normal") {
-		gem_require_stolen_support(fd);
-		for (count = 1; count <= 1<<17; count <<= 1) {
-			struct timeval start, end;
-
-			gettimeofday(&start, NULL);
-			do_gem_write(fd, dst_stolen, src_user,
-				     object_size, count);
-			gettimeofday(&end, NULL);
-			usecs = elapsed(&start, &end, count);
-			bps = bytes_per_sec(buf, object_size/usecs*1e6);
-			igt_info("Time to pwrite %d bytes x %6d:        %7.3fµs, %s\n",
-				 object_size, count, usecs, bps);
-			fflush(stdout);
-		}
-	}
-
-	for (c = cache; c->level != -1; c++) {
-		igt_subtest_f("stolen-%s", c->name) {
-			gem_require_stolen_support(fd);
-			gem_set_caching(fd, dst, c->level);
-			for (count = 1; count <= 1<<17; count <<= 1) {
-				struct timeval start, end;
-
-				gettimeofday(&start, NULL);
-				do_gem_write(fd, dst_stolen, src_user,
-					     object_size, count);
-				gettimeofday(&end, NULL);
-				bps = bytes_per_sec(buf,
-						    object_size/usecs*1e6);
-				igt_info("Time to stolen-%s pwrite %d bytes x %6d:     %7.3fµs, %s\n",
-					 c->name, object_size, count,
-					 usecs, bps);
-				fflush(stdout);
-			}
-		}
-	}
-
 	igt_fixture {
 		free(src);
 		gem_close(fd, dst);
-		free(src_user);
-		gem_close(fd, dst_stolen);
 	}
 
 	igt_subtest_f("basic-random")
-- 
2.26.2

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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux