aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-08-16 18:07:57 +0100
committerThomas White <taw@bitwiz.org.uk>2009-10-17 12:31:13 +0200
commitea466a048d5b2365f5263162273ec12d7480025f (patch)
tree9ed4eedb5e71089e9a0095170deb12056a640048
parent9c4a6af856e69cf15aae9d0a3aee59961d9b1c8f (diff)
Map counting fixes
-rw-r--r--libdrm/glamo/glamo_bo_gem.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libdrm/glamo/glamo_bo_gem.c b/libdrm/glamo/glamo_bo_gem.c
index 048f477c..e76f9aa6 100644
--- a/libdrm/glamo/glamo_bo_gem.c
+++ b/libdrm/glamo/glamo_bo_gem.c
@@ -174,6 +174,10 @@ static struct glamo_bo *bo_unref(struct glamo_bo *bo)
return bo;
}
if (bo_gem->map_count) {
+ fprintf(stderr, "Map count for %p isn't zero (=%i),"
+ " so I am unmapping it (%p, %i)\n",
+ bo_gem, bo_gem->map_count, bo->virtual,
+ bo->size);
munmap(bo->virtual, bo->size);
}
@@ -224,6 +228,7 @@ static int bo_map(struct glamo_bo *bo, int write)
strerror(errno));
return errno;
}
+ bo_gem->map_count++;
}
return 0;
@@ -233,6 +238,12 @@ static int bo_unmap(struct glamo_bo *bo)
{
struct glamo_bo_gem *bo_gem = (struct glamo_bo_gem*)bo;
+ if ( bo_gem->map_count == 0 ) {
+ fprintf(stderr, "Not unmapping %p, because its map count"
+ " is already zero.\n", bo_gem);
+ return 0;
+ }
+
if (--bo_gem->map_count > 0) {
return 0;
}