diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2011-03-19 21:20:28 +0800 |
---|---|---|
committer | Chia-I Wu <olvaffe@gmail.com> | 2011-03-25 03:30:43 +0800 |
commit | d8ebb254c23c47f5d2761182583f5186a07fa03b (patch) | |
tree | c78379ca61bbd5edd4b8a032676d4892b4393161 /src/gallium | |
parent | dd4929b30b6a11149852785754b99b93714bdf88 (diff) |
android: use __mmap2 for winsys/r600
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/winsys/r600/drm/radeon_bo.c | 19 |
1 files changed, 19 insertions, 0 deletions
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; |