17ec681f3Smrg/*
27ec681f3Smrg * Copyright 2019 Google LLC
37ec681f3Smrg * SPDX-License-Identifier: MIT
47ec681f3Smrg *
57ec681f3Smrg * based in part on anv and radv which are:
67ec681f3Smrg * Copyright © 2015 Intel Corporation
77ec681f3Smrg * Copyright © 2016 Red Hat.
87ec681f3Smrg * Copyright © 2016 Bas Nieuwenhuizen
97ec681f3Smrg */
107ec681f3Smrg
117ec681f3Smrg#ifndef VN_QUEUE_H
127ec681f3Smrg#define VN_QUEUE_H
137ec681f3Smrg
147ec681f3Smrg#include "vn_common.h"
157ec681f3Smrg
167ec681f3Smrgstruct vn_queue {
177ec681f3Smrg   struct vn_object_base base;
187ec681f3Smrg
197ec681f3Smrg   struct vn_device *device;
207ec681f3Smrg   uint32_t family;
217ec681f3Smrg   uint32_t index;
227ec681f3Smrg   uint32_t flags;
237ec681f3Smrg
247ec681f3Smrg   VkFence wait_fence;
257ec681f3Smrg};
267ec681f3SmrgVK_DEFINE_HANDLE_CASTS(vn_queue, base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
277ec681f3Smrg
287ec681f3Smrgenum vn_sync_type {
297ec681f3Smrg   /* no payload */
307ec681f3Smrg   VN_SYNC_TYPE_INVALID,
317ec681f3Smrg
327ec681f3Smrg   /* device object */
337ec681f3Smrg   VN_SYNC_TYPE_DEVICE_ONLY,
347ec681f3Smrg
357ec681f3Smrg   /* already signaled by WSI */
367ec681f3Smrg   VN_SYNC_TYPE_WSI_SIGNALED,
377ec681f3Smrg};
387ec681f3Smrg
397ec681f3Smrgstruct vn_sync_payload {
407ec681f3Smrg   enum vn_sync_type type;
417ec681f3Smrg};
427ec681f3Smrg
437ec681f3Smrgstruct vn_fence {
447ec681f3Smrg   struct vn_object_base base;
457ec681f3Smrg
467ec681f3Smrg   struct vn_sync_payload *payload;
477ec681f3Smrg
487ec681f3Smrg   struct vn_sync_payload permanent;
497ec681f3Smrg   struct vn_sync_payload temporary;
507ec681f3Smrg};
517ec681f3SmrgVK_DEFINE_NONDISP_HANDLE_CASTS(vn_fence,
527ec681f3Smrg                               base.base,
537ec681f3Smrg                               VkFence,
547ec681f3Smrg                               VK_OBJECT_TYPE_FENCE)
557ec681f3Smrg
567ec681f3Smrgstruct vn_semaphore {
577ec681f3Smrg   struct vn_object_base base;
587ec681f3Smrg
597ec681f3Smrg   VkSemaphoreType type;
607ec681f3Smrg
617ec681f3Smrg   struct vn_sync_payload *payload;
627ec681f3Smrg
637ec681f3Smrg   struct vn_sync_payload permanent;
647ec681f3Smrg   struct vn_sync_payload temporary;
657ec681f3Smrg};
667ec681f3SmrgVK_DEFINE_NONDISP_HANDLE_CASTS(vn_semaphore,
677ec681f3Smrg                               base.base,
687ec681f3Smrg                               VkSemaphore,
697ec681f3Smrg                               VK_OBJECT_TYPE_SEMAPHORE)
707ec681f3Smrg
717ec681f3Smrgstruct vn_event {
727ec681f3Smrg   struct vn_object_base base;
737ec681f3Smrg};
747ec681f3SmrgVK_DEFINE_NONDISP_HANDLE_CASTS(vn_event,
757ec681f3Smrg                               base.base,
767ec681f3Smrg                               VkEvent,
777ec681f3Smrg                               VK_OBJECT_TYPE_EVENT)
787ec681f3Smrg
797ec681f3Smrgvoid
807ec681f3Smrgvn_fence_signal_wsi(struct vn_device *dev, struct vn_fence *fence);
817ec681f3Smrg
827ec681f3Smrgvoid
837ec681f3Smrgvn_semaphore_signal_wsi(struct vn_device *dev, struct vn_semaphore *sem);
847ec681f3Smrg
857ec681f3Smrg#endif /* VN_QUEUE_H */
86