anv: track vram only BOs to print things out on ENOMEM execbuf

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21380>
This commit is contained in:
Lionel Landwerlin
2023-02-17 14:31:56 +02:00
committed by Marge Bot
parent 0aa44b107a
commit 18bf85468c
3 changed files with 14 additions and 5 deletions

View File

@@ -1499,6 +1499,8 @@ anv_device_alloc_bo(struct anv_device *device,
.has_implicit_ccs = ccs_size > 0 || .has_implicit_ccs = ccs_size > 0 ||
(device->info->verx10 >= 125 && !(alloc_flags & ANV_BO_ALLOC_NO_LOCAL_MEM)), (device->info->verx10 >= 125 && !(alloc_flags & ANV_BO_ALLOC_NO_LOCAL_MEM)),
.map_wc = alloc_flags & ANV_BO_ALLOC_WRITE_COMBINE, .map_wc = alloc_flags & ANV_BO_ALLOC_WRITE_COMBINE,
.vram_only = nregions == 1 &&
regions[0] == device->physical->vram_non_mappable.region,
}; };
if (alloc_flags & ANV_BO_ALLOC_MAPPED) { if (alloc_flags & ANV_BO_ALLOC_MAPPED) {

View File

@@ -538,6 +538,9 @@ struct anv_bo {
/** True if this BO should be mapped with Write Combine enabled */ /** True if this BO should be mapped with Write Combine enabled */
bool map_wc:1; bool map_wc:1;
/** True if this BO can only live in VRAM */
bool vram_only:1;
}; };
static inline struct anv_bo * static inline struct anv_bo *

View File

@@ -553,23 +553,27 @@ anv_queue_exec_utrace_locked(struct anv_queue *queue,
static void static void
anv_i915_debug_submit(const struct anv_execbuf *execbuf) anv_i915_debug_submit(const struct anv_execbuf *execbuf)
{ {
uint32_t total_size_kb = 0; uint32_t total_size_kb = 0, total_vram_only_size_kb = 0;
for (uint32_t i = 0; i < execbuf->bo_count; i++) { for (uint32_t i = 0; i < execbuf->bo_count; i++) {
const struct anv_bo *bo = execbuf->bos[i]; const struct anv_bo *bo = execbuf->bos[i];
total_size_kb += bo->size / 1024; total_size_kb += bo->size / 1024;
if (bo->vram_only)
total_vram_only_size_kb += bo->size / 1024;
} }
fprintf(stderr, "Batch offset=0x%x len=0x%x on queue 0 (%.1fMb aperture)\n", fprintf(stderr, "Batch offset=0x%x len=0x%x on queue 0 (aperture: %.1fMb, %.1fMb VRAM only)\n",
execbuf->execbuf.batch_start_offset, execbuf->execbuf.batch_len, execbuf->execbuf.batch_start_offset, execbuf->execbuf.batch_len,
(float)total_size_kb / 1024.0f); (float)total_size_kb / 1024.0f,
(float)total_vram_only_size_kb / 1024.0f);
for (uint32_t i = 0; i < execbuf->bo_count; i++) { for (uint32_t i = 0; i < execbuf->bo_count; i++) {
const struct anv_bo *bo = execbuf->bos[i]; const struct anv_bo *bo = execbuf->bos[i];
uint64_t size = bo->size + bo->_ccs_size; uint64_t size = bo->size + bo->_ccs_size;
fprintf(stderr, " BO: addr=0x%016"PRIx64"-0x%016"PRIx64" size=%7"PRIu64 fprintf(stderr, " BO: addr=0x%016"PRIx64"-0x%016"PRIx64" size=%7"PRIu64
"KB handle=%05u capture=%u name=%s\n", "KB handle=%05u capture=%u vram_only=%u name=%s\n",
bo->offset, bo->offset + size - 1, size / 1024, bo->gem_handle, bo->offset, bo->offset + size - 1, size / 1024, bo->gem_handle,
(bo->flags & EXEC_OBJECT_CAPTURE) != 0, bo->name); (bo->flags & EXEC_OBJECT_CAPTURE) != 0,
bo->vram_only, bo->name);
} }
} }