panvk: Map our standalone private BOs writeback when it makes sense

We can used CPU cached mappings for our private BOs being updated by
the CPU. We make the printf BO an exception to avoid having to
invalidate it every time we check the queue status.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36385>
This commit is contained in:
Faith Ekstrand 2025-07-28 12:27:32 -04:00 committed by Boris Brezillon
parent 5095e125c5
commit 3b711d687b
3 changed files with 15 additions and 3 deletions

View file

@ -145,8 +145,10 @@ panvk_per_arch(device_draw_context_init)(struct panvk_device *dev)
if (dev->draw_ctx == NULL)
return VK_ERROR_OUT_OF_HOST_MEMORY;
const uint32_t fns_bo_size = PROVOKING_VERTEX_FN_MAX_SIZE * 2 * MAX_RTS;
VkResult result = panvk_priv_bo_create(
dev, PROVOKING_VERTEX_FN_MAX_SIZE * 2 * MAX_RTS, 0,
dev, fns_bo_size,
panvk_device_adjust_bo_flags(dev, PAN_KMOD_BO_FLAG_WB_MMAP),
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE, &dev->draw_ctx->fns_bo);
if (result != VK_SUCCESS)
goto free_draw_ctx;
@ -183,6 +185,8 @@ panvk_per_arch(device_draw_context_init)(struct panvk_device *dev)
}
}
panvk_priv_bo_flush(dev->draw_ctx->fns_bo, 0, fns_bo_size);
return VK_SUCCESS;
free_draw_ctx:

View file

@ -312,7 +312,8 @@ panvk_per_arch(init_tiler_oom)(struct panvk_device *device)
{
const bool tracing_enabled = PANVK_DEBUG(TRACE);
VkResult result = panvk_priv_bo_create(
device, TILER_OOM_HANDLER_MAX_SIZE * 2 * MAX_RTS, 0,
device, TILER_OOM_HANDLER_MAX_SIZE * 2 * MAX_RTS,
panvk_device_adjust_bo_flags(device, PAN_KMOD_BO_FLAG_WB_MMAP),
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE, &device->tiler_oom.handlers_bo);
if (result != VK_SUCCESS)
return result;
@ -336,6 +337,7 @@ panvk_per_arch(init_tiler_oom)(struct panvk_device *device)
generate_tiler_oom_handler(device, handler_mem, zs_ext, rt_count,
tracing_enabled, &dump_region_size);
/* All handlers must have the same length */
assert(idx == 0 || handler_length == device->tiler_oom.handler_stride);
device->tiler_oom.handler_stride = handler_length;
@ -345,5 +347,8 @@ panvk_per_arch(init_tiler_oom)(struct panvk_device *device)
}
}
panvk_priv_bo_flush(device->tiler_oom.handlers_bo, 0,
pan_kmod_bo_size(device->tiler_oom.handlers_bo->bo));
return result;
}

View file

@ -480,12 +480,15 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device,
#endif
result = panvk_priv_bo_create(
device, pan_sample_positions_buffer_size(), 0,
device, pan_sample_positions_buffer_size(),
panvk_device_adjust_bo_flags(device, PAN_KMOD_BO_FLAG_WB_MMAP),
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE, &device->sample_positions);
if (result != VK_SUCCESS)
goto err_free_priv_bos;
pan_upload_sample_positions(device->sample_positions->addr.host);
panvk_priv_bo_flush(device->sample_positions, 0,
pan_sample_positions_buffer_size());
#if PAN_ARCH >= 10
result = panvk_per_arch(init_tiler_oom)(device);