anv: Use a common vk_queue structure
Switch to using common structure. Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000>
This commit is contained in:
parent
cff01303b5
commit
1b085ff03a
|
@ -72,6 +72,7 @@
|
|||
#include "vk_shader_module.h"
|
||||
#include "vk_util.h"
|
||||
#include "vk_command_buffer.h"
|
||||
#include "vk_queue.h"
|
||||
|
||||
/* Pre-declarations needed for WSI entrypoints */
|
||||
struct wl_surface;
|
||||
|
@ -1073,7 +1074,7 @@ struct anv_queue_submit {
|
|||
};
|
||||
|
||||
struct anv_queue {
|
||||
struct vk_object_base base;
|
||||
struct vk_queue vk;
|
||||
|
||||
struct anv_device * device;
|
||||
|
||||
|
@ -4745,7 +4746,7 @@ VK_DEFINE_HANDLE_CASTS(anv_device, vk.base, VkDevice, VK_OBJECT_TYPE_DEVICE)
|
|||
VK_DEFINE_HANDLE_CASTS(anv_instance, vk.base, VkInstance, VK_OBJECT_TYPE_INSTANCE)
|
||||
VK_DEFINE_HANDLE_CASTS(anv_physical_device, vk.base, VkPhysicalDevice,
|
||||
VK_OBJECT_TYPE_PHYSICAL_DEVICE)
|
||||
VK_DEFINE_HANDLE_CASTS(anv_queue, base, VkQueue, VK_OBJECT_TYPE_QUEUE)
|
||||
VK_DEFINE_HANDLE_CASTS(anv_queue, vk.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(anv_acceleration_structure, base,
|
||||
VkAccelerationStructureKHR,
|
||||
|
|
|
@ -478,6 +478,10 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
|
|||
struct anv_physical_device *pdevice = device->physical;
|
||||
VkResult result;
|
||||
|
||||
result = vk_queue_init(&queue->vk, &device->vk);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
queue->device = device;
|
||||
queue->flags = pCreateInfo->flags;
|
||||
|
||||
|
@ -494,9 +498,10 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
|
|||
* submission.
|
||||
*/
|
||||
if (device->has_thread_submit) {
|
||||
if (pthread_mutex_init(&queue->mutex, NULL) != 0)
|
||||
return vk_error(VK_ERROR_INITIALIZATION_FAILED);
|
||||
|
||||
if (pthread_mutex_init(&queue->mutex, NULL) != 0) {
|
||||
result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
|
||||
goto fail_queue;
|
||||
}
|
||||
if (pthread_cond_init(&queue->cond, NULL) != 0) {
|
||||
result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
|
||||
goto fail_mutex;
|
||||
|
@ -507,14 +512,14 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
|
|||
}
|
||||
}
|
||||
|
||||
vk_object_base_init(&device->vk, &queue->base, VK_OBJECT_TYPE_QUEUE);
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_cond:
|
||||
pthread_cond_destroy(&queue->cond);
|
||||
fail_mutex:
|
||||
pthread_mutex_destroy(&queue->mutex);
|
||||
fail_queue:
|
||||
vk_queue_finish(&queue->vk);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -535,7 +540,7 @@ anv_queue_finish(struct anv_queue *queue)
|
|||
pthread_mutex_destroy(&queue->mutex);
|
||||
}
|
||||
|
||||
vk_object_base_finish(&queue->base);
|
||||
vk_queue_finish(&queue->vk);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
Loading…
Reference in New Issue