[Mesa-dev] [PATCH 2/3] winsys/radeon: use os_mmap() for memory mapping

Marek Olšák maraeo at gmail.com
Sun Aug 21 06:09:32 PDT 2011


Reviewed-by: Marek Olšák <maraeo at gmail.com>

On Sun, Aug 21, 2011 at 2:41 PM, Chia-I Wu <olvaffe at gmail.com> wrote:
> From: Chia-I Wu <olv at lunarg.com>
>
> os_mmap() guarantees large file support across OSes.
> ---
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> index adfbefd..b45efe5 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> @@ -31,11 +31,11 @@
>  #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);
> --
> 1.7.5.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list