summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-10 15:31:11 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-10 15:31:11 +0100
commit319638ba6d38c25be0f6dadbab3f5855083234a1 (patch)
treec779bc7fd8b914513f02ce3fa98be9c51724d02d /lib
parent5dd17d3f4bddb075f3fb6fbcd1b6c271f7b746a7 (diff)
lib/drmtest: extract gem_write
Astonishing how many different function signatures are possible for something that simple. Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/drmtest.c14
-rw-r--r--lib/drmtest.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 6bf57c1f..d6e2540e 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -142,3 +142,17 @@ void gem_close(int fd, uint32_t handle)
ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
assert(ret == 0);
}
+
+void gem_write(int fd, uint32_t handle, uint32_t offset, const void *buf, uint32_t size)
+{
+ struct drm_i915_gem_pwrite gem_pwrite;
+ int ret;
+
+ gem_pwrite.handle = handle;
+ gem_pwrite.offset = offset;
+ gem_pwrite.size = size;
+ gem_pwrite.data_ptr = (uintptr_t)buf;
+ ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite);
+ assert(ret == 0);
+}
+
diff --git a/lib/drmtest.h b/lib/drmtest.h
index c2aaaeef..0e8e4757 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -39,3 +39,4 @@ int drm_open_any_master(void);
void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride);
void gem_close(int fd, uint32_t handle);
+void gem_write(int fd, uint32_t handle, uint32_t offset, const void *buf, uint32_t size);