From 537b1ca8d53f985a2c3f1c20d0671d5e8be94fd0 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 7 Sep 2014 19:47:06 +0100 Subject: [PATCH] intel: use drm_mmap/drm_munmap wrappers Signed-off-by: Emil Velikov Reviewed-by: Jakob Bornecrantz --- intel/intel_bufmgr_gem.c | 15 +++++++-------- intel/test_decode.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index ba655274..ee69cf8e 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -1051,11 +1050,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--; } @@ -1140,12 +1139,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--; } @@ -1381,9 +1380,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 bef9d99f..d7025f03 100644 --- a/intel/test_decode.c +++ b/intel/test_decode.c @@ -32,9 +32,9 @@ #include #include #include -#include #include +#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);