venus: split out vn_queue.[ch]

Move VkQueue, VkFence, VkSemaphore, and VkEvent functions to the new
files.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10117>
This commit is contained in:
Chia-I Wu 2021-04-07 17:44:41 -07:00 committed by Marge Bot
parent 49a15148fa
commit 01c46704ec
6 changed files with 1436 additions and 1397 deletions

View file

@ -42,6 +42,7 @@ libvn_files = files(
'vn_image.c',
'vn_pipeline.c',
'vn_query_pool.c',
'vn_queue.c',
'vn_render_pass.c',
'vn_ring.c',
'vn_renderer_virtgpu.c',

File diff suppressed because it is too large Load diff

View file

@ -114,80 +114,6 @@ VK_DEFINE_HANDLE_CASTS(vn_device,
VkDevice,
VK_OBJECT_TYPE_DEVICE)
struct vn_queue {
struct vn_object_base base;
struct vn_device *device;
uint32_t family;
uint32_t index;
uint32_t flags;
uint32_t sync_queue_index;
struct vn_renderer_sync *idle_sync;
uint64_t idle_sync_value;
};
VK_DEFINE_HANDLE_CASTS(vn_queue, base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
enum vn_sync_type {
/* no payload */
VN_SYNC_TYPE_INVALID,
/* When we signal or reset, we update both the device object and the
* renderer sync. When we wait or query, we use the renderer sync only.
*
* TODO VkFence does not need the device object
*/
VN_SYNC_TYPE_SYNC,
/* device object only; no renderer sync */
VN_SYNC_TYPE_DEVICE_ONLY,
/* already signaled by WSI */
VN_SYNC_TYPE_WSI_SIGNALED,
};
struct vn_sync_payload {
enum vn_sync_type type;
struct vn_renderer_sync *sync;
};
struct vn_fence {
struct vn_object_base base;
struct vn_sync_payload *payload;
struct vn_sync_payload permanent;
struct vn_sync_payload temporary;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_fence,
base.base,
VkFence,
VK_OBJECT_TYPE_FENCE)
struct vn_semaphore {
struct vn_object_base base;
VkSemaphoreType type;
struct vn_sync_payload *payload;
struct vn_sync_payload permanent;
struct vn_sync_payload temporary;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_semaphore,
base.base,
VkSemaphore,
VK_OBJECT_TYPE_SEMAPHORE)
struct vn_event {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_event,
base.base,
VkEvent,
VK_OBJECT_TYPE_EVENT)
VkResult
vn_instance_submit_roundtrip(struct vn_instance *instance,
uint32_t *roundtrip_seqno);
@ -230,10 +156,4 @@ void
vn_instance_submit_command(struct vn_instance *instance,
struct vn_instance_submit_command *submit);
void
vn_fence_signal_wsi(struct vn_device *dev, struct vn_fence *fence);
void
vn_semaphore_signal_wsi(struct vn_device *dev, struct vn_semaphore *sem);
#endif /* VN_DEVICE_H */

1337
src/virtio/vulkan/vn_queue.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,96 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_QUEUE_H
#define VN_QUEUE_H
#include "vn_common.h"
struct vn_queue {
struct vn_object_base base;
struct vn_device *device;
uint32_t family;
uint32_t index;
uint32_t flags;
uint32_t sync_queue_index;
struct vn_renderer_sync *idle_sync;
uint64_t idle_sync_value;
};
VK_DEFINE_HANDLE_CASTS(vn_queue, base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
enum vn_sync_type {
/* no payload */
VN_SYNC_TYPE_INVALID,
/* When we signal or reset, we update both the device object and the
* renderer sync. When we wait or query, we use the renderer sync only.
*
* TODO VkFence does not need the device object
*/
VN_SYNC_TYPE_SYNC,
/* device object only; no renderer sync */
VN_SYNC_TYPE_DEVICE_ONLY,
/* already signaled by WSI */
VN_SYNC_TYPE_WSI_SIGNALED,
};
struct vn_sync_payload {
enum vn_sync_type type;
struct vn_renderer_sync *sync;
};
struct vn_fence {
struct vn_object_base base;
struct vn_sync_payload *payload;
struct vn_sync_payload permanent;
struct vn_sync_payload temporary;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_fence,
base.base,
VkFence,
VK_OBJECT_TYPE_FENCE)
struct vn_semaphore {
struct vn_object_base base;
VkSemaphoreType type;
struct vn_sync_payload *payload;
struct vn_sync_payload permanent;
struct vn_sync_payload temporary;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_semaphore,
base.base,
VkSemaphore,
VK_OBJECT_TYPE_SEMAPHORE)
struct vn_event {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_event,
base.base,
VkEvent,
VK_OBJECT_TYPE_EVENT)
void
vn_fence_signal_wsi(struct vn_device *dev, struct vn_fence *fence);
void
vn_semaphore_signal_wsi(struct vn_device *dev, struct vn_semaphore *sem);
#endif /* VN_QUEUE_H */

View file

@ -11,6 +11,7 @@
#include "vn_wsi.h"
#include "vn_device.h"
#include "vn_queue.h"
/* The common WSI support makes some assumptions about the driver.
*