summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmarks/ezbench.d/gem_busy.test8
-rw-r--r--benchmarks/gem_busy.c27
2 files changed, 33 insertions, 2 deletions
diff --git a/benchmarks/ezbench.d/gem_busy.test b/benchmarks/ezbench.d/gem_busy.test
index ae66b977..94916d3e 100644
--- a/benchmarks/ezbench.d/gem_busy.test
+++ b/benchmarks/ezbench.d/gem_busy.test
@@ -11,6 +11,14 @@ while read label mode; do
test_name="$test_name $name"
eval "${name}_run() { sudo $IGT_BENCHMARKS/gem_busy $mode -f -e $ring -r \$1 ; }"
+ name="gem:busy:$label:$ring:wait"
+ test_name="$test_name $name"
+ eval "${name}_run() { sudo $IGT_BENCHMARKS/gem_busy $mode -w -e $ring -r \$1 ; }"
+
+ name="gem:busy:$label:$ring:wait:forked"
+ test_name="$test_name $name"
+ eval "${name}_run() { sudo $IGT_BENCHMARKS/gem_busy $mode -w -f -e $ring -r \$1 ; }"
+
name="gem:busy:$label:$ring:dmabuf"
test_name="$test_name $name"
eval "${name}_run() { sudo $IGT_BENCHMARKS/gem_busy $mode -d -e $ring -r \$1 ; }"
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;