mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-19 13:56:23 +00:00
lib/drmtest: extract gem_execbuf helper
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
bd59d60275
commit
9cc16e8afd
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user