diff options
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/glamo/glamo_bo_gem.c | 11 |
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; } |