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>2010-05-23 09:51:33 +0200
commit3465d3faefe43560fafc5329beb55de8da5c1194 (patch)
treedc11f928c94c51557b6440b8a8df565188978ecf
parent09b23ff11c86cfe0d21c28fd26032d2de2357a93 (diff)
Single point of truth for the virtual address
-rw-r--r--glamo/glamo_bo_gem.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/glamo/glamo_bo_gem.c b/glamo/glamo_bo_gem.c
index b5bbc180..43d847de 100644
--- a/glamo/glamo_bo_gem.c
+++ b/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;
}