igt/gem_mmap_wc: Reorder gem_close()

Unlike a GTT mmap, a WC mmap does not have a direct reference to the
object, only to the backing storage. If we want to control the domain
correctly for mmap(wc), we have to keep the bo reference around.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88356
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-01-13 09:17:29 +00:00
parent 5fb26d1469
commit 3214a27b5b

View File

@ -281,11 +281,10 @@ test_write_cpu_read_wc(int fd)
src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
igt_assert(src != (uint32_t *)MAP_FAILED);
gem_close(fd, handle);
memset(src, 0xaa, OBJECT_SIZE);
set_domain(fd, handle);
igt_assert(memcmp(dst, src, OBJECT_SIZE) == 0);
gem_close(fd, handle);
munmap(src, OBJECT_SIZE);
munmap(dst, OBJECT_SIZE);
@ -308,10 +307,9 @@ test_write_gtt_read_wc(int fd)
src = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);
igt_assert(src != (uint32_t *)MAP_FAILED);
gem_close(fd, handle);
memset(src, 0xaa, OBJECT_SIZE);
igt_assert(memcmp(dst, src, OBJECT_SIZE) == 0);
gem_close(fd, handle);
munmap(src, OBJECT_SIZE);
munmap(dst, OBJECT_SIZE);