From 3214a27b5ba7cd621b091f1d0702e069a750c054 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 13 Jan 2015 09:17:29 +0000 Subject: [PATCH] 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 --- tests/gem_mmap_wc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/gem_mmap_wc.c b/tests/gem_mmap_wc.c index 4881ab73..2edb332a 100644 --- a/tests/gem_mmap_wc.c +++ b/tests/gem_mmap_wc.c @@ -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);