diff mbox

[18/18] intel: use drm_mmap/drm_munmap wrappers

Message ID 1410125413-19465-19-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov Sept. 7, 2014, 9:30 p.m. UTC
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 intel/intel_bufmgr_gem.c | 15 +++++++--------
 intel/test_decode.c      |  4 ++--
 2 files changed, 9 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 0e1cb0d..a527f41 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -48,7 +48,6 @@ 
 #include <assert.h>
 #include <pthread.h>
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <stdbool.h>
@@ -955,11 +954,11 @@  drm_intel_gem_bo_free(drm_intel_bo *bo)
 	DRMLISTDEL(&bo_gem->vma_list);
 	if (bo_gem->mem_virtual) {
 		VG(VALGRIND_FREELIKE_BLOCK(bo_gem->mem_virtual, 0));
-		munmap(bo_gem->mem_virtual, bo_gem->bo.size);
+		drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size);
 		bufmgr_gem->vma_count--;
 	}
 	if (bo_gem->gtt_virtual) {
-		munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
+		drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
 		bufmgr_gem->vma_count--;
 	}
 
@@ -1044,12 +1043,12 @@  static void drm_intel_gem_bo_purge_vma_cache(drm_intel_bufmgr_gem *bufmgr_gem)
 		DRMLISTDELINIT(&bo_gem->vma_list);
 
 		if (bo_gem->mem_virtual) {
-			munmap(bo_gem->mem_virtual, bo_gem->bo.size);
+			drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size);
 			bo_gem->mem_virtual = NULL;
 			bufmgr_gem->vma_count--;
 		}
 		if (bo_gem->gtt_virtual) {
-			munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
+			drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
 			bo_gem->gtt_virtual = NULL;
 			bufmgr_gem->vma_count--;
 		}
@@ -1271,9 +1270,9 @@  map_gtt(drm_intel_bo *bo)
 		}
 
 		/* and mmap it */
-		bo_gem->gtt_virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
-					   MAP_SHARED, bufmgr_gem->fd,
-					   mmap_arg.offset);
+		bo_gem->gtt_virtual = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE,
+					       MAP_SHARED, bufmgr_gem->fd,
+					       mmap_arg.offset);
 		if (bo_gem->gtt_virtual == MAP_FAILED) {
 			bo_gem->gtt_virtual = NULL;
 			ret = -errno;
diff --git a/intel/test_decode.c b/intel/test_decode.c
index bef9d99..d7025f0 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -32,9 +32,9 @@ 
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
 #include <err.h>
 
+#include "libdrm.h"
 #include "intel_bufmgr.h"
 #include "intel_chipset.h"
 
@@ -64,7 +64,7 @@  read_file(const char *filename, void **ptr, size_t *size)
 		errx(1, "couldn't stat `%s'", filename);
 
 	*size = st.st_size;
-	*ptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+	*ptr = drm_mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
 	if (*ptr == MAP_FAILED)
 		errx(1, "couldn't map `%s'", filename);