summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2011-06-15 19:37:33 +0200
committerHugues Hiegel <hugues@hiegel.fr>2011-06-15 19:37:33 +0200
commit43894e0b38b5285f6b0816cf8178e9642fc60d7c (patch)
tree9155a3a481f47e1d18c39a30629d6a8d1c61beb1 /src
parent42da26814dfb3ecc62b4a8271ab42652a85b7ee7 (diff)
[Radeon] r300: uses Android's mmap routine, as in r600
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 9eb833454d..fa20d7eb98 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -39,6 +39,26 @@
#include <xf86drm.h>
#include <errno.h>
+#ifdef ANDROID
+
+extern void* __mmap2(void*, size_t, int, int, int, size_t);
+
+#define MMAP2_SHIFT 12
+static void* android_mmap2(void *addr, size_t size, int prot, int flags, int fd, unsigned long long offset)
+{
+ if ( offset & ((1UL << MMAP2_SHIFT)-1) ) {
+ errno = EINVAL;
+ return MAP_FAILED;
+ }
+
+ return __mmap2(addr, size, prot, flags, fd, (size_t)(offset >> MMAP2_SHIFT));
+}
+
+#define mmap(addr, size, prot, flags, fd, offset) android_mmap2(addr, size, prot, flags, fd, offset)
+
+#endif /* ANDROID */
+
+
#define RADEON_BO_FLAGS_MACRO_TILE 1
#define RADEON_BO_FLAGS_MICRO_TILE 2
#define RADEON_BO_FLAGS_MICRO_TILE_SQUARE 0x20