mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-30 11:00:40 +00:00
vk/0.210.0: Rework vkQueueSubmit
This commit is contained in:
parent
5757ad2959
commit
4e904a0310
@ -1377,6 +1377,17 @@ typedef struct VkLayerProperties {
|
||||
char description[VK_MAX_DESCRIPTION_SIZE];
|
||||
} VkLayerProperties;
|
||||
|
||||
typedef struct VkSubmitInfo {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t waitSemaphoreCount;
|
||||
const VkSemaphore* pWaitSemaphores;
|
||||
uint32_t commandBufferCount;
|
||||
const VkCommandBuffer* pCommandBuffers;
|
||||
uint32_t signalSemaphoreCount;
|
||||
const VkSemaphore* pSignalSemaphores;
|
||||
} VkSubmitInfo;
|
||||
|
||||
typedef struct VkMemoryAllocateInfo {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
@ -2155,7 +2166,7 @@ typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysica
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
|
||||
typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers, VkFence fence);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
|
||||
@ -2367,8 +2378,8 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(
|
||||
VkQueue queue,
|
||||
uint32_t commandBufferCount,
|
||||
const VkCommandBuffer* pCommandBuffers,
|
||||
uint32_t submitCount,
|
||||
const VkSubmitInfo* pSubmits,
|
||||
VkFence fence);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(
|
||||
|
@ -808,8 +808,8 @@ void anv_GetDeviceQueue(
|
||||
|
||||
VkResult anv_QueueSubmit(
|
||||
VkQueue _queue,
|
||||
uint32_t commandBufferCount,
|
||||
const VkCommandBuffer* pCommandBuffers,
|
||||
uint32_t submitCount,
|
||||
const VkSubmitInfo* pSubmits,
|
||||
VkFence _fence)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_queue, queue, _queue);
|
||||
@ -817,29 +817,31 @@ VkResult anv_QueueSubmit(
|
||||
struct anv_device *device = queue->device;
|
||||
int ret;
|
||||
|
||||
for (uint32_t i = 0; i < commandBufferCount; i++) {
|
||||
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, pCommandBuffers[i]);
|
||||
for (uint32_t i = 0; i < submitCount; i++) {
|
||||
for (uint32_t j = 0; j < pSubmits[i].commandBufferCount; j++) {
|
||||
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer,
|
||||
pSubmits[i].pCommandBuffers[j]);
|
||||
assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||
|
||||
assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||
|
||||
ret = anv_gem_execbuffer(device, &cmd_buffer->execbuf2.execbuf);
|
||||
if (ret != 0) {
|
||||
/* We don't know the real error. */
|
||||
return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||
"execbuf2 failed: %m");
|
||||
}
|
||||
|
||||
if (fence) {
|
||||
ret = anv_gem_execbuffer(device, &fence->execbuf);
|
||||
ret = anv_gem_execbuffer(device, &cmd_buffer->execbuf2.execbuf);
|
||||
if (ret != 0) {
|
||||
/* We don't know the real error. */
|
||||
return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||
"execbuf2 failed: %m");
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < cmd_buffer->execbuf2.bo_count; i++)
|
||||
cmd_buffer->execbuf2.bos[i]->offset = cmd_buffer->execbuf2.objects[i].offset;
|
||||
if (fence) {
|
||||
ret = anv_gem_execbuffer(device, &fence->execbuf);
|
||||
if (ret != 0) {
|
||||
/* We don't know the real error. */
|
||||
return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||
"execbuf2 failed: %m");
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t k = 0; k < cmd_buffer->execbuf2.bo_count; k++)
|
||||
cmd_buffer->execbuf2.bos[k]->offset = cmd_buffer->execbuf2.objects[k].offset;
|
||||
}
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
@ -161,8 +161,12 @@ anv_dump_image_to_ppm(struct anv_device *device,
|
||||
}, NULL, &fence);
|
||||
assert(result == VK_SUCCESS);
|
||||
|
||||
result = anv_QueueSubmit(anv_queue_to_handle(&device->queue),
|
||||
1, &cmd, fence);
|
||||
result = anv_QueueSubmit(anv_queue_to_handle(&device->queue), 1,
|
||||
&(VkSubmitInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||
.commandBufferCount = 1,
|
||||
.pCommandBuffers = &cmd,
|
||||
}, fence);
|
||||
assert(result == VK_SUCCESS);
|
||||
|
||||
result = anv_WaitForFences(vk_device, 1, &fence, true, UINT64_MAX);
|
||||
|
Loading…
Reference in New Issue
Block a user