mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +02:00
radv: save protected queue and non-protected queue seperately
Save protected radv_queue in device->queues_protected so it can be relased in radv_destroy_device. Without this, device->queues[] will point to a new queues to record the queue created according to the queueCreateInfo. When queueCreateInfo include both protected and unprotected queue info, the device->queues[] will be created twice and record one queue at each time. So we will lose either protected queue or unprotected queue which created first. Signed-off-by: Julia Zhang <Julia.Zhang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
This commit is contained in:
parent
0e36d7112c
commit
1f9d1366f8
2 changed files with 17 additions and 5 deletions
|
|
@ -1252,8 +1252,12 @@ radv_destroy_device(struct radv_device *device, const VkAllocationCallbacks *pAl
|
|||
for (unsigned i = 0; i < RADV_MAX_QUEUE_FAMILIES; i++) {
|
||||
for (unsigned q = 0; q < device->queue_count[i]; q++)
|
||||
radv_queue_finish(&device->queues[i][q]);
|
||||
for (unsigned q = 0; q < device->queue_count_protected[i]; q++)
|
||||
radv_queue_finish(&device->queues_protected[i][q]);
|
||||
if (device->queue_count[i])
|
||||
vk_free(&device->vk.alloc, device->queues[i]);
|
||||
if (device->queue_count_protected[i])
|
||||
vk_free(&device->vk.alloc, device->queues_protected[i]);
|
||||
}
|
||||
if (device->private_sdma_queue != VK_NULL_HANDLE) {
|
||||
radv_queue_finish(device->private_sdma_queue);
|
||||
|
|
@ -1437,17 +1441,23 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
|||
const VkDeviceQueueGlobalPriorityCreateInfo *global_priority =
|
||||
vk_find_struct_const(queue_create->pNext, DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO);
|
||||
|
||||
device->queues[qfi] = vk_zalloc(&device->vk.alloc, queue_create->queueCount * sizeof(struct radv_queue), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||
if (!device->queues[qfi]) {
|
||||
struct radv_queue **queues = queue_create->flags & VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT
|
||||
? &device->queues_protected[qfi]
|
||||
: &device->queues[qfi];
|
||||
*queues = vk_zalloc(&device->vk.alloc, queue_create->queueCount * sizeof(struct radv_queue), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||
if (!*queues) {
|
||||
result = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
device->queue_count[qfi] = queue_create->queueCount;
|
||||
if (queue_create->flags & VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT)
|
||||
device->queue_count_protected[qfi] = queue_create->queueCount;
|
||||
else
|
||||
device->queue_count[qfi] = queue_create->queueCount;
|
||||
|
||||
for (unsigned q = 0; q < queue_create->queueCount; q++) {
|
||||
result = radv_queue_init(device, &device->queues[qfi][q], q, queue_create, global_priority);
|
||||
result = radv_queue_init(device, &(*queues)[q], q, queue_create, global_priority);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,9 @@ struct radv_device {
|
|||
struct radv_meta_state meta_state;
|
||||
|
||||
struct radv_queue *queues[RADV_MAX_QUEUE_FAMILIES];
|
||||
struct radv_queue *queues_protected[RADV_MAX_QUEUE_FAMILIES];
|
||||
int queue_count[RADV_MAX_QUEUE_FAMILIES];
|
||||
int queue_count_protected[RADV_MAX_QUEUE_FAMILIES];
|
||||
|
||||
bool pbb_allowed;
|
||||
uint32_t scratch_waves;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue