winsys/radeon: use os_mmap() for memory mapping
authorChia-I Wu <olv@lunarg.com>
Sun, 21 Aug 2011 04:31:45 +0000 (12:31 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 24 Aug 2011 02:57:12 +0000 (10:57 +0800)
os_mmap() guarantees large file support across OSes.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index adfbefd897b5425ecd08b71ee9b73b15392028d6..b45efe5f49ce3c09facee8e288dfebc7a135b0da 100644 (file)
 #include "util/u_memory.h"
 #include "util/u_simple_list.h"
 #include "os/os_thread.h"
+#include "os/os_mman.h"
 
 #include "state_tracker/drm_driver.h"
 
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <xf86drm.h>
 #include <errno.h>
 
@@ -160,7 +160,7 @@ static void radeon_bo_destroy(struct pb_buffer *_buf)
     }
 
     if (bo->ptr)
-        munmap(bo->ptr, bo->size);
+        os_munmap(bo->ptr, bo->size);
 
     /* Close object. */
     args.handle = bo->handle;
@@ -278,7 +278,7 @@ static void *radeon_bo_map_internal(struct pb_buffer *_buf,
         return NULL;
     }
 
-    ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED,
+    ptr = os_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED,
                bo->rws->fd, args.addr_ptr);
     if (ptr == MAP_FAILED) {
         pipe_mutex_unlock(bo->map_mutex);