venus: use common vk_queue object
This change only updates the object base to be vk_queue. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25262>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "vk_instance.h"
|
||||
#include "vk_object.h"
|
||||
#include "vk_physical_device.h"
|
||||
#include "vk_queue.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
#include "vn_entrypoints.h"
|
||||
@@ -139,6 +140,12 @@ struct vn_device_base {
|
||||
vn_object_id id;
|
||||
};
|
||||
|
||||
/* base class of vn_queue */
|
||||
struct vn_queue_base {
|
||||
struct vk_queue base;
|
||||
vn_object_id id;
|
||||
};
|
||||
|
||||
/* base class of other driver objects */
|
||||
struct vn_object_base {
|
||||
struct vk_object_base base;
|
||||
@@ -307,6 +314,24 @@ vn_device_base_fini(struct vn_device_base *dev)
|
||||
vk_device_finish(&dev->base);
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vn_queue_base_init(struct vn_queue_base *queue,
|
||||
struct vn_device_base *dev,
|
||||
const VkDeviceQueueCreateInfo *queue_info,
|
||||
uint32_t queue_index)
|
||||
{
|
||||
VkResult result =
|
||||
vk_queue_init(&queue->base, &dev->base, queue_info, queue_index);
|
||||
queue->id = (uintptr_t)queue;
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void
|
||||
vn_queue_base_fini(struct vn_queue_base *queue)
|
||||
{
|
||||
vk_queue_finish(&queue->base);
|
||||
}
|
||||
|
||||
static inline void
|
||||
vn_object_base_init(struct vn_object_base *obj,
|
||||
VkObjectType type,
|
||||
@@ -336,6 +361,9 @@ vn_object_set_id(void *obj, vn_object_id id, VkObjectType type)
|
||||
case VK_OBJECT_TYPE_DEVICE:
|
||||
((struct vn_device_base *)obj)->id = id;
|
||||
break;
|
||||
case VK_OBJECT_TYPE_QUEUE:
|
||||
((struct vn_queue_base *)obj)->id = id;
|
||||
break;
|
||||
default:
|
||||
((struct vn_object_base *)obj)->id = id;
|
||||
break;
|
||||
@@ -353,6 +381,8 @@ vn_object_get_id(const void *obj, VkObjectType type)
|
||||
return ((struct vn_physical_device_base *)obj)->id;
|
||||
case VK_OBJECT_TYPE_DEVICE:
|
||||
return ((struct vn_device_base *)obj)->id;
|
||||
case VK_OBJECT_TYPE_QUEUE:
|
||||
return ((struct vn_queue_base *)obj)->id;
|
||||
default:
|
||||
return ((struct vn_object_base *)obj)->id;
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ vn_queue_fini(struct vn_queue *queue)
|
||||
if (queue->sparse_semaphore != VK_NULL_HANDLE) {
|
||||
vn_DestroySemaphore(dev_handle, queue->sparse_semaphore, NULL);
|
||||
}
|
||||
vn_object_base_fini(&queue->base);
|
||||
vn_queue_base_fini(&queue->base);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
@@ -44,7 +44,10 @@ vn_queue_init(struct vn_device *dev,
|
||||
const VkDeviceQueueCreateInfo *queue_info,
|
||||
uint32_t queue_index)
|
||||
{
|
||||
vn_object_base_init(&queue->base, VK_OBJECT_TYPE_QUEUE, &dev->base);
|
||||
VkResult result =
|
||||
vn_queue_base_init(&queue->base, &dev->base, queue_info, queue_index);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
VkDeviceQueueTimelineInfoMESA timeline_info;
|
||||
const struct vn_renderer_info *renderer_info =
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include "vn_feedback.h"
|
||||
|
||||
struct vn_queue {
|
||||
struct vn_object_base base;
|
||||
struct vn_queue_base base;
|
||||
|
||||
struct vn_device *device;
|
||||
uint32_t family;
|
||||
@@ -38,7 +38,7 @@ struct vn_queue {
|
||||
VkSemaphore sparse_semaphore;
|
||||
uint64_t sparse_semaphore_counter;
|
||||
};
|
||||
VK_DEFINE_HANDLE_CASTS(vn_queue, base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
|
||||
VK_DEFINE_HANDLE_CASTS(vn_queue, base.base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
|
||||
|
||||
enum vn_sync_type {
|
||||
/* no payload */
|
||||
|
Reference in New Issue
Block a user