diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-09-04 20:00:09 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-09-04 20:02:11 +0100 |
commit | 6bd4208cc4a47271d83b36a43d434a8f7fcf8ecb (patch) | |
tree | 448c17e7a7a7b407b9b55d16e7f06c587b895279 /benchmarks/gem_busy.c | |
parent | f92e47f4014ac5e9b115bf43ad40fde5182ad636 (diff) |
benchmarks/gem_busy: Merge all the sync_file fences together
Instead of causing each engine to execute serially (and so only testing
on fence underneath the sync_file) merge them all together (as we do for
the other interfaces).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_busy.c')
-rw-r--r-- | benchmarks/gem_busy.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/benchmarks/gem_busy.c b/benchmarks/gem_busy.c index 7e847e5d..bda3e138 100644 --- a/benchmarks/gem_busy.c +++ b/benchmarks/gem_busy.c @@ -109,6 +109,37 @@ static double elapsed(const struct timespec *start, (end->tv_nsec - start->tv_nsec); } +struct sync_merge_data { + char name[32]; + __s32 fd2; + __s32 fence; + __u32 flags; + __u32 pad; +}; + +#define SYNC_IOC_MAGIC '>' +#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) + +static int sync_merge(int fd1, int fd2) +{ + struct sync_merge_data data; + + if (fd1 == -1) + return dup(fd2); + + if (fd2 == -1) + return dup(fd1); + + memset(&data, 0, sizeof(data)); + data.fd2 = fd2; + strcpy(data.name, "i965"); + + if (ioctl(fd1, SYNC_IOC_MERGE, &data)) + return -errno; + + return data.fence; +} + static int loop(unsigned ring, int reps, int ncpus, unsigned flags) { struct drm_i915_gem_execbuffer2 execbuf; @@ -215,17 +246,13 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags) if ((flags & IDLE) == 0) { for (int n = 0; n < nengine; n++) { execbuf.flags &= ~(3 << 16); - if (flags & SYNC) { - execbuf.rsvd2 = fence; - if (fence != -1) - execbuf.flags |= 1 << 16; + if (flags & SYNC) execbuf.flags |= 1 << 17; - } execbuf.flags &= ~ENGINE_FLAGS; execbuf.flags |= engines[n]; gem_execbuf_wr(fd, &execbuf); if (execbuf.flags & (1 << 17)) - fence = execbuf.rsvd2 >> 32; + fence = sync_merge(fence, execbuf.rsvd2 >> 32); } } |