dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: emil.l.velikov@gmail.com
Subject: [PATCH 18/18] intel: use drm_mmap/drm_munmap wrappers
Date: Sun,  7 Sep 2014 22:30:13 +0100	[thread overview]
Message-ID: <1410125413-19465-19-git-send-email-emil.l.velikov@gmail.com> (raw)
In-Reply-To: <1410125413-19465-1-git-send-email-emil.l.velikov@gmail.com>

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 --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);
 
-- 
2.0.2

  parent reply	other threads:[~2014-09-07 21:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07 21:29 [PATCH 00/18] Final batch of Android related fixes Emil Velikov
2014-09-07 21:29 ` [PATCH 01/18] automake: remove obsolete makefiles Emil Velikov
2014-09-07 21:29 ` [PATCH 02/18] Remove i810_drm.h and i830_drm.h from the distribution tarball Emil Velikov
2014-09-07 21:29 ` [PATCH 03/18] automake: fix 'make commit-headers' Emil Velikov
2014-09-07 21:29 ` [PATCH 04/18] configure: unconditionally check for atomic ops/primitives Emil Velikov
2014-09-07 21:30 ` [PATCH 05/18] libkms: build the intel backend only when needed Emil Velikov
2014-09-08 10:11   ` Jakob Bornecrantz
2014-09-07 21:30 ` [PATCH 06/18] libkms: move sources lists to makefile.sources Emil Velikov
2014-09-07 21:30 ` [PATCH 07/18] libkms: add Android build Emil Velikov
2014-09-08 10:10   ` Jakob Bornecrantz
2014-09-07 21:30 ` [PATCH 08/18] modetest: move sources lists to makefiles.sources Emil Velikov
2014-09-07 21:30 ` [PATCH 09/18] modetest: add Android build Emil Velikov
2014-09-16 13:30   ` [PATCHv2 " Emil Velikov
2014-09-07 21:30 ` [PATCH 10/18] modetest: Add support of STI driver Emil Velikov
2014-09-07 21:30 ` [PATCH 11/18] automake: pick up all files for distribution Emil Velikov
2014-09-07 21:30 ` [PATCH 12/18] Add private mmap/munmap wrappers Emil Velikov
2014-09-16 13:31   ` [PATCHv2 " Emil Velikov
2014-09-07 21:30 ` [PATCH 13/18] drm: use drm_mmap/drm_munmap wrappers Emil Velikov
2014-09-07 21:30 ` [PATCH 14/18] libkms: " Emil Velikov
2014-09-07 21:30 ` [PATCH 15/18] nouveau: " Emil Velikov
2014-09-07 21:30 ` [PATCH 16/18] radeon: " Emil Velikov
2014-09-07 21:30 ` [PATCH 17/18] freedreno: " Emil Velikov
2014-09-07 21:30 ` Emil Velikov [this message]
2014-09-08 11:10 ` [PATCH 00/18] Final batch of Android related fixes Jakob Bornecrantz
2014-09-08 12:14   ` Daniel Vetter
2014-09-16 13:34 ` Emil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410125413-19465-19-git-send-email-emil.l.velikov@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox