summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-02 15:06:35 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-02 15:06:35 +0200
commiteacedf41a65f135722e7bee6f1a66a803619237f (patch)
tree6b24f01790d18972f0b103ed4ec3d6246dd22435 /libdrm
parenta31046b8734f12ed22127ef5f6ca4fc33df72ec1 (diff)
Make the user_token 44-bit for TTMs, and have them occupy a unique file space
starting at 0x00100000000. This will hopefully allow us to use unmap_mapping_range(). Note that user-space will need 64-bit file offset support.
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index ab884eb5..bce913d3 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -46,6 +46,9 @@
# include <sys/mman.h>
# endif
#else
+# ifdef HAVE_CONFIG_H
+# include <config.h>
+# endif
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
@@ -2804,7 +2807,7 @@ int drmBOUnReference(int fd, drmBO *buf)
if (buf->mapVirtual && (buf->type != drm_bo_type_fake)) {
- (void) drmUnmap(buf->mapVirtual, buf->start + buf->size);
+ (void) munmap(buf->mapVirtual, buf->start + buf->size);
buf->mapVirtual = NULL;
buf->virtual = NULL;
}
@@ -2847,8 +2850,12 @@ int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
if (!buf->virtual && buf->type != drm_bo_type_fake) {
drmAddress virtual;
- ret = drmMap(fd, buf->mapHandle, buf->size + buf->start, &virtual);
- if (ret)
+ virtual = mmap(0, buf->size + buf->start,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, buf->mapHandle);
+ if (virtual == MAP_FAILED)
+ ret = -errno;
+ if (ret)
return ret;
buf->mapVirtual = virtual;
buf->virtual = ((char *) virtual) + buf->start;