libkms: use drm_mmap/drm_munmap wrappers

... for all by exynos.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
main
Emil Velikov 2014-09-07 19:41:37 +01:00
parent faf51d5694
commit dadc9eff9f
5 changed files with 16 additions and 18 deletions

View File

@ -36,11 +36,9 @@
#include <string.h>
#include "internal.h"
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "xf86drm.h"
#include "i915_drm.h"
#include "libdrm.h"
struct dumb_bo
{
@ -149,7 +147,7 @@ dumb_bo_map(struct kms_bo *_bo, void **out)
if (ret)
return ret;
map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
if (map == MAP_FAILED)
return -errno;
@ -177,7 +175,7 @@ dumb_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) {
/* XXX Sanity check map_count */
munmap(bo->base.ptr, bo->base.size);
drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

View File

@ -36,9 +36,9 @@
#include <string.h>
#include "internal.h"
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "xf86drm.h"
#include "libdrm.h"
#include "i915_drm.h"
@ -173,7 +173,7 @@ intel_bo_map(struct kms_bo *_bo, void **out)
if (ret)
return ret;
map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
if (map == MAP_FAILED)
return -errno;
@ -201,7 +201,7 @@ intel_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) {
/* XXX Sanity check map_count */
munmap(bo->base.ptr, bo->base.size);
drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

View File

@ -36,9 +36,9 @@
#include <string.h>
#include "internal.h"
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "xf86drm.h"
#include "libdrm.h"
#include "nouveau_drm.h"
@ -155,7 +155,7 @@ nouveau_bo_map(struct kms_bo *_bo, void **out)
return 0;
}
map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle);
map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle);
if (map == MAP_FAILED)
return -errno;
@ -183,7 +183,7 @@ nouveau_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) {
/* XXX Sanity check map_count */
munmap(bo->base.ptr, bo->base.size);
drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

View File

@ -36,9 +36,9 @@
#include <string.h>
#include "internal.h"
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "xf86drm.h"
#include "libdrm.h"
#include "radeon_drm.h"
@ -172,7 +172,7 @@ radeon_bo_map(struct kms_bo *_bo, void **out)
if (ret)
return -errno;
map = mmap(0, arg.size, PROT_READ | PROT_WRITE, MAP_SHARED,
map = drm_mmap(0, arg.size, PROT_READ | PROT_WRITE, MAP_SHARED,
bo->base.kms->fd, arg.addr_ptr);
if (map == MAP_FAILED)
return -errno;
@ -189,7 +189,7 @@ radeon_bo_unmap(struct kms_bo *_bo)
{
struct radeon_bo *bo = (struct radeon_bo *)_bo;
if (--bo->map_count == 0) {
munmap(bo->base.ptr, bo->base.size);
drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}
return 0;
@ -204,7 +204,7 @@ radeon_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) {
/* XXX Sanity check map_count */
munmap(bo->base.ptr, bo->base.size);
drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

View File

@ -35,8 +35,8 @@
#include <string.h>
#include "internal.h"
#include <sys/mman.h>
#include "xf86drm.h"
#include "libdrm.h"
#include "vmwgfx_drm.h"
struct vmwgfx_bo
@ -146,7 +146,7 @@ vmwgfx_bo_map(struct kms_bo *_bo, void **out)
return 0;
}
map = mmap(NULL, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle);
map = drm_mmap(NULL, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle);
if (map == MAP_FAILED)
return -errno;
@ -173,7 +173,7 @@ vmwgfx_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) {
/* XXX Sanity check map_count */
munmap(bo->base.ptr, bo->base.size);
drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}