From d8ebb254c23c47f5d2761182583f5186a07fa03b Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 19 Mar 2011 21:20:28 +0800 Subject: android: use __mmap2 for winsys/r600 --- src/gallium/winsys/r600/drm/radeon_bo.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index 3643ddbcb9..ba02a3c2bd 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -33,6 +33,25 @@ #include "xf86drm.h" #include "radeon_drm.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 */ + static int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo) { struct drm_radeon_gem_mmap args; -- cgit v1.2.3