zink: add ZINK_DEBUG=map

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21425>
This commit is contained in:
Mike Blumenkrantz
2023-02-20 09:01:32 -05:00
committed by Marge Bot
parent 03610a5aab
commit 26aedae568
4 changed files with 13 additions and 0 deletions
+2
View File
@@ -295,6 +295,8 @@ variable:
Enable renderpass optimizations (for tiling GPUs)
``norp``
Disable renderpass optimizations (for tiling GPUs)
``map``
Print info about mapped VRAM
Vulkan Validation Layers
^^^^^^^^^^^^^^^^^^^^^^^^
+8
View File
@@ -702,6 +702,10 @@ zink_bo_map(struct zink_screen *screen, struct zink_bo *bo)
simple_mtx_unlock(&real->lock);
return NULL;
}
if (unlikely(zink_debug & ZINK_DEBUG_MAP)) {
p_atomic_add(&screen->mapped_vram, real->base.size);
mesa_loge("NEW MAP(%"PRIu64") TOTAL(%"PRIu64")", real->base.size, screen->mapped_vram);
}
p_atomic_set(&real->u.real.cpu_ptr, cpu);
}
simple_mtx_unlock(&real->lock);
@@ -720,6 +724,10 @@ zink_bo_unmap(struct zink_screen *screen, struct zink_bo *bo)
if (p_atomic_dec_zero(&real->u.real.map_count)) {
p_atomic_set(&real->u.real.cpu_ptr, NULL);
if (unlikely(zink_debug & ZINK_DEBUG_MAP)) {
p_atomic_add(&screen->mapped_vram, -real->base.size);
mesa_loge("UNMAP(%"PRIu64") TOTAL(%"PRIu64")", real->base.size, screen->mapped_vram);
}
VKSCR(UnmapMemory)(screen->dev, real->mem);
}
}
+1
View File
@@ -84,6 +84,7 @@ zink_debug_options[] = {
{ "shaderdb", ZINK_DEBUG_SHADERDB, "Do stuff to make shader-db work" },
{ "rp", ZINK_DEBUG_RP, "Enable renderpass tracking/optimizations" },
{ "norp", ZINK_DEBUG_NORP, "Disable renderpass tracking/optimizations" },
{ "map", ZINK_DEBUG_MAP, "Track amount of mapped VRAM" },
DEBUG_NAMED_VALUE_END
};
+2
View File
@@ -219,6 +219,7 @@ enum zink_debug {
ZINK_DEBUG_SHADERDB = (1<<8),
ZINK_DEBUG_RP = (1<<9),
ZINK_DEBUG_NORP = (1<<10),
ZINK_DEBUG_MAP = (1<<11),
};
@@ -1319,6 +1320,7 @@ struct zink_screen {
uint64_t total_video_mem;
uint64_t clamp_video_mem;
uint64_t total_mem;
uint64_t mapped_vram;
VkInstance instance;
struct zink_instance_info instance_info;