Mesa (master): panfrost: use os_mmap and os_munmap

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 12 16:33:13 UTC 2019


Module: Mesa
Branch: master
Commit: f4fc2ece5776a2c15d9db0a2ff2b94491cfc3ebb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4fc2ece5776a2c15d9db0a2ff2b94491cfc3ebb

Author: Mateusz Krzak <kszaquitto at gmail.com>
Date:   Sun Apr  7 23:25:49 2019 +0200

panfrost: use os_mmap and os_munmap

32-bit needs mmap64 for 64-bit offsets. We get 64-bit offsets from kernel.

Signed-off-by: Mateusz Krzak <kszaquitto at gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 src/gallium/drivers/panfrost/pan_drm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 9aabd96769b..70d8d7498d4 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -29,6 +29,7 @@
 
 #include "util/u_memory.h"
 #include "util/os_time.h"
+#include "os/os_mman.h"
 
 #include "pan_screen.h"
 #include "pan_resource.h"
@@ -81,7 +82,7 @@ panfrost_drm_allocate_slab(struct panfrost_screen *screen,
 		assert(0);
 	}
 
-        mem->cpu = mmap(NULL, mem->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+        mem->cpu = os_mmap(NULL, mem->size, PROT_READ | PROT_WRITE, MAP_SHARED,
                        drm->fd, mmap_bo.offset);
         if (mem->cpu == MAP_FAILED) {
                 fprintf(stderr, "mmap failed: %p\n", mem->cpu);
@@ -102,7 +103,7 @@ panfrost_drm_free_slab(struct panfrost_screen *screen, struct panfrost_memory *m
 	};
 	int ret;
 
-        if (munmap((void *) (uintptr_t) mem->cpu, mem->size)) {
+        if (os_munmap((void *) (uintptr_t) mem->cpu, mem->size)) {
                 perror("munmap");
                 abort();
         }
@@ -148,7 +149,7 @@ panfrost_drm_import_bo(struct panfrost_screen *screen, struct winsys_handle *wha
 
         bo->size = lseek(whandle->handle, 0, SEEK_END);
         assert(bo->size > 0);
-        bo->cpu = mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+        bo->cpu = os_mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
                        drm->fd, mmap_bo.offset);
         if (bo->cpu == MAP_FAILED) {
                 fprintf(stderr, "mmap failed: %p\n", bo->cpu);




More information about the mesa-commit mailing list