anv: Add an aperture space summary to INTEL_DEBUG=submit.
authorEmma Anholt <emma@anholt.net>
Thu, 5 Jan 2023 21:32:04 +0000 (13:32 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 11 Jan 2023 00:35:34 +0000 (00:35 +0000)
Same as on iris, this is nice for tracking at a high level how much memory
is being used.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20540>

src/intel/vulkan/anv_batch_chain.c

index bd66a24..decc374 100644 (file)
@@ -1829,8 +1829,15 @@ anv_queue_exec_locked(struct anv_queue *queue,
       perf_query_pool && perf_query_pass >= 0 && cmd_buffer_count;
 
    if (INTEL_DEBUG(DEBUG_SUBMIT)) {
-      fprintf(stderr, "Batch offset=0x%x len=0x%x on queue 0\n",
-              execbuf.execbuf.batch_start_offset, execbuf.execbuf.batch_len);
+      uint32_t total_size_kb = 0;
+      for (uint32_t i = 0; i < execbuf.bo_count; i++) {
+         const struct anv_bo *bo = execbuf.bos[i];
+         total_size_kb += bo->size / 1024;
+      }
+
+      fprintf(stderr, "Batch offset=0x%x len=0x%x on queue 0 (%.1fMb aperture)\n",
+              execbuf.execbuf.batch_start_offset, execbuf.execbuf.batch_len,
+              (float)total_size_kb / 1024.0f);
       for (uint32_t i = 0; i < execbuf.bo_count; i++) {
          const struct anv_bo *bo = execbuf.bos[i];