summaryrefslogtreecommitdiff
path: root/tests/gem_pwrite.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-10 15:49:33 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-10 15:49:33 +0100
commit467796acc80ced3440740d267c2e2a4f246d4b8a (patch)
tree0a8515b387709e1a41d468d2b0a6407b559869e7 /tests/gem_pwrite.c
parentdbbf2e9b24d1488402269a803a230f341791d39a (diff)
Expand gem_set_cacheing testing to handle the proposed DISPLAY domain
Diffstat (limited to 'tests/gem_pwrite.c')
-rw-r--r--tests/gem_pwrite.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
index 9c30dbbe..447a2002 100644
--- a/tests/gem_pwrite.c
+++ b/tests/gem_pwrite.c
@@ -90,6 +90,15 @@ int main(int argc, char **argv)
uint32_t buf[20];
uint32_t *src, dst;
int fd, count;
+ const struct {
+ int level;
+ const char *name;
+ } cache[] = {
+ { 0, "uncached" },
+ { 1, "snoop" },
+ { 2, "display" },
+ { -1 },
+ }, *c;
drmtest_skip_on_simulation();
@@ -104,32 +113,35 @@ int main(int argc, char **argv)
dst = gem_create(fd, object_size);
src = malloc(object_size);
- gem_set_cacheing(fd, dst, 0);
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
gettimeofday(&start, NULL);
do_gem_write(fd, dst, src, object_size, count);
gettimeofday(&end, NULL);
- printf("Time to uncached pwrite %d bytes x %6d: %7.3fµs, %s\n",
+ printf("Time to pwrite %d bytes x %6d: %7.3fµs, %s\n",
object_size, count,
elapsed(&start, &end, count),
bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
fflush(stdout);
}
- gem_set_cacheing(fd, dst, 1);
- for (count = 1; count <= 1<<17; count <<= 1) {
- struct timeval start, end;
-
- gettimeofday(&start, NULL);
- do_gem_write(fd, dst, src, object_size, count);
- gettimeofday(&end, NULL);
- printf("Time to snooped pwrite %d bytes x %6d: %7.3fµs, %s\n",
- object_size, count,
- elapsed(&start, &end, count),
- bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
- fflush(stdout);
+ for (c = cache; c->level != -1; c++) {
+ if (gem_set_cacheing(fd, dst, c->level))
+ continue;
+
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ do_gem_write(fd, dst, src, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("Time to %s pwrite %d bytes x %6d: %7.3fµs, %s\n",
+ c->level, object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
}
free(src);