[igt-dev] [PATCH v2 i-g-t 2/2] benchmarks/gem_mmap: Use mmap_offset

Ashutosh Dixit ashutosh.dixit at intel.com
Fri Jan 31 20:38:13 UTC 2020


Use function versions with mmap_offset. Also check for mappable
aperture before mmap__gtt().

Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 benchmarks/gem_mmap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/benchmarks/gem_mmap.c b/benchmarks/gem_mmap.c
index d3d4ad310..ea5ad9062 100644
--- a/benchmarks/gem_mmap.c
+++ b/benchmarks/gem_mmap.c
@@ -118,15 +118,16 @@ int main(int argc, char **argv)
 	handle = gem_create(fd, OBJECT_SIZE);
 	switch (map) {
 	case CPU:
-		ptr = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
+		ptr = gem_mmap__cpu_coherent(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
 		gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 		break;
 	case GTT:
+		gem_require_mappable_ggtt(fd);
 		ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);
 		gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		break;
 	case WC:
-		ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
+		ptr = gem_mmap__wc_ext(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
 		gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		break;
 	default:
@@ -169,13 +170,13 @@ int main(int argc, char **argv)
 				munmap(ptr, OBJECT_SIZE);
 				switch (map) {
 				case CPU:
-					ptr = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
+					ptr = gem_mmap__cpu_coherent(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
 					break;
 				case GTT:
 					ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);
 					break;
 				case WC:
-					ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
+					ptr = gem_mmap__wc_ext(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
 					break;
 				default:
 					abort();
-- 
2.25.0



More information about the igt-dev mailing list