radv: Use internal allocation helpers for internal allocations

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17331>
This commit is contained in:
Friedrich Vock
2022-12-07 13:12:44 +01:00
committed by Marge Bot
parent 845792db73
commit d816859ede
26 changed files with 231 additions and 173 deletions

View File

@@ -128,12 +128,13 @@ find_memory_index(VkDevice _device, VkMemoryPropertyFlags flags)
static VkResult
rra_init_accel_struct_data_buffer(VkDevice vk_device, struct radv_rra_accel_struct_data *data)
{
RADV_FROM_HANDLE(radv_device, device, vk_device);
VkBufferCreateInfo buffer_create_info = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.size = data->size,
};
VkResult result = radv_CreateBuffer(vk_device, &buffer_create_info, NULL, &data->buffer);
VkResult result = radv_create_buffer(device, &buffer_create_info, NULL, &data->buffer, true);
if (result != VK_SUCCESS)
return result;
@@ -153,7 +154,7 @@ rra_init_accel_struct_data_buffer(VkDevice vk_device, struct radv_rra_accel_stru
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
VK_MEMORY_PROPERTY_HOST_CACHED_BIT),
};
result = radv_AllocateMemory(vk_device, &alloc_info, NULL, &data->memory);
result = radv_alloc_memory(device, &alloc_info, NULL, &data->memory, true);
if (result != VK_SUCCESS)
goto fail_buffer;
@@ -200,8 +201,7 @@ rra_CreateAccelerationStructureKHR(VkDevice _device,
.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
};
result =
radv_CreateEvent(radv_device_to_handle(device), &eventCreateInfo, NULL, &data->build_event);
result = radv_create_event(device, &eventCreateInfo, NULL, &data->build_event, true);
if (result != VK_SUCCESS)
goto fail_data;

View File

@@ -417,9 +417,8 @@ create_build_pipeline_spv(struct radv_device *device, const uint32_t *spv, uint3
.layout = *layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&pipeline_info, &device->meta_state.alloc, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&pipeline_info, &device->meta_state.alloc, pipeline, true);
cleanup:
device->vk.dispatch_table.DestroyShaderModule(radv_device_to_handle(device), module,

View File

@@ -188,7 +188,7 @@ radv_image_from_gralloc(VkDevice device_h, const VkImageCreateInfo *base_info,
.no_metadata_planes = true,
.bo_metadata = &md,
},
alloc, &image_h);
alloc, &image_h, false);
if (result != VK_SUCCESS)
goto fail_create_image;

View File

@@ -781,12 +781,12 @@ radv_destroy_descriptor_pool(struct radv_device *device, const VkAllocationCallb
vk_free2(&device->vk.alloc, pAllocator, pool);
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateDescriptorPool(VkDevice _device, const VkDescriptorPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDescriptorPool *pDescriptorPool)
VkResult
radv_create_descriptor_pool(struct radv_device *device,
const VkDescriptorPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDescriptorPool *pDescriptorPool, bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
struct radv_descriptor_pool *pool;
uint64_t size = sizeof(struct radv_descriptor_pool);
uint64_t bo_size = 0, bo_count = 0, range_count = 0;
@@ -927,6 +927,15 @@ radv_CreateDescriptorPool(VkDevice _device, const VkDescriptorPoolCreateInfo *pC
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateDescriptorPool(VkDevice _device, const VkDescriptorPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDescriptorPool *pDescriptorPool)
{
RADV_FROM_HANDLE(radv_device, device, _device);
return radv_create_descriptor_pool(device, pCreateInfo, pAllocator, pDescriptorPool, false);
}
VKAPI_ATTR void VKAPI_CALL
radv_DestroyDescriptorPool(VkDevice _device, VkDescriptorPool _pool,
const VkAllocationCallbacks *pAllocator)

View File

@@ -3371,8 +3371,9 @@ radv_device_init_vrs_state(struct radv_device *device)
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
};
result = radv_CreateImage(radv_device_to_handle(device), &image_create_info,
&device->meta_state.alloc, &image);
result = radv_image_create(radv_device_to_handle(device),
&(struct radv_image_create_info){.vk_info = &image_create_info},
&device->meta_state.alloc, &image, true);
if (result != VK_SUCCESS)
return result;
@@ -3383,8 +3384,8 @@ radv_device_init_vrs_state(struct radv_device *device)
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
};
result = radv_CreateBuffer(radv_device_to_handle(device), &buffer_create_info,
&device->meta_state.alloc, &buffer);
result =
radv_create_buffer(device, &buffer_create_info, &device->meta_state.alloc, &buffer, true);
if (result != VK_SUCCESS)
goto fail_create;
@@ -3402,8 +3403,7 @@ radv_device_init_vrs_state(struct radv_device *device)
.allocationSize = mem_req.memoryRequirements.size,
};
result = radv_AllocateMemory(radv_device_to_handle(device), &alloc_info,
&device->meta_state.alloc, &mem);
result = radv_alloc_memory(device, &alloc_info, &device->meta_state.alloc, &mem, true);
if (result != VK_SUCCESS)
goto fail_alloc;
@@ -5949,9 +5949,9 @@ radv_free_memory(struct radv_device *device, const VkAllocationCallbacks *pAlloc
vk_free2(&device->vk.alloc, pAllocator, mem);
}
static VkResult
VkResult
radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAllocateInfo,
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMem)
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMem, bool is_internal)
{
struct radv_device_memory *mem;
VkResult result;
@@ -6164,7 +6164,7 @@ radv_AllocateMemory(VkDevice _device, const VkMemoryAllocateInfo *pAllocateInfo,
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMem)
{
RADV_FROM_HANDLE(radv_device, device, _device);
return radv_alloc_memory(device, pAllocateInfo, pAllocator, pMem);
return radv_alloc_memory(device, pAllocateInfo, pAllocator, pMem, false);
}
VKAPI_ATTR void VKAPI_CALL
@@ -6345,7 +6345,8 @@ radv_GetDeviceImageMemoryRequirements(VkDevice device,
* creating an image.
* TODO: Avoid creating an image.
*/
result = radv_CreateImage(device, pInfo->pCreateInfo, NULL, &image);
result = radv_image_create(
device, &(struct radv_image_create_info){.vk_info = pInfo->pCreateInfo}, NULL, &image, true);
assert(result == VK_SUCCESS);
VkImageMemoryRequirementsInfo2 info2 = {
@@ -6464,11 +6465,10 @@ radv_destroy_event(struct radv_device *device, const VkAllocationCallbacks *pAll
vk_free2(&device->vk.alloc, pAllocator, event);
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateEvent(VkDevice _device, const VkEventCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkEvent *pEvent)
VkResult
radv_create_event(struct radv_device *device, const VkEventCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkEvent *pEvent, bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
enum radeon_bo_domain bo_domain;
enum radeon_bo_flag bo_flags;
struct radv_event *event;
@@ -6511,6 +6511,18 @@ radv_CreateEvent(VkDevice _device, const VkEventCreateInfo *pCreateInfo,
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateEvent(VkDevice _device, const VkEventCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkEvent *pEvent)
{
RADV_FROM_HANDLE(radv_device, device, _device);
VkResult result = radv_create_event(device, pCreateInfo, pAllocator, pEvent, false);
if (result != VK_SUCCESS)
return result;
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
radv_DestroyEvent(VkDevice _device, VkEvent _event, const VkAllocationCallbacks *pAllocator)
{
@@ -6588,11 +6600,10 @@ radv_destroy_buffer(struct radv_device *device, const VkAllocationCallbacks *pAl
vk_free2(&device->vk.alloc, pAllocator, buffer);
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateBuffer(VkDevice _device, const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
VkResult
radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer, bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
struct radv_buffer *buffer;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
@@ -6631,6 +6642,14 @@ radv_CreateBuffer(VkDevice _device, const VkBufferCreateInfo *pCreateInfo,
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateBuffer(VkDevice _device, const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
{
RADV_FROM_HANDLE(radv_device, device, _device);
return radv_create_buffer(device, pCreateInfo, pAllocator, pBuffer, false);
}
VKAPI_ATTR void VKAPI_CALL
radv_DestroyBuffer(VkDevice _device, VkBuffer _buffer, const VkAllocationCallbacks *pAllocator)
{

View File

@@ -963,9 +963,9 @@ radv_device_init_dgc_prepare_state(struct radv_device *device)
.layout = device->meta_state.dgc_prepare.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&pipeline_info, &device->meta_state.alloc, &device->meta_state.dgc_prepare.pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&pipeline_info, &device->meta_state.alloc,
&device->meta_state.dgc_prepare.pipeline, true);
if (result != VK_SUCCESS)
goto cleanup;

View File

@@ -1999,7 +1999,8 @@ radv_GetDeviceImageSparseMemoryRequirements(VkDevice device,
* creating an image.
* TODO: Avoid creating an image.
*/
result = radv_CreateImage(device, pInfo->pCreateInfo, NULL, &image);
result = radv_image_create(
device, &(struct radv_image_create_info){.vk_info = pInfo->pCreateInfo}, NULL, &image, true);
assert(result == VK_SUCCESS);
VkImageSparseMemoryRequirementsInfo2 info2 = {

View File

@@ -1833,7 +1833,7 @@ radv_select_modifier(const struct radv_device *dev, VkFormat format,
VkResult
radv_image_create(VkDevice _device, const struct radv_image_create_info *create_info,
const VkAllocationCallbacks *alloc, VkImage *pImage)
const VkAllocationCallbacks *alloc, VkImage *pImage, bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
@@ -2428,7 +2428,7 @@ radv_CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
.scanout = scanout,
.prime_blit_src = prime_blit_src,
},
pAllocator, pImage);
pAllocator, pImage, false);
}
VKAPI_ATTR void VKAPI_CALL

View File

@@ -815,9 +815,9 @@ build_pipeline(struct radv_device *device, VkImageAspectFlagBits aspect,
const struct radv_graphics_pipeline_create_info radv_pipeline_info = {.use_rectlist = true};
result = radv_graphics_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info, &device->meta_state.alloc, pipeline);
result = radv_graphics_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info,
&device->meta_state.alloc, pipeline, true);
ralloc_free(vs);
ralloc_free(fs);
mtx_unlock(&device->meta_state.mtx);

View File

@@ -748,9 +748,9 @@ blit2d_init_color_pipeline(struct radv_device *device, enum blit2d_src_type src_
const struct radv_graphics_pipeline_create_info radv_pipeline_info = {.use_rectlist = true};
result = radv_graphics_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info, &device->meta_state.alloc,
&device->meta_state.blit2d[log2_samples].pipelines[src_type][fs_key]);
radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info,
&radv_pipeline_info, &device->meta_state.alloc,
&device->meta_state.blit2d[log2_samples].pipelines[src_type][fs_key], true);
ralloc_free(vs);
ralloc_free(fs);
@@ -905,9 +905,9 @@ blit2d_init_depth_only_pipeline(struct radv_device *device, enum blit2d_src_type
const struct radv_graphics_pipeline_create_info radv_pipeline_info = {.use_rectlist = true};
result = radv_graphics_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info, &device->meta_state.alloc,
&device->meta_state.blit2d[log2_samples].depth_only_pipeline[src_type]);
radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info,
&radv_pipeline_info, &device->meta_state.alloc,
&device->meta_state.blit2d[log2_samples].depth_only_pipeline[src_type], true);
ralloc_free(vs);
ralloc_free(fs);
@@ -1059,9 +1059,9 @@ blit2d_init_stencil_only_pipeline(struct radv_device *device, enum blit2d_src_ty
const struct radv_graphics_pipeline_create_info radv_pipeline_info = {.use_rectlist = true};
result = radv_graphics_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info, &device->meta_state.alloc,
&device->meta_state.blit2d[log2_samples].stencil_only_pipeline[src_type]);
radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info,
&radv_pipeline_info, &device->meta_state.alloc,
&device->meta_state.blit2d[log2_samples].stencil_only_pipeline[src_type], true);
ralloc_free(vs);
ralloc_free(fs);

View File

@@ -117,9 +117,9 @@ radv_device_init_meta_buffer_state(struct radv_device *device)
.layout = device->meta_state.buffer.fill_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&fill_vk_pipeline_info, NULL, &device->meta_state.buffer.fill_pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&fill_vk_pipeline_info, NULL,
&device->meta_state.buffer.fill_pipeline, true);
if (result != VK_SUCCESS)
goto fail;
@@ -138,9 +138,9 @@ radv_device_init_meta_buffer_state(struct radv_device *device)
.layout = device->meta_state.buffer.copy_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&copy_vk_pipeline_info, NULL, &device->meta_state.buffer.copy_pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&copy_vk_pipeline_info, NULL,
&device->meta_state.buffer.copy_pipeline, true);
if (result != VK_SUCCESS)
goto fail;

View File

@@ -154,9 +154,9 @@ radv_device_init_meta_itob_state(struct radv_device *device)
.layout = device->meta_state.itob.img_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&vk_pipeline_info, NULL, &device->meta_state.itob.pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL, &device->meta_state.itob.pipeline,
true);
if (result != VK_SUCCESS)
goto fail;
@@ -175,9 +175,9 @@ radv_device_init_meta_itob_state(struct radv_device *device)
.layout = device->meta_state.itob.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info_3d, NULL, &device->meta_state.itob.pipeline_3d);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info_3d, NULL,
&device->meta_state.itob.pipeline_3d, true);
if (result != VK_SUCCESS)
goto fail;
@@ -332,9 +332,9 @@ radv_device_init_meta_btoi_state(struct radv_device *device)
.layout = device->meta_state.btoi.img_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&vk_pipeline_info, NULL, &device->meta_state.btoi.pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL, &device->meta_state.btoi.pipeline,
true);
if (result != VK_SUCCESS)
goto fail;
@@ -353,9 +353,9 @@ radv_device_init_meta_btoi_state(struct radv_device *device)
.layout = device->meta_state.btoi.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info_3d, NULL, &device->meta_state.btoi.pipeline_3d);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info_3d, NULL,
&device->meta_state.btoi.pipeline_3d, true);
ralloc_free(cs_3d);
ralloc_free(cs);
@@ -507,9 +507,9 @@ radv_device_init_meta_btoi_r32g32b32_state(struct radv_device *device)
.layout = device->meta_state.btoi_r32g32b32.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info, NULL, &device->meta_state.btoi_r32g32b32.pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL,
&device->meta_state.btoi_r32g32b32.pipeline, true);
fail:
ralloc_free(cs);
@@ -623,9 +623,8 @@ create_itoi_pipeline(struct radv_device *device, int samples, VkPipeline *pipeli
.layout = state->itoi.img_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
state->cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache,
&vk_pipeline_info, NULL, pipeline, true);
ralloc_free(cs);
return result;
}
@@ -701,9 +700,9 @@ radv_device_init_meta_itoi_state(struct radv_device *device)
.layout = device->meta_state.itoi.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info_3d, NULL, &device->meta_state.itoi.pipeline_3d);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info_3d, NULL,
&device->meta_state.itoi.pipeline_3d, true);
ralloc_free(cs_3d);
return VK_SUCCESS;
@@ -862,9 +861,9 @@ radv_device_init_meta_itoi_r32g32b32_state(struct radv_device *device)
.layout = device->meta_state.itoi_r32g32b32.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info, NULL, &device->meta_state.itoi_r32g32b32.pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL,
&device->meta_state.itoi_r32g32b32.pipeline, true);
fail:
ralloc_free(cs);
@@ -942,9 +941,8 @@ create_cleari_pipeline(struct radv_device *device, int samples, VkPipeline *pipe
.layout = device->meta_state.cleari.img_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL, pipeline, true);
ralloc_free(cs);
return result;
}
@@ -1015,9 +1013,9 @@ radv_device_init_meta_cleari_state(struct radv_device *device)
.layout = device->meta_state.cleari.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info_3d, NULL, &device->meta_state.cleari.pipeline_3d);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info_3d, NULL,
&device->meta_state.cleari.pipeline_3d, true);
ralloc_free(cs_3d);
return VK_SUCCESS;
@@ -1133,9 +1131,9 @@ radv_device_init_meta_cleari_r32g32b32_state(struct radv_device *device)
.layout = device->meta_state.cleari_r32g32b32.img_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info, NULL, &device->meta_state.cleari_r32g32b32.pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL,
&device->meta_state.cleari_r32g32b32.pipeline, true);
fail:
ralloc_free(cs);
@@ -1251,15 +1249,15 @@ create_buffer_from_image(struct radv_cmd_buffer *cmd_buffer, struct radv_meta_bl
radv_device_memory_init(&mem, device, surf->image->bindings[0].bo);
radv_CreateBuffer(radv_device_to_handle(device),
&(VkBufferCreateInfo){
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.flags = 0,
.size = surf->image->size,
.usage = usage,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
},
NULL, buffer);
radv_create_buffer(device,
&(VkBufferCreateInfo){
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.flags = 0,
.size = surf->image->size,
.usage = usage,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
},
NULL, buffer, true);
radv_BindBufferMemory2(radv_device_to_handle(device), 1,
(VkBindBufferMemoryInfo[]){{

View File

@@ -162,7 +162,7 @@ create_pipeline(struct radv_device *device, uint32_t samples,
.renderPass = VK_NULL_HANDLE,
.subpass = 0,
},
extra, alloc, pipeline);
extra, alloc, pipeline, true);
ralloc_free(vs_nir);
ralloc_free(fs_nir);
@@ -953,9 +953,9 @@ init_meta_clear_htile_mask_state(struct radv_device *device)
.layout = state->clear_htile_mask_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
state->cache, 1,
&pipeline_info, NULL, &state->clear_htile_mask_pipeline);
result =
radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &pipeline_info,
NULL, &state->clear_htile_mask_pipeline, true);
fail:
ralloc_free(cs);
@@ -1033,9 +1033,8 @@ create_dcc_comp_to_single_pipeline(struct radv_device *device, bool is_msaa, VkP
.layout = state->clear_dcc_comp_to_single_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
state->cache, 1,
&pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache,
&pipeline_info, NULL, pipeline, true);
ralloc_free(cs);
return result;

View File

@@ -202,9 +202,9 @@ radv_device_init_meta_copy_vrs_htile_state(struct radv_device *device,
.layout = state->copy_vrs_htile_p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
state->cache, 1,
&pipeline_info, NULL, &state->copy_vrs_htile_pipeline);
result =
radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &pipeline_info,
NULL, &state->copy_vrs_htile_pipeline, true);
fail:
ralloc_free(cs);
return result;

View File

@@ -166,9 +166,9 @@ radv_device_init_meta_dcc_retile_state(struct radv_device *device, struct radeon
.layout = device->meta_state.dcc_retile.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info, NULL, &device->meta_state.dcc_retile.pipeline[surf->u.gfx9.swizzle_mode]);
result = radv_compute_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, NULL,
&device->meta_state.dcc_retile.pipeline[surf->u.gfx9.swizzle_mode], true);
if (result != VK_SUCCESS)
goto cleanup;

View File

@@ -290,9 +290,8 @@ create_pipeline(struct radv_device *device, uint32_t samples, VkPipelineLayout l
.resummarize_enable = op == DEPTH_RESUMMARIZE,
};
result = radv_graphics_pipeline_create(
device_h, device->meta_state.cache, &pipeline_create_info,
&extra, &device->meta_state.alloc, pipeline);
result = radv_graphics_pipeline_create(device_h, device->meta_state.cache, &pipeline_create_info,
&extra, &device->meta_state.alloc, pipeline, true);
cleanup:
ralloc_free(fs_module);

View File

@@ -594,9 +594,8 @@ create_decode_pipeline(struct radv_device *device, VkPipeline *pipeline)
.layout = device->meta_state.resolve_compute.p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL, pipeline, true);
if (result != VK_SUCCESS)
goto fail;

View File

@@ -135,10 +135,9 @@ create_dcc_compress_compute(struct radv_device *device)
.layout = device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&vk_pipeline_info, NULL,
&device->meta_state.fast_clear_flush.dcc_decompress_compute_pipeline);
result = radv_compute_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, NULL,
&device->meta_state.fast_clear_flush.dcc_decompress_compute_pipeline, true);
if (result != VK_SUCCESS)
goto cleanup;
@@ -275,7 +274,8 @@ create_pipeline(struct radv_device *device, VkShaderModule vs_module_h, VkPipeli
.use_rectlist = true,
.custom_blend_mode = V_028808_CB_ELIMINATE_FAST_CLEAR,
},
&device->meta_state.alloc, &device->meta_state.fast_clear_flush.cmask_eliminate_pipeline);
&device->meta_state.alloc, &device->meta_state.fast_clear_flush.cmask_eliminate_pipeline,
true);
if (result != VK_SUCCESS)
goto cleanup;
@@ -325,7 +325,8 @@ create_pipeline(struct radv_device *device, VkShaderModule vs_module_h, VkPipeli
.use_rectlist = true,
.custom_blend_mode = V_028808_CB_FMASK_DECOMPRESS,
},
&device->meta_state.alloc, &device->meta_state.fast_clear_flush.fmask_decompress_pipeline);
&device->meta_state.alloc, &device->meta_state.fast_clear_flush.fmask_decompress_pipeline,
true);
if (result != VK_SUCCESS)
goto cleanup;
@@ -377,7 +378,8 @@ create_pipeline(struct radv_device *device, VkShaderModule vs_module_h, VkPipeli
? V_028808_CB_DCC_DECOMPRESS_GFX11
: V_028808_CB_DCC_DECOMPRESS_GFX8,
},
&device->meta_state.alloc, &device->meta_state.fast_clear_flush.dcc_decompress_pipeline);
&device->meta_state.alloc, &device->meta_state.fast_clear_flush.dcc_decompress_pipeline,
true);
if (result != VK_SUCCESS)
goto cleanup;

View File

@@ -162,9 +162,8 @@ create_fmask_copy_pipeline(struct radv_device *device, int samples, VkPipeline *
.layout = state->fmask_copy.p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
state->cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache,
&vk_pipeline_info, NULL, pipeline, true);
ralloc_free(cs);
return result;
}

View File

@@ -214,9 +214,8 @@ create_fmask_expand_pipeline(struct radv_device *device, int samples, VkPipeline
.layout = state->fmask_expand.p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
state->cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache,
&vk_pipeline_info, NULL, pipeline, true);
ralloc_free(cs);
return result;

View File

@@ -174,7 +174,7 @@ create_pipeline(struct radv_device *device, VkShaderModule vs_module_h, VkFormat
.use_rectlist = true,
.custom_blend_mode = V_028808_CB_RESOLVE,
},
&device->meta_state.alloc, pipeline);
&device->meta_state.alloc, pipeline, true);
if (result != VK_SUCCESS)
goto cleanup;

View File

@@ -314,9 +314,8 @@ create_resolve_pipeline(struct radv_device *device, int samples, bool is_integer
.layout = device->meta_state.resolve_compute.p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL, pipeline, true);
if (result != VK_SUCCESS)
goto fail;
@@ -360,9 +359,8 @@ create_depth_stencil_resolve_pipeline(struct radv_device *device, int samples, i
.layout = device->meta_state.resolve_compute.p_layout,
};
result = radv_CreateComputePipelines(radv_device_to_handle(device),
device->meta_state.cache, 1,
&vk_pipeline_info, NULL, pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, NULL, pipeline, true);
if (result != VK_SUCCESS)
goto fail;

View File

@@ -218,9 +218,9 @@ create_resolve_pipeline(struct radv_device *device, int samples_log2, VkFormat f
const struct radv_graphics_pipeline_create_info radv_pipeline_info = {.use_rectlist = true};
result = radv_graphics_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info, &device->meta_state.alloc, pipeline);
result = radv_graphics_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info,
&device->meta_state.alloc, pipeline, true);
ralloc_free(vs);
ralloc_free(fs);
@@ -507,9 +507,9 @@ create_depth_stencil_resolve_pipeline(struct radv_device *device, int samples_lo
const struct radv_graphics_pipeline_create_info radv_pipeline_info = {.use_rectlist = true};
result = radv_graphics_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info, &device->meta_state.alloc, pipeline);
result = radv_graphics_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&vk_pipeline_info, &radv_pipeline_info,
&device->meta_state.alloc, pipeline, true);
ralloc_free(vs);
ralloc_free(fs);

View File

@@ -5269,8 +5269,8 @@ VkResult
radv_graphics_pipeline_create(VkDevice _device, VkPipelineCache _cache,
const VkGraphicsPipelineCreateInfo *pCreateInfo,
const struct radv_graphics_pipeline_create_info *extra,
const VkAllocationCallbacks *pAllocator,
VkPipeline *pPipeline)
const VkAllocationCallbacks *pAllocator, VkPipeline *pPipeline,
bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
@@ -5431,7 +5431,7 @@ radv_CreateGraphicsPipelines(VkDevice _device, VkPipelineCache pipelineCache, ui
pAllocator, &pPipelines[i]);
} else {
r = radv_graphics_pipeline_create(_device, pipelineCache, &pCreateInfos[i], NULL,
pAllocator, &pPipelines[i]);
pAllocator, &pPipelines[i], false);
}
if (r != VK_SUCCESS) {
result = r;
@@ -5557,7 +5557,8 @@ radv_compute_pipeline_init(struct radv_compute_pipeline *pipeline,
VkResult
radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
const VkComputePipelineCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkPipeline *pPipeline)
const VkAllocationCallbacks *pAllocator, VkPipeline *pPipeline,
bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
@@ -5594,10 +5595,10 @@ radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateComputePipelines(VkDevice _device, VkPipelineCache pipelineCache, uint32_t count,
const VkComputePipelineCreateInfo *pCreateInfos,
const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines)
static VkResult
radv_create_compute_pipelines(VkDevice _device, VkPipelineCache pipelineCache, uint32_t count,
const VkComputePipelineCreateInfo *pCreateInfos,
const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines)
{
VkResult result = VK_SUCCESS;
@@ -5605,7 +5606,7 @@ radv_CreateComputePipelines(VkDevice _device, VkPipelineCache pipelineCache, uin
for (; i < count; i++) {
VkResult r;
r = radv_compute_pipeline_create(_device, pipelineCache, &pCreateInfos[i], pAllocator,
&pPipelines[i]);
&pPipelines[i], false);
if (r != VK_SUCCESS) {
result = r;
pPipelines[i] = VK_NULL_HANDLE;
@@ -5621,6 +5622,15 @@ radv_CreateComputePipelines(VkDevice _device, VkPipelineCache pipelineCache, uin
return result;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateComputePipelines(VkDevice _device, VkPipelineCache pipelineCache, uint32_t count,
const VkComputePipelineCreateInfo *pCreateInfos,
const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines)
{
return radv_create_compute_pipelines(_device, pipelineCache, count, pCreateInfos, pAllocator,
pPipelines);
}
static uint32_t
radv_get_executable_count(struct radv_pipeline *pipeline)
{

View File

@@ -2216,12 +2216,13 @@ void radv_pipeline_init(struct radv_device *device, struct radv_pipeline *pipeli
VkResult radv_graphics_pipeline_create(VkDevice device, VkPipelineCache cache,
const VkGraphicsPipelineCreateInfo *pCreateInfo,
const struct radv_graphics_pipeline_create_info *extra,
const VkAllocationCallbacks *alloc, VkPipeline *pPipeline);
const VkAllocationCallbacks *alloc, VkPipeline *pPipeline,
bool is_internal);
VkResult radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
const VkComputePipelineCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkPipeline *pPipeline);
VkPipeline *pPipeline, bool is_internal);
void radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline,
const VkAllocationCallbacks *allocator);
@@ -2616,7 +2617,7 @@ radv_image_create_layout(struct radv_device *device, struct radv_image_create_in
struct radv_image *image);
VkResult radv_image_create(VkDevice _device, const struct radv_image_create_info *info,
const VkAllocationCallbacks *alloc, VkImage *pImage);
const VkAllocationCallbacks *alloc, VkImage *pImage, bool is_internal);
bool radv_are_formats_dcc_compatible(const struct radv_physical_device *pdev, const void *pNext,
VkFormat format, VkImageCreateFlags flags,
@@ -2829,6 +2830,24 @@ void radv_rra_trace_finish(VkDevice vk_device, struct radv_rra_trace_data *data)
bool radv_sdma_copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *image,
struct radv_buffer *buffer, const VkBufferImageCopy2 *region);
VkResult radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer,
bool is_internal);
VkResult radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAllocateInfo,
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMem,
bool is_internal);
VkResult radv_create_query_pool(struct radv_device *device,
const VkQueryPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool,
bool is_internal);
VkResult radv_create_descriptor_pool(struct radv_device *device,
const VkDescriptorPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDescriptorPool *pDescriptorPool, bool is_internal);
VkResult radv_create_event(struct radv_device *device, const VkEventCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkEvent *pEvent,
bool is_internal);
/* radv_sqtt_layer_.c */
struct radv_barrier_data {
union {

View File

@@ -816,9 +816,9 @@ radv_device_init_meta_query_state_internal(struct radv_device *device)
.layout = device->meta_state.query.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&occlusion_vk_pipeline_info, NULL, &device->meta_state.query.occlusion_query_pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&occlusion_vk_pipeline_info, NULL,
&device->meta_state.query.occlusion_query_pipeline, true);
if (result != VK_SUCCESS)
goto fail;
@@ -837,10 +837,10 @@ radv_device_init_meta_query_state_internal(struct radv_device *device)
.layout = device->meta_state.query.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
result = radv_compute_pipeline_create(
radv_device_to_handle(device), device->meta_state.cache,
&pipeline_statistics_vk_pipeline_info, NULL,
&device->meta_state.query.pipeline_statistics_query_pipeline);
&device->meta_state.query.pipeline_statistics_query_pipeline, true);
if (result != VK_SUCCESS)
goto fail;
@@ -859,9 +859,9 @@ radv_device_init_meta_query_state_internal(struct radv_device *device)
.layout = device->meta_state.query.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&tfb_pipeline_info, NULL, &device->meta_state.query.tfb_query_pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&tfb_pipeline_info, NULL,
&device->meta_state.query.tfb_query_pipeline, true);
if (result != VK_SUCCESS)
goto fail;
@@ -880,9 +880,9 @@ radv_device_init_meta_query_state_internal(struct radv_device *device)
.layout = device->meta_state.query.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&timestamp_pipeline_info, NULL, &device->meta_state.query.timestamp_query_pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&timestamp_pipeline_info, NULL,
&device->meta_state.query.timestamp_query_pipeline, true);
if (result != VK_SUCCESS)
goto fail;
@@ -901,9 +901,9 @@ radv_device_init_meta_query_state_internal(struct radv_device *device)
.layout = device->meta_state.query.p_layout,
};
result = radv_CreateComputePipelines(
radv_device_to_handle(device), device->meta_state.cache, 1,
&pg_pipeline_info, NULL, &device->meta_state.query.pg_query_pipeline);
result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache,
&pg_pipeline_info, NULL,
&device->meta_state.query.pg_query_pipeline, true);
fail:
ralloc_free(occlusion_cs);
@@ -1066,11 +1066,11 @@ radv_destroy_query_pool(struct radv_device *device, const VkAllocationCallbacks
vk_free2(&device->vk.alloc, pAllocator, pool);
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateQueryPool(VkDevice _device, const VkQueryPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool)
VkResult
radv_create_query_pool(struct radv_device *device, const VkQueryPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool,
bool is_internal)
{
RADV_FROM_HANDLE(radv_device, device, _device);
VkResult result;
size_t pool_struct_size = pCreateInfo->queryType == VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR
? sizeof(struct radv_pc_query_pool)
@@ -1165,6 +1165,14 @@ radv_CreateQueryPool(VkDevice _device, const VkQueryPoolCreateInfo *pCreateInfo,
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateQueryPool(VkDevice _device, const VkQueryPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool)
{
RADV_FROM_HANDLE(radv_device, device, _device);
return radv_create_query_pool(device, pCreateInfo, pAllocator, pQueryPool, false);
}
VKAPI_ATTR void VKAPI_CALL
radv_DestroyQueryPool(VkDevice _device, VkQueryPool _pool, const VkAllocationCallbacks *pAllocator)
{