summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2014-09-07 19:41:37 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2014-09-28 17:09:34 +0100
commitdadc9eff9fd606335a7b3d5d58065a2e8d629672 (patch)
tree2ef0dab8242a8d61336d4c643b9df8a65167f128
parentfaf51d5694e3f0ec12c7fa1fd2f87fc96a300fe3 (diff)
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>
-rw-r--r--libkms/dumb.c8
-rw-r--r--libkms/intel.c6
-rw-r--r--libkms/nouveau.c6
-rw-r--r--libkms/radeon.c8
-rw-r--r--libkms/vmwgfx.c6
5 files changed, 16 insertions, 18 deletions
diff --git a/libkms/dumb.c b/libkms/dumb.c
index 57025430..f9c16e11 100644
--- a/libkms/dumb.c
+++ b/libkms/dumb.c
@@ -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;
}
diff --git a/libkms/intel.c b/libkms/intel.c
index b006ea48..51a7fd2e 100644
--- a/libkms/intel.c
+++ b/libkms/intel.c
@@ -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;
}
diff --git a/libkms/nouveau.c b/libkms/nouveau.c
index 15c012e0..228903ff 100644
--- a/libkms/nouveau.c
+++ b/libkms/nouveau.c
@@ -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;
}
diff --git a/libkms/radeon.c b/libkms/radeon.c
index 938321bb..9383a0ae 100644
--- a/libkms/radeon.c
+++ b/libkms/radeon.c
@@ -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;
}
diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c
index 08163a16..bc04133f 100644
--- a/libkms/vmwgfx.c
+++ b/libkms/vmwgfx.c
@@ -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;
}