summaryrefslogtreecommitdiff
path: root/benchmarks/gem_busy.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-08-28 20:43:41 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-08-28 20:44:18 +0100
commit572a770f997cae6c3bcb76577e6eac61baa0afa3 (patch)
treefef3c168f05ec752410c21b73d57197869a90468 /benchmarks/gem_busy.c
parent93b8ad80f2691ae15dea78401db2b32d8cef7354 (diff)
benchmarks/gem_busy: Compare using wait-ioctl for busyness check
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_busy.c')
-rw-r--r--benchmarks/gem_busy.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/benchmarks/gem_busy.c b/benchmarks/gem_busy.c
index a6ff2361..65e634e8 100644
--- a/benchmarks/gem_busy.c
+++ b/benchmarks/gem_busy.c
@@ -55,7 +55,8 @@
#define WRITE 0x1
#define IDLE 0x2
-#define DMABUF 0x2
+#define DMABUF 0x4
+#define WAIT 0x8
static bool gem_busy(int fd, uint32_t handle)
{
@@ -69,6 +70,21 @@ static bool gem_busy(int fd, uint32_t handle)
return busy.busy != 0;
}
+static bool gem_wait__busy(int fd, uint32_t handle)
+{
+ struct drm_i915_gem_wait wait;
+ int ret;
+
+ memset(&wait, 0, sizeof(wait));
+ wait.bo_handle = handle;
+
+ ret = 0;
+ if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait))
+ ret = -errno;
+
+ return ret == -ETIME;
+}
+
static double elapsed(const struct timespec *start,
const struct timespec *end)
{
@@ -196,6 +212,9 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
struct pollfd pfd = { .fd = dmabuf, .events = POLLOUT };
for (int inner = 0; inner < 1024; inner++)
poll(&pfd, 1, 0);
+ } else if (flags & WAIT) {
+ for (int inner = 0; inner < 1024; inner++)
+ gem_wait__busy(fd, obj[0].handle);
} else {
for (int inner = 0; inner < 1024; inner++)
gem_busy(fd, obj[0].handle);
@@ -227,7 +246,7 @@ int main(int argc, char **argv)
int ncpus = 1;
int c;
- while ((c = getopt (argc, argv, "e:r:dfWI")) != -1) {
+ while ((c = getopt (argc, argv, "e:r:dfwWI")) != -1) {
switch (c) {
case 'e':
if (strcmp(optarg, "rcs") == 0)
@@ -258,6 +277,10 @@ int main(int argc, char **argv)
flags |= DMABUF;
break;
+ case 'w':
+ flags |= WAIT;
+ break;
+
case 'W':
flags |= WRITE;
break;