freedreno: use drm_mmap/drm_munmap wrappers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>main
parent
6281cf1b43
commit
84badffe5e
|
@ -312,7 +312,7 @@ out:
|
||||||
static void bo_del(struct fd_bo *bo)
|
static void bo_del(struct fd_bo *bo)
|
||||||
{
|
{
|
||||||
if (bo->map)
|
if (bo->map)
|
||||||
munmap(bo->map, bo->size);
|
drm_munmap(bo->map, bo->size);
|
||||||
|
|
||||||
/* TODO probably bo's in bucket list get removed from
|
/* TODO probably bo's in bucket list get removed from
|
||||||
* handle table??
|
* handle table??
|
||||||
|
@ -394,7 +394,7 @@ drm_public void * fd_bo_map(struct fd_bo *bo)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||||
bo->dev->fd, offset);
|
bo->dev->fd, offset);
|
||||||
if (bo->map == MAP_FAILED) {
|
if (bo->map == MAP_FAILED) {
|
||||||
ERROR_MSG("mmap failed: %s", strerror(errno));
|
ERROR_MSG("mmap failed: %s", strerror(errno));
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -186,7 +186,7 @@ fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size)
|
||||||
* thinks the buffer hasn't be allocate and fails
|
* thinks the buffer hasn't be allocate and fails
|
||||||
*/
|
*/
|
||||||
if (bo) {
|
if (bo) {
|
||||||
void *fbmem = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
void *fbmem = drm_mmap(NULL, size, PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED, fbfd, 0);
|
MAP_SHARED, fbfd, 0);
|
||||||
struct kgsl_map_user_mem req = {
|
struct kgsl_map_user_mem req = {
|
||||||
.memtype = KGSL_USER_MEM_TYPE_ADDR,
|
.memtype = KGSL_USER_MEM_TYPE_ADDR,
|
||||||
|
|
|
@ -60,7 +60,7 @@ static void kgsl_rb_bo_del(struct kgsl_rb_bo *bo)
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
munmap(bo->hostptr, bo->size);
|
drm_munmap(bo->hostptr, bo->size);
|
||||||
|
|
||||||
ret = ioctl(bo->pipe->fd, IOCTL_KGSL_SHAREDMEM_FREE, &req);
|
ret = ioctl(bo->pipe->fd, IOCTL_KGSL_SHAREDMEM_FREE, &req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -93,7 +93,7 @@ static struct kgsl_rb_bo * kgsl_rb_bo_new(struct kgsl_pipe *pipe, uint32_t size)
|
||||||
bo->pipe = pipe;
|
bo->pipe = pipe;
|
||||||
bo->gpuaddr = req.gpuaddr;
|
bo->gpuaddr = req.gpuaddr;
|
||||||
bo->size = size;
|
bo->size = size;
|
||||||
bo->hostptr = mmap(NULL, size, PROT_WRITE|PROT_READ,
|
bo->hostptr = drm_mmap(NULL, size, PROT_WRITE|PROT_READ,
|
||||||
MAP_SHARED, pipe->fd, req.gpuaddr);
|
MAP_SHARED, pipe->fd, req.gpuaddr);
|
||||||
|
|
||||||
return bo;
|
return bo;
|
||||||
|
|
Loading…
Reference in New Issue