diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2014-09-07 19:47:06 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2014-09-28 17:09:35 +0100 |
commit | 537b1ca8d53f985a2c3f1c20d0671d5e8be94fd0 (patch) | |
tree | cd4d8f07ff23de38962815c2a3280e9b5876273c | |
parent | 84badffe5e1995eae6739267bdc3fd9ef7a55f32 (diff) | |
download | libdrm-537b1ca8d53f985a2c3f1c20d0671d5e8be94fd0.tar.gz libdrm-537b1ca8d53f985a2c3f1c20d0671d5e8be94fd0.tar.bz2 libdrm-537b1ca8d53f985a2c3f1c20d0671d5e8be94fd0.zip |
intel: use drm_mmap/drm_munmap wrappers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r-- | intel/intel_bufmgr_gem.c | 15 | ||||
-rw-r--r-- | 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 <assert.h> #include <pthread.h> #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <stdbool.h> @@ -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 <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); |