aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-08-04 20:24:32 +0100
committerThomas White <taw@bitwiz.org.uk>2009-10-17 12:31:13 +0200
commit6f50d90f8f7f48d4443a33cab6fb435201394960 (patch)
tree6ec3fd70e14b5efad54d55ebac62067f90819269
parent31c3b1274559c6e1175f09da75b2ae5ef420543d (diff)
Single point of truth for the virtual address
-rw-r--r--libdrm/glamo/glamo_bo_gem.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/libdrm/glamo/glamo_bo_gem.c b/libdrm/glamo/glamo_bo_gem.c
index b5bbc180..43d847de 100644
--- a/libdrm/glamo/glamo_bo_gem.c
+++ b/libdrm/glamo/glamo_bo_gem.c
@@ -54,7 +54,6 @@ struct glamo_bo_gem {
struct glamo_bo base;
uint32_t name;
int map_count;
- void *virtual;
};
struct bo_manager_gem {
@@ -85,7 +84,7 @@ static struct glamo_bo *bo_open(struct glamo_bo_manager *bom,
bo->base.domains = domains;
bo->base.flags = flags;
bo->map_count = 0;
- bo->virtual = NULL;
+ bo->base.virtual = NULL;
if (handle) {
struct drm_gem_open open_arg;
@@ -160,7 +159,7 @@ static int bo_map(struct glamo_bo *bo, int write)
bufmgr = (struct glamo_bo_manager*)bo->bom;
/* Get a mapping of the buffer if we haven't before. */
- if (bo_gem->virtual == NULL) {
+ if (bo->virtual == NULL) {
struct drm_glamo_gem_mmap mmap_arg;
@@ -177,14 +176,11 @@ static int bo_map(struct glamo_bo *bo, int write)
strerror(errno));
return ret;
}
- fprintf(stderr, "offset=%8llx\n",
- (long long int)mmap_arg.offset);
-
/* and mmap it */
- bo_gem->virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
+ bo->virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
MAP_SHARED, bufmgr->fd,
mmap_arg.offset);
- if (bo_gem->virtual == MAP_FAILED) {
+ if (bo->virtual == MAP_FAILED) {
fprintf(stderr,
"%s:%d: Error mapping buffer %d (%d): %s .\n",
__FILE__, __LINE__,
@@ -194,11 +190,6 @@ static int bo_map(struct glamo_bo *bo, int write)
}
}
- bo->virtual = bo_gem->virtual;
-
- printf("bo_map: %d (%d) -> %p\n", bo->handle, bo_gem->name,
- bo_gem->virtual);
-
return 0;
}
@@ -211,7 +202,6 @@ static int bo_unmap(struct glamo_bo *bo)
}
munmap(bo->virtual, bo->size);
bo->virtual = NULL;
- bo_gem->virtual = NULL;
return 0;
}