diff options
author | Eric Anholt <eric@anholt.net> | 2008-06-11 14:42:40 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2008-06-11 14:42:40 -0700 |
commit | 2655005762b8915d5f44d1d1ee7e6c2eb34841d7 (patch) | |
tree | 0144197d4c66b0812ee2b0b93554e09cc7ef3047 /tests | |
parent | 2a35d857b35c9d30d073e2372aa302cd999321ba (diff) |
[gem] Move potentially device-specific ioctls to the intel driver.
This is the create (may want location flags), pread/pwrite/mmap
(performance tuning hints), and set_domain (will 32 bits be enough for
everyone?) ioctls. Left in the generic set are just flink/open/close.
The 2D driver must be updated for this change, and API but not ABI is broken
for 3D. The driver version is bumped to mark this.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_basic.c | 9 | ||||
-rw-r--r-- | tests/gem_mmap.c | 19 | ||||
-rw-r--r-- | tests/gem_readwrite.c | 13 |
3 files changed, 22 insertions, 19 deletions
diff --git a/tests/gem_basic.c b/tests/gem_basic.c index 8b8b63d0..b2176fba 100644 --- a/tests/gem_basic.c +++ b/tests/gem_basic.c @@ -34,6 +34,7 @@ #include <errno.h> #include <sys/stat.h> #include "drm.h" +#include "i915_drm.h" static void test_bad_close(int fd) @@ -52,7 +53,7 @@ test_bad_close(int fd) static void test_create_close(int fd) { - struct drm_gem_create create; + struct drm_i915_gem_create create; struct drm_gem_close close; int ret; @@ -60,7 +61,7 @@ test_create_close(int fd) memset(&create, 0, sizeof(create)); create.size = 16 * 1024; - ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create); + ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); assert(ret == 0); close.handle = create.handle; @@ -70,14 +71,14 @@ test_create_close(int fd) static void test_create_fd_close(int fd) { - struct drm_gem_create create; + struct drm_i915_gem_create create; int ret; printf("Testing closing with an object allocated.\n"); memset(&create, 0, sizeof(create)); create.size = 16 * 1024; - ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create); + ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); assert(ret == 0); close(fd); diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c index 3f8e27a0..c3a51883 100644 --- a/tests/gem_mmap.c +++ b/tests/gem_mmap.c @@ -34,12 +34,13 @@ #include <errno.h> #include <sys/stat.h> #include "drm.h" +#include "i915_drm.h" #define OBJECT_SIZE 16384 int do_read(int fd, int handle, void *buf, int offset, int size) { - struct drm_gem_pread read; + struct drm_i915_gem_pread read; /* Ensure that we don't have any convenient data in buf in case * we fail. @@ -52,12 +53,12 @@ int do_read(int fd, int handle, void *buf, int offset, int size) read.size = size; read.offset = offset; - return ioctl(fd, DRM_IOCTL_GEM_PREAD, &read); + return ioctl(fd, DRM_IOCTL_I915_GEM_PREAD, &read); } int do_write(int fd, int handle, void *buf, int offset, int size) { - struct drm_gem_pwrite write; + struct drm_i915_gem_pwrite write; memset(&write, 0, sizeof(write)); write.handle = handle; @@ -65,14 +66,14 @@ int do_write(int fd, int handle, void *buf, int offset, int size) write.size = size; write.offset = offset; - return ioctl(fd, DRM_IOCTL_GEM_PWRITE, &write); + return ioctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &write); } int main(int argc, char **argv) { int fd; - struct drm_gem_create create; - struct drm_gem_mmap mmap; + struct drm_i915_gem_create create; + struct drm_i915_gem_mmap mmap; struct drm_gem_close unref; uint8_t expected[OBJECT_SIZE]; uint8_t buf[OBJECT_SIZE]; @@ -87,12 +88,12 @@ int main(int argc, char **argv) mmap.offset = 0; mmap.size = 4096; printf("Testing mmaping of bad object.\n"); - ret = ioctl(fd, DRM_IOCTL_GEM_MMAP, &mmap); + ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap); assert(ret == -1 && errno == EINVAL); memset(&create, 0, sizeof(create)); create.size = OBJECT_SIZE; - ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create); + ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); assert(ret == 0); handle = create.handle; @@ -100,7 +101,7 @@ int main(int argc, char **argv) mmap.handle = handle; mmap.offset = 0; mmap.size = OBJECT_SIZE; - ret = ioctl(fd, DRM_IOCTL_GEM_MMAP, &mmap); + ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap); assert(ret == 0); addr = (uint8_t *)(uintptr_t)mmap.addr_ptr; diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c index a48f9847..54b25ea3 100644 --- a/tests/gem_readwrite.c +++ b/tests/gem_readwrite.c @@ -34,12 +34,13 @@ #include <errno.h> #include <sys/stat.h> #include "drm.h" +#include "i915_drm.h" #define OBJECT_SIZE 16384 int do_read(int fd, int handle, void *buf, int offset, int size) { - struct drm_gem_pread read; + struct drm_i915_gem_pread read; /* Ensure that we don't have any convenient data in buf in case * we fail. @@ -52,12 +53,12 @@ int do_read(int fd, int handle, void *buf, int offset, int size) read.size = size; read.offset = offset; - return ioctl(fd, DRM_IOCTL_GEM_PREAD, &read); + return ioctl(fd, DRM_IOCTL_I915_GEM_PREAD, &read); } int do_write(int fd, int handle, void *buf, int offset, int size) { - struct drm_gem_pwrite write; + struct drm_i915_gem_pwrite write; memset(&write, 0, sizeof(write)); write.handle = handle; @@ -65,13 +66,13 @@ int do_write(int fd, int handle, void *buf, int offset, int size) write.size = size; write.offset = offset; - return ioctl(fd, DRM_IOCTL_GEM_PWRITE, &write); + return ioctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &write); } int main(int argc, char **argv) { int fd; - struct drm_gem_create create; + struct drm_i915_gem_create create; uint8_t expected[OBJECT_SIZE]; uint8_t buf[OBJECT_SIZE]; int ret; @@ -81,7 +82,7 @@ int main(int argc, char **argv) memset(&create, 0, sizeof(create)); create.size = OBJECT_SIZE; - ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create); + ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); assert(ret == 0); handle = create.handle; |