diff --git a/src/nouveau/vulkan/nvk_device.c b/src/nouveau/vulkan/nvk_device.c index d3d962ed1fc..8db3aefa996 100644 --- a/src/nouveau/vulkan/nvk_device.c +++ b/src/nouveau/vulkan/nvk_device.c @@ -8,6 +8,8 @@ #include "vulkan/wsi/wsi_common.h" +#include "clc397.h" + static void nvk_slm_area_init(struct nvk_slm_area *area) { @@ -166,6 +168,15 @@ nvk_CreateDevice(VkPhysicalDevice physicalDevice, if (result != VK_SUCCESS) goto fail_images; + /* The I-cache pre-fetches and we don't really know by how much. Over- + * allocate shader BOs by 4K to ensure we don't run past. + */ + result = nvk_heap_init(device, &device->shader_heap, + NOUVEAU_WS_BO_LOCAL, NOUVEAU_WS_BO_WR, + 4096 /* overalloc */); + if (result != VK_SUCCESS) + goto fail_samplers; + nvk_slm_area_init(&device->slm); if (pthread_mutex_init(&device->mutex, NULL) != 0) { @@ -225,6 +236,8 @@ fail_mutex: pthread_mutex_destroy(&device->mutex); fail_slm: nvk_slm_area_finish(&device->slm); + nvk_heap_finish(device, &device->shader_heap); +fail_samplers: nvk_descriptor_table_finish(device, &device->samplers); fail_images: nvk_descriptor_table_finish(device, &device->images); @@ -254,6 +267,7 @@ nvk_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator) nouveau_ws_bo_destroy(device->zero_page); vk_device_finish(&device->vk); nvk_slm_area_finish(&device->slm); + nvk_heap_finish(device, &device->shader_heap); nvk_descriptor_table_finish(device, &device->samplers); nvk_descriptor_table_finish(device, &device->images); assert(list_is_empty(&device->memory_objects)); diff --git a/src/nouveau/vulkan/nvk_device.h b/src/nouveau/vulkan/nvk_device.h index fee3e34b19c..3a820020f10 100644 --- a/src/nouveau/vulkan/nvk_device.h +++ b/src/nouveau/vulkan/nvk_device.h @@ -4,6 +4,7 @@ #include "nvk_private.h" #include "nvk_descriptor_table.h" +#include "nvk_heap.h" #include "nvk_queue.h" #include "vk_device.h" #include "vk_meta.h" @@ -35,6 +36,7 @@ struct nvk_device { struct nvk_descriptor_table images; struct nvk_descriptor_table samplers; + struct nvk_heap shader_heap; struct nvk_slm_area slm; struct nouveau_ws_bo *zero_page; diff --git a/src/nouveau/vulkan/nvk_queue.c b/src/nouveau/vulkan/nvk_queue.c index 74fc9837a9c..c70949a9d45 100644 --- a/src/nouveau/vulkan/nvk_queue.c +++ b/src/nouveau/vulkan/nvk_queue.c @@ -12,6 +12,7 @@ #include "nvk_cla0c0.h" #include "cla1c0.h" #include "nvk_clc3c0.h" +#include "nvk_clc397.h" static void nvk_queue_state_init(struct nvk_queue_state *qs)