Commit 9cc16e8a authored by Daniel Vetter's avatar Daniel Vetter

lib/drmtest: extract gem_execbuf helper

Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent bd59d602
......@@ -463,6 +463,16 @@ uint32_t gem_create(int fd, int size)
return create.handle;
}
void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
{
int ret;
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
igt_assert(ret == 0);
}
void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot)
{
struct drm_i915_gem_mmap_gtt mmap_arg;
......
......@@ -71,6 +71,7 @@ void gem_set_domain(int fd, uint32_t handle,
uint32_t read_domains, uint32_t write_domain);
void gem_sync(int fd, uint32_t handle);
uint32_t gem_create(int fd, int size);
void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot);
void *gem_mmap__cpu(int fd, uint32_t handle, int size, int prot);
......
......@@ -125,19 +125,6 @@ static int gem_linear_blt(uint32_t *batch,
return (b+2 - batch) * sizeof(uint32_t);
}
static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf, int loops)
{
int ret = 0;
while (loops-- && ret == 0) {
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
}
return ret;
}
static double elapsed(const struct timeval *start,
const struct timeval *end,
int loop)
......@@ -230,8 +217,8 @@ static void run(int object_size)
struct timeval start, end;
gettimeofday(&start, NULL);
if (gem_exec(fd, &execbuf, count))
igt_fail(1);
for (int loop = 0; loop < count; loop++)
gem_execbuf(fd, &execbuf);
gem_sync(fd, handle);
gettimeofday(&end, NULL);
printf("Time to blt %d bytes x %6d: %7.3fµs, %s\n",
......
......@@ -130,16 +130,6 @@ static int gem_linear_blt(uint32_t *batch,
return (b+2 - batch) * sizeof(uint32_t);
}
static void gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
{
int ret;
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
igt_assert(ret == 0);
}
static void run(int object_size)
{
struct drm_i915_gem_execbuffer2 execbuf;
......@@ -209,7 +199,7 @@ static void run(int object_size)
i915_execbuffer2_set_context_id(execbuf, 0);
execbuf.rsvd2 = 0;
gem_exec(fd, &execbuf);
gem_execbuf(fd, &execbuf);
gem_sync(fd, handle);
gem_close(fd, handle);
......
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