summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPFO <pfolinux@rdi-linux>2011-06-15 15:42:35 +0200
committerPFO <pfolinux@rdi-linux>2011-06-15 15:42:35 +0200
commit008f076f30d63099dddca09e0b8dae45739d3b53 (patch)
tree93346d4e8ae336d5badaa5b4f819d7c2ea0181fc
parentb03e5437e16c420878d5b0f26303aa3d160e3c60 (diff)
[Radeon] r300: uses Android's mmap as done in r600
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c19
1 files changed, 19 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 9eb8334..b582cf4 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -43,6 +43,25 @@
#define RADEON_BO_FLAGS_MICRO_TILE 2
#define RADEON_BO_FLAGS_MICRO_TILE_SQUARE 0x20
+#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 */
+
extern const struct pb_vtbl radeon_bo_vtbl;