summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-10 18:29:30 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-10 18:30:39 +0100
commit7a6042e87ef3dee2df06b1666fb8af6889ac35b8 (patch)
tree162f8da719c6ba9a67f328b17deda62005f549ea /tests
parent73d1b88129cdcf6fa250b6fb8e198fdfc2d70e04 (diff)
lib/drmtest: extract gem_create
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests')
-rw-r--r--tests/gem_bad_length.c6
-rw-r--r--tests/gem_exec_blt.c11
-rw-r--r--tests/gem_exec_faulting_reloc.c11
-rw-r--r--tests/gem_exec_nop.c11
-rw-r--r--tests/gem_gtt_speed.c11
-rw-r--r--tests/gem_linear_blits.c12
-rw-r--r--tests/gem_mmap_gtt.c13
-rw-r--r--tests/gem_pwrite.c11
-rw-r--r--tests/gem_tiled_pread.c12
-rw-r--r--tests/gem_tiled_pread_pwrite.c12
-rw-r--r--tests/gem_vmap_blits.c12
-rw-r--r--tests/gen3_mixed_blits.c12
-rw-r--r--tests/gen3_render_linear_blits.c12
-rw-r--r--tests/gen3_render_mixed_blits.c12
-rw-r--r--tests/gen3_render_tiledx_blits.c12
-rw-r--r--tests/gen3_render_tiledy_blits.c12
-rw-r--r--tests/testdisplay.c12
17 files changed, 4 insertions, 190 deletions
diff --git a/tests/gem_bad_length.c b/tests/gem_bad_length.c
index 2cc5187b..512effa3 100644
--- a/tests/gem_bad_length.c
+++ b/tests/gem_bad_length.c
@@ -49,7 +49,7 @@
* objects have size > 0.
*/
-static uint32_t gem_create(int fd, int size, int *retval)
+static uint32_t do_gem_create(int fd, int size, int *retval)
{
struct drm_i915_gem_create create;
int ret;
@@ -73,7 +73,7 @@ static void create0(int fd)
{
int retval = 0;
printf("trying to create a zero-length gem object\n");
- gem_create(fd, 0, &retval);
+ do_gem_create(fd, 0, &retval);
assert(retval == EINVAL);
}
@@ -88,7 +88,7 @@ static void exec0(int fd)
* for the zero-length buffer, but never crash.
*/
- exec[0].handle = gem_create(fd, 4096, NULL);
+ exec[0].handle = gem_create(fd, 4096);
gem_write(fd, exec[0].handle, 0, buf, sizeof(buf));
exec[0].relocation_count = 0;
exec[0].relocs_ptr = 0;
diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c
index 91f7d215..472065c0 100644
--- a/tests/gem_exec_blt.c
+++ b/tests/gem_exec_blt.c
@@ -52,17 +52,6 @@
#define BLT_SRC_TILED (1<<15)
#define BLT_DST_TILED (1<<11)
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = (size + 4095) & -4096;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static int gem_linear_blt(uint32_t *batch,
uint32_t src,
uint32_t dst,
diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c
index 013ee79a..40438f06 100644
--- a/tests/gem_exec_faulting_reloc.c
+++ b/tests/gem_exec_faulting_reloc.c
@@ -77,17 +77,6 @@ mmap_bo(int fd, uint32_t handle)
return ptr;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = (size + 4095) & -4096;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static int gem_linear_blt(uint32_t *batch,
uint32_t src,
uint32_t dst,
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index d13756b2..d2b35ed3 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -44,17 +44,6 @@
#define MI_BATCH_BUFFER_END (0xA<<23)
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static double elapsed(const struct timeval *start,
const struct timeval *end,
int loop)
diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c
index 3f5bd0b1..54ed64d1 100644
--- a/tests/gem_gtt_speed.c
+++ b/tests/gem_gtt_speed.c
@@ -45,17 +45,6 @@
#define OBJECT_SIZE 16384
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
{
struct drm_i915_gem_mmap_gtt mmap_arg;
diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c
index 6c7a400d..fedc670b 100644
--- a/tests/gem_linear_blits.c
+++ b/tests/gem_linear_blits.c
@@ -54,18 +54,6 @@
static uint32_t linear[WIDTH*HEIGHT];
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint64_t
gem_aperture_size(int fd)
{
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index e8135871..529e2c97 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -42,19 +42,6 @@
#define OBJECT_SIZE (16*1024*1024)
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
- int ret;
-
- create.handle = 0;
- create.size = (size + 4095) & -4096;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(ret == 0);
-
- return create.handle;
-}
-
static void set_domain(int fd, uint32_t handle)
{
gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
index a79e985e..051ed3b5 100644
--- a/tests/gem_pwrite.c
+++ b/tests/gem_pwrite.c
@@ -51,17 +51,6 @@
#define BLT_DST_TILED (1<<11)
#define MI_BATCH_BUFFER_END (0xA<<23)
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = (size + 4095) & -4096;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static void do_gem_write(int fd, uint32_t handle, void *buf, int len, int loops)
{
while (loops--)
diff --git a/tests/gem_tiled_pread.c b/tests/gem_tiled_pread.c
index df0fafec..872f9eb0 100644
--- a/tests/gem_tiled_pread.c
+++ b/tests/gem_tiled_pread.c
@@ -61,18 +61,6 @@ static int tile_width;
static int tile_height;
static int tile_size;
-static uint32_t
-gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
{
struct drm_i915_gem_mmap_gtt mmap_arg;
diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c
index ef2f400b..e2ff8865 100644
--- a/tests/gem_tiled_pread_pwrite.c
+++ b/tests/gem_tiled_pread_pwrite.c
@@ -67,18 +67,6 @@ static uint32_t current_tiling_mode;
#define PAGE_SIZE 4096
-static uint32_t
-gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
{
struct drm_i915_gem_mmap_gtt mmap_arg;
diff --git a/tests/gem_vmap_blits.c b/tests/gem_vmap_blits.c
index 9c0a91ff..93fa2cfd 100644
--- a/tests/gem_vmap_blits.c
+++ b/tests/gem_vmap_blits.c
@@ -65,18 +65,6 @@ int main(int argc, char **argv)
static uint32_t linear[WIDTH*HEIGHT];
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint32_t gem_vmap(int fd, void *ptr, int size, int read_only)
{
struct drm_i915_gem_vmap vmap;
diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c
index 637b8a22..367ebd63 100644
--- a/tests/gen3_mixed_blits.c
+++ b/tests/gen3_mixed_blits.c
@@ -65,18 +65,6 @@ static inline uint32_t pack_float(float f)
return u.dw;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint64_t
gem_aperture_size(int fd)
{
diff --git a/tests/gen3_render_linear_blits.c b/tests/gen3_render_linear_blits.c
index a7d16826..c9c38847 100644
--- a/tests/gen3_render_linear_blits.c
+++ b/tests/gen3_render_linear_blits.c
@@ -65,18 +65,6 @@ static inline uint32_t pack_float(float f)
return u.dw;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint64_t
gem_aperture_size(int fd)
{
diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c
index c0160e67..1244b2a3 100644
--- a/tests/gen3_render_mixed_blits.c
+++ b/tests/gen3_render_mixed_blits.c
@@ -65,18 +65,6 @@ static inline uint32_t pack_float(float f)
return u.dw;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint64_t
gem_aperture_size(int fd)
{
diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c
index b39c1d1b..e34d2f77 100644
--- a/tests/gen3_render_tiledx_blits.c
+++ b/tests/gen3_render_tiledx_blits.c
@@ -65,18 +65,6 @@ static inline uint32_t pack_float(float f)
return u.dw;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint64_t
gem_aperture_size(int fd)
{
diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c
index 0a71dee6..cc9131b7 100644
--- a/tests/gen3_render_tiledy_blits.c
+++ b/tests/gen3_render_tiledy_blits.c
@@ -65,18 +65,6 @@ static inline uint32_t pack_float(float f)
return u.dw;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = size;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
- assert(create.handle);
-
- return create.handle;
-}
-
static uint64_t
gem_aperture_size(int fd)
{
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 36e076b4..bde62104 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -66,6 +66,7 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
#include "i915_drm.h"
+#include "drmtest.h"
#if defined(DRM_IOCTL_MODE_ADDFB2) && defined(DRM_I915_SET_SPRITE_COLORKEY)
#define TEST_PLANES 1
@@ -383,17 +384,6 @@ static void connector_find_preferred_mode(struct connector *c)
c->connector = connector;
}
-static uint32_t gem_create(int fd, int size)
-{
- struct drm_i915_gem_create create;
-
- create.handle = 0;
- create.size = (size + 4095) & -4096;
- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-
- return create.handle;
-}
-
static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
{
struct drm_i915_gem_mmap_gtt mmap_arg;