diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-09-07 09:42:27 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-03-15 10:52:37 +0000 |
commit | 20e34802d5ba6fcd9566d2c01fae6895e8e9348e (patch) | |
tree | b00de6801197cdab202d5a70da490600415c3f1f | |
parent | 39cda169b762d991ac4850ea167595143abe6f47 (diff) |
map-gtt
-rw-r--r-- | tests/gem_mmap_gtt.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index ac96f3ae..3148f258 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -565,13 +565,15 @@ test_huge_bo(int fd, int huge, int tiling) bo = gem_create(fd, PAGE_SIZE); if (tiling) igt_require(__gem_set_tiling(fd, bo, tiling, pitch) == 0); - linear_pattern = gem_mmap__gtt(fd, bo, PAGE_SIZE, - PROT_READ | PROT_WRITE); - for (i = 0; i < PAGE_SIZE; i++) - linear_pattern[i] = i; + tiled_pattern = gem_mmap__cpu(fd, bo, 0, PAGE_SIZE, PROT_READ); + linear_pattern = gem_mmap__gtt(fd, bo, PAGE_SIZE, PROT_WRITE); + gem_set_domain(fd, bo, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); + for (i = 0; i < PAGE_SIZE; i++) + linear_pattern[i] = i; gem_set_domain(fd, bo, I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT, 0); + gem_close(fd, bo); bo = gem_create(fd, size); @@ -579,13 +581,13 @@ test_huge_bo(int fd, int huge, int tiling) igt_require(__gem_set_tiling(fd, bo, tiling, pitch) == 0); /* Initialise first/last page through CPU mmap */ - ptr = gem_mmap__cpu(fd, bo, 0, size, PROT_READ | PROT_WRITE); + ptr = gem_mmap__cpu(fd, bo, 0, size, PROT_WRITE); memcpy(ptr, tiled_pattern, PAGE_SIZE); memcpy(ptr + last_offset, tiled_pattern, PAGE_SIZE); munmap(ptr, size); /* Obtain mapping for the object through GTT. */ - ptr = __gem_mmap__gtt(fd, bo, size, PROT_READ | PROT_WRITE); + ptr = __gem_mmap__gtt(fd, bo, size, PROT_READ); igt_require_f(ptr, "Huge BO GTT mapping not supported.\n"); set_domain_gtt(fd, bo); |