From: Emil Velikov <emil.l.velikov@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: emil.l.velikov@gmail.com
Subject: [PATCH 14/18] libkms: use drm_mmap/drm_munmap wrappers
Date: Sun, 7 Sep 2014 22:30:09 +0100 [thread overview]
Message-ID: <1410125413-19465-15-git-send-email-emil.l.velikov@gmail.com> (raw)
In-Reply-To: <1410125413-19465-1-git-send-email-emil.l.velikov@gmail.com>
... for all by exynos.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
libkms/dumb.c | 8 +++-----
libkms/intel.c | 6 +++---
libkms/nouveau.c | 6 +++---
libkms/radeon.c | 8 ++++----
libkms/vmwgfx.c | 6 +++---
5 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/libkms/dumb.c b/libkms/dumb.c
index 5702543..f9c16e1 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 b006ea4..51a7fd2 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 15c012e..228903f 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 938321b..9383a0a 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 08163a1..bc04133 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;
}
--
2.0.2
next prev 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 ` Emil Velikov [this message]
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 ` [PATCH 18/18] intel: " Emil Velikov
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-15-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