Mesa (master): i965: use mmap64 for Android

Rob Herring robh at kemper.freedesktop.org
Thu May 25 20:21:57 UTC 2017


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

Author: Rob Herring <robh at kernel.org>
Date:   Tue May 23 14:43:30 2017 -0500

i965: use mmap64 for Android

Simplify the handling of mmap for Android by using mmap64 instead. mmap64
may have not existed for Android when this was written, but it's been
around since 2013.

Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Rob Herring <robh at kernel.org>

---

 src/mesa/drivers/dri/i965/libdrm_macros.h | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/libdrm_macros.h b/src/mesa/drivers/dri/i965/libdrm_macros.h
index 8be103c5b7..2cb76d585a 100644
--- a/src/mesa/drivers/dri/i965/libdrm_macros.h
+++ b/src/mesa/drivers/dri/i965/libdrm_macros.h
@@ -29,26 +29,13 @@
 #include <sys/mman.h>
 
 #if defined(ANDROID) && !defined(__LP64__)
-#include <errno.h> /* for EINVAL */
-
-extern void *__mmap2(void *, size_t, int, int, int, size_t);
-
-static inline void *drm_mmap(void *addr, size_t length, int prot, int flags,
-                             int fd, loff_t offset)
-{
-   /* offset must be aligned to 4096 (not necessarily the page size) */
-   if (offset & 4095) {
-      errno = EINVAL;
-      return MAP_FAILED;
-   }
-
-   return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12));
-}
+/* 32-bit needs mmap64 for 64-bit offsets */
+#  define drm_mmap(addr, length, prot, flags, fd, offset) \
+              mmap64(addr, length, prot, flags, fd, offset)
 
 #  define drm_munmap(addr, length) \
               munmap(addr, length)
 
-
 #else
 
 /* assume large file support exists */




More information about the mesa-commit mailing list