diff mbox

[RFC,i-g-t,6/6] lib/ioctl_wrappers: drop stolen memory related wrappers

Message ID 1506985218-28880-7-git-send-email-daniele.ceraolospurio@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniele Ceraolo Spurio Oct. 2, 2017, 11 p.m. UTC
The feature was never merged and there has been no progress in the
last year. The wrappers are using a wrong ioctl number (38 is
HAS_POOLED_EU and not CREATE_VERSION) and extensions of the
gem_create and get_aperture ioctl structures that never made it into
the kernel.
Tests that were using the wrappers have already been removed by previous
patches so it is now safe to remove the wrappers themselves.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 lib/ioctl_wrappers.c | 119 ---------------------------------------------------
 lib/ioctl_wrappers.h |  16 -------
 2 files changed, 135 deletions(-)
diff mbox

Patch

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 51b6b7b..fdf6cc5 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -479,79 +479,6 @@  void gem_sync(int fd, uint32_t handle)
 	errno = 0;
 }
 
-
-bool gem_create__has_stolen_support(int fd)
-{
-	static int has_stolen_support = -1;
-	struct drm_i915_getparam gp;
-	int val = -1;
-
-	if (has_stolen_support < 0) {
-		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;
-}
-
-
 uint32_t __gem_create(int fd, int size)
 {
 	struct drm_i915_gem_create create;
@@ -1378,52 +1305,6 @@  bool gem_has_bsd2(int fd)
 		has_bsd2 = has_param(fd, LOCAL_I915_PARAM_HAS_BSD2);
 	return has_bsd2;
 }
-
-struct local_i915_gem_get_aperture {
-	__u64 aper_size;
-	__u64 aper_available_size;
-	__u64 version;
-	__u64 map_total_size;
-	__u64 stolen_total_size;
-};
-#define DRM_I915_GEM_GET_APERTURE	0x23
-#define LOCAL_IOCTL_I915_GEM_GET_APERTURE DRM_IOR  (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct local_i915_gem_get_aperture)
-/**
- * gem_total_mappable_size:
- * @fd: open i915 drm file descriptor
- *
- * Feature test macro to query the kernel for the total mappable size.
- *
- * Returns: Total mappable address space size.
- */
-uint64_t gem_total_mappable_size(int fd)
-{
-	struct local_i915_gem_get_aperture aperture;
-
-	memset(&aperture, 0, sizeof(aperture));
-	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture);
-
-	return aperture.map_total_size;
-}
-
-/**
- * gem_total_stolen_size:
- * @fd: open i915 drm file descriptor
- *
- * Feature test macro to query the kernel for the total stolen size.
- *
- * Returns: Total stolen memory.
- */
-uint64_t gem_total_stolen_size(int fd)
-{
-	struct local_i915_gem_get_aperture aperture;
-
-	memset(&aperture, 0, sizeof(aperture));
-	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture);
-
-	return aperture.stolen_total_size;
-}
-
 /**
  * gem_available_aperture_size:
  * @fd: open i915 drm file descriptor
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 090c125..008747a 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -70,9 +70,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);
 uint32_t __gem_create(int fd, int size);
 uint32_t gem_create(int fd, uint64_t size);
 void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
@@ -97,17 +94,6 @@  void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, un
 int gem_munmap(void *ptr, uint64_t size);
 
 /**
- * gem_require_stolen_support:
- * @fd: open i915 drm file descriptor
- *
- * Test macro to query whether support for allocating objects from stolen
- * memory is available. Automatically skips through igt_require() if not.
- */
-#define gem_require_stolen_support(fd) \
-			igt_require(gem_create__has_stolen_support(fd) && \
-				    (gem_total_stolen_size(fd) > 0))
-
-/**
  * gem_require_mmap_wc:
  * @fd: open i915 drm file descriptor
  *
@@ -171,8 +157,6 @@  int gem_gpu_reset_type(int fd);
 bool gem_gpu_reset_enabled(int fd);
 bool gem_engine_reset_enabled(int fd);
 int gem_available_fences(int fd);
-uint64_t gem_total_mappable_size(int fd);
-uint64_t gem_total_stolen_size(int fd);
 uint64_t gem_available_aperture_size(int fd);
 uint64_t gem_aperture_size(int fd);
 uint64_t gem_global_aperture_size(int fd);