summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-04 17:13:05 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-04 17:13:05 +0100
commitd9d9578f3bd25734e8dc85b620c9c9073161d7fb (patch)
treed59d96286347a6fdf6aacfe52af6822d356abe0e /tests
parent796fd58a17aa93e3e1a62549afde5984a10ebdee (diff)
tests: run no-op batches on all rings
For Ben ...
Diffstat (limited to 'tests')
-rw-r--r--tests/gem_exec_nop.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 9dd055cf..e45f10dd 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -41,8 +41,7 @@
#include "drm.h"
#include "i915_drm.h"
#include "drmtest.h"
-
-#define MI_BATCH_BUFFER_END (0xA<<23)
+#include "intel_gpu_tools.h"
static double elapsed(const struct timeval *start,
const struct timeval *end,
@@ -51,7 +50,7 @@ static double elapsed(const struct timeval *start,
return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec))/loop;
}
-static int exec(int fd, uint32_t handle, int loops)
+static int exec(int fd, uint32_t handle, int loops, unsigned ring_id)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 gem_exec[1];
@@ -88,29 +87,48 @@ static int exec(int fd, uint32_t handle, int loops)
return ret;
}
+static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_name)
+{
+ int count;
+
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ if (exec(fd, handle, count, ring_id))
+ exit(1);
+ gettimeofday(&end, NULL);
+ printf("Time to exec x %d: %7.3fµs (ring=%s)\n",
+ count, elapsed(&start, &end, count), ring_name);
+ fflush(stdout);
+ }
+
+}
int main(int argc, char **argv)
{
uint32_t batch[2] = {MI_BATCH_BUFFER_END};
uint32_t handle;
- int count;
+ uint32_t devid;
int fd;
fd = drm_open_any();
+ devid = intel_get_drm_devid(fd);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
+ if (drmtest_run_subtest("render"))
+ loop(fd, handle, I915_EXEC_RENDER, "render");
+
+ if (drmtest_run_subtest("bsd"))
+ if (HAS_BSD_RING(devid))
+ loop(fd, handle, I915_EXEC_BSD, "bsd");
+
+ if (drmtest_run_subtest("blt"))
+ if (HAS_BLT_RING(devid))
+ loop(fd, handle, I915_EXEC_BLT, "blt");
+
- gettimeofday(&start, NULL);
- if (exec(fd, handle, count))
- exit(1);
- gettimeofday(&end, NULL);
- printf("Time to exec x %d: %7.3fµs\n",
- count, elapsed(&start, &end, count));
- fflush(stdout);
- }
gem_close(fd, handle);
close(fd);