From 3465d3faefe43560fafc5329beb55de8da5c1194 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 4 Aug 2009 20:24:32 +0100 Subject: Single point of truth for the virtual address --- glamo/glamo_bo_gem.c | 18 ++++-------------- 1 file 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; } -- cgit v1.2.3