aboutsummaryrefslogtreecommitdiff
path: root/tests/gem_mmap.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-06-11 14:42:40 -0700
committerEric Anholt <eric@anholt.net>2008-06-11 14:42:40 -0700
commit2655005762b8915d5f44d1d1ee7e6c2eb34841d7 (patch)
tree0144197d4c66b0812ee2b0b93554e09cc7ef3047 /tests/gem_mmap.c
parent2a35d857b35c9d30d073e2372aa302cd999321ba (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/gem_mmap.c')
-rw-r--r--tests/gem_mmap.c19
1 files changed, 10 insertions, 9 deletions
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;