Expand gem_set_cacheing testing to handle the proposed DISPLAY domain
diff --git a/tests/gem_pread.c b/tests/gem_pread.c
index 1e755c0..7037221 100644
--- a/tests/gem_pread.c
+++ b/tests/gem_pread.c
@@ -83,6 +83,15 @@
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();
@@ -97,32 +106,35 @@
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_read(fd, dst, src, object_size, count);
gettimeofday(&end, NULL);
- printf("Time to uncached pread %d bytes x %6d: %7.3fµs, %s\n",
+ printf("Time to pread %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;
+ for (c = cache; c->level != -1; c++) {
+ if (gem_set_cacheing(fd, dst, c->level))
+ continue;
- gettimeofday(&start, NULL);
- do_gem_read(fd, dst, src, object_size, count);
- gettimeofday(&end, NULL);
- printf("Time to snooped pread %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 (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
+
+ gettimeofday(&start, NULL);
+ do_gem_read(fd, dst, src, object_size, count);
+ gettimeofday(&end, NULL);
+ printf("Time to %s pread %d bytes x %6d: %7.3fµs, %s\n",
+ c->name, object_size, count,
+ elapsed(&start, &end, count),
+ bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
+ fflush(stdout);
+ }
}
free(src);