summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-09-11 21:49:24 +0200
committerMarek Olšák <[email protected]>2016-09-13 20:38:25 +0200
commit35d284d08e3402bb6dabb885fddcf8fc28e73ca5 (patch)
tree7ea59187ff6369185479d92247b10fa06e4e6b11
parent6df872df591d9696829353dbb27f22a34c4743bd (diff)
winsys/amdgpu: don't assume GTT if the VRAM flag isn't set
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index a6d4aa4aaa2..5b099b09a63 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -145,7 +145,7 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf)
if (bo->map_count >= 1) {
if (bo->initial_domain & RADEON_DOMAIN_VRAM)
bo->ws->mapped_vram -= bo->base.size;
- else
+ else if (bo->initial_domain & RADEON_DOMAIN_GTT)
bo->ws->mapped_gtt -= bo->base.size;
}
@@ -261,7 +261,7 @@ static void *amdgpu_bo_map(struct pb_buffer *buf,
if (p_atomic_inc_return(&bo->map_count) == 1) {
if (bo->initial_domain & RADEON_DOMAIN_VRAM)
bo->ws->mapped_vram += bo->base.size;
- else
+ else if (bo->initial_domain & RADEON_DOMAIN_GTT)
bo->ws->mapped_gtt += bo->base.size;
}
return cpu;
@@ -277,7 +277,7 @@ static void amdgpu_bo_unmap(struct pb_buffer *buf)
if (p_atomic_dec_zero(&bo->map_count)) {
if (bo->initial_domain & RADEON_DOMAIN_VRAM)
bo->ws->mapped_vram -= bo->base.size;
- else
+ else if (bo->initial_domain & RADEON_DOMAIN_GTT)
bo->ws->mapped_gtt -= bo->base.size;
}