Commit 5dd17d3f authored by Daniel Vetter's avatar Daniel Vetter

lib/drmtest: extract gem_close

Signed-Off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent aa67b22e
...@@ -133,4 +133,12 @@ void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride) ...@@ -133,4 +133,12 @@ void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
assert(st.tiling_mode == tiling); 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);
}
...@@ -38,3 +38,4 @@ int drm_open_any_master(void); ...@@ -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_set_tiling(int fd, uint32_t handle, int tiling, int stride);
void gem_close(int fd, uint32_t handle);
...@@ -85,16 +85,6 @@ static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf) ...@@ -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); 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) static void create0(int fd)
{ {
int retval = 0; int retval = 0;
......
...@@ -150,14 +150,6 @@ static int gem_linear_blt(uint32_t *batch, ...@@ -150,14 +150,6 @@ static int gem_linear_blt(uint32_t *batch,
return (b+2 - batch) * sizeof(uint32_t); 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) static void gem_sync(int fd, uint32_t handle)
{ {
struct drm_i915_gem_set_domain set_domain; struct drm_i915_gem_set_domain set_domain;
......
...@@ -175,14 +175,6 @@ static int gem_linear_blt(uint32_t *batch, ...@@ -175,14 +175,6 @@ static int gem_linear_blt(uint32_t *batch,
return (b+2 - batch) * sizeof(uint32_t); 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) static void gem_sync(int fd, uint32_t handle)
{ {
struct drm_i915_gem_set_domain set_domain; struct drm_i915_gem_set_domain set_domain;
......
...@@ -68,14 +68,6 @@ static int gem_write(int fd, ...@@ -68,14 +68,6 @@ static int gem_write(int fd,
return drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite); 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) static void gem_sync(int fd, uint32_t handle)
{ {
struct drm_i915_gem_set_domain set_domain; struct drm_i915_gem_set_domain set_domain;
......
...@@ -98,14 +98,6 @@ static int gem_read(int fd, ...@@ -98,14 +98,6 @@ static int gem_read(int fd,
return drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread); 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, static double elapsed(const struct timeval *start,
const struct timeval *end, const struct timeval *end,
int loop) int loop)
......
...@@ -66,16 +66,6 @@ static uint32_t gem_create(int fd, int size) ...@@ -66,16 +66,6 @@ static uint32_t gem_create(int fd, int size)
return create.handle; 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -87,16 +87,6 @@ static void gem_read(int fd, ...@@ -87,16 +87,6 @@ static void gem_read(int fd,
assert(ret == 0); 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) static void set_domain(int fd, uint32_t handle)
{ {
struct drm_i915_gem_set_domain set_domain; struct drm_i915_gem_set_domain set_domain;
......
...@@ -75,14 +75,6 @@ static int gem_write(int fd, ...@@ -75,14 +75,6 @@ static int gem_write(int fd,
return drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite); 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) static void do_gem_write(int fd, uint32_t handle, void *buf, int len, int loops)
{ {
while (loops--) while (loops--)
......
...@@ -107,16 +107,6 @@ static void gem_vmap_sync(int fd, uint32_t handle) ...@@ -107,16 +107,6 @@ static void gem_vmap_sync(int fd, uint32_t handle)
assert(ret == 0); 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size) ...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
return create.handle; 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size) ...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
return create.handle; 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size) ...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
return create.handle; 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size) ...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
return create.handle; 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size) ...@@ -77,16 +77,6 @@ static uint32_t gem_create(int fd, int size)
return create.handle; 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 static uint64_t
gem_aperture_size(int fd) gem_aperture_size(int fd)
{ {
......
...@@ -410,14 +410,6 @@ static void *gem_mmap(int fd, uint32_t handle, int size, int prot) ...@@ -410,14 +410,6 @@ static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
return ptr; 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 * static cairo_surface_t *
allocate_surface(int fd, int width, int height, uint32_t depth, allocate_surface(int fd, int width, int height, uint32_t depth,
uint32_t *handle, int tiled) uint32_t *handle, int tiled)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment