lib/drmtest: extract gem_close
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 10 Jan 2012 14:07:19 +0000 (15:07 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 10 Jan 2012 14:07:19 +0000 (15:07 +0100)
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
17 files changed:
lib/drmtest.c
lib/drmtest.h
tests/gem_bad_length.c
tests/gem_exec_blt.c
tests/gem_exec_faulting_reloc.c
tests/gem_exec_nop.c
tests/gem_gtt_speed.c
tests/gem_linear_blits.c
tests/gem_mmap_gtt.c
tests/gem_pwrite.c
tests/gem_vmap_blits.c
tests/gen3_mixed_blits.c
tests/gen3_render_linear_blits.c
tests/gen3_render_mixed_blits.c
tests/gen3_render_tiledx_blits.c
tests/gen3_render_tiledy_blits.c
tests/testdisplay.c

index dc655c4..6bf57c1 100644 (file)
@@ -133,4 +133,12 @@ void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
        assert(st.tiling_mode == tiling);
 }
 
+void gem_close(int fd, uint32_t handle)
+{
+       struct drm_gem_close close_bo;
+       int ret;
 
+       close_bo.handle = handle;
+       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
+       assert(ret == 0);
+}
index 02138dc..c2aaaee 100644 (file)
@@ -38,3 +38,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);
index 347f1d9..167128d 100644 (file)
@@ -85,16 +85,6 @@ static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
        return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static void create0(int fd)
 {
        int retval = 0;
index b2ca2d6..c1350e9 100644 (file)
@@ -150,14 +150,6 @@ static int gem_linear_blt(uint32_t *batch,
        return (b+2 - batch) * sizeof(uint32_t);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-
-       close.handle = handle;
-       (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-}
-
 static void gem_sync(int fd, uint32_t handle)
 {
        struct drm_i915_gem_set_domain set_domain;
index b1ce050..be84510 100644 (file)
@@ -175,14 +175,6 @@ static int gem_linear_blt(uint32_t *batch,
        return (b+2 - batch) * sizeof(uint32_t);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-
-       close.handle = handle;
-       (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-}
-
 static void gem_sync(int fd, uint32_t handle)
 {
        struct drm_i915_gem_set_domain set_domain;
index 82076f0..583d1a5 100644 (file)
@@ -68,14 +68,6 @@ static int gem_write(int fd,
        return drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-
-       close.handle = handle;
-       (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-}
-
 static void gem_sync(int fd, uint32_t handle)
 {
        struct drm_i915_gem_set_domain set_domain;
index a406a24..6bb229c 100644 (file)
@@ -98,14 +98,6 @@ static int gem_read(int fd,
        return drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-
-       close.handle = handle;
-       (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-}
-
 static double elapsed(const struct timeval *start,
                      const struct timeval *end,
                      int loop)
index 14cf4f4..9bdf2e1 100644 (file)
@@ -66,16 +66,6 @@ static uint32_t gem_create(int fd, int size)
        return create.handle;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index 7f6b2da..35e388f 100644 (file)
@@ -87,16 +87,6 @@ static void gem_read(int fd,
        assert(ret == 0);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static void set_domain(int fd, uint32_t handle)
 {
        struct drm_i915_gem_set_domain set_domain;
index e43655e..a1a57bd 100644 (file)
@@ -75,14 +75,6 @@ static int gem_write(int fd,
        return drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-
-       close.handle = handle;
-       (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-}
-
 static void do_gem_write(int fd, uint32_t handle, void *buf, int len, int loops)
 {
        while (loops--)
index 05550a4..72be163 100644 (file)
@@ -107,16 +107,6 @@ static void gem_vmap_sync(int fd, uint32_t handle)
        assert(ret == 0);
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index 1ebc773..4f86820 100644 (file)
@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
        return create.handle;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index 33dee69..209029f 100644 (file)
@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
        return create.handle;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index 72a4b0a..9be93f0 100644 (file)
@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
        return create.handle;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index 1636027..5c4f139 100644 (file)
@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
        return create.handle;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index a29d555..47625b3 100644 (file)
@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
        return create.handle;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-       int ret;
-
-       close.handle = handle;
-       ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-       assert(ret == 0);
-}
-
 static uint64_t
 gem_aperture_size(int fd)
 {
index f1092cb..0db3ec4 100644 (file)
@@ -410,14 +410,6 @@ static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
        return ptr;
 }
 
-static void gem_close(int fd, uint32_t handle)
-{
-       struct drm_gem_close close;
-
-       close.handle = handle;
-       (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
-}
-
 static cairo_surface_t *
 allocate_surface(int fd, int width, int height, uint32_t depth,
                 uint32_t *handle, int tiled)