• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Google LLC
3  * SPDX-License-Identifier: MIT
4  *
5  * based in part on anv and radv which are:
6  * Copyright © 2015 Intel Corporation
7  * Copyright © 2016 Red Hat.
8  * Copyright © 2016 Bas Nieuwenhuizen
9  */
10 
11 #ifndef VN_QUEUE_H
12 #define VN_QUEUE_H
13 
14 #include "vn_common.h"
15 
16 #include "vn_feedback.h"
17 
18 struct vn_queue {
19    struct vn_object_base base;
20 
21    struct vn_device *device;
22    uint32_t family;
23    uint32_t index;
24    uint32_t flags;
25 
26    VkFence wait_fence;
27 };
28 VK_DEFINE_HANDLE_CASTS(vn_queue, base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
29 
30 enum vn_sync_type {
31    /* no payload */
32    VN_SYNC_TYPE_INVALID,
33 
34    /* device object */
35    VN_SYNC_TYPE_DEVICE_ONLY,
36 
37    /* already signaled by WSI */
38    VN_SYNC_TYPE_WSI_SIGNALED,
39 };
40 
41 struct vn_sync_payload {
42    enum vn_sync_type type;
43 };
44 
45 struct vn_fence {
46    struct vn_object_base base;
47 
48    struct vn_sync_payload *payload;
49 
50    struct vn_sync_payload permanent;
51    struct vn_sync_payload temporary;
52 
53    struct {
54       /* non-NULL if VN_PERF_NO_FENCE_FEEDBACK is disabled */
55       struct vn_feedback_slot *slot;
56       VkCommandBuffer *commands;
57    } feedback;
58 
59    bool is_external;
60 };
61 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_fence,
62                                base.base,
63                                VkFence,
64                                VK_OBJECT_TYPE_FENCE)
65 
66 struct vn_semaphore {
67    struct vn_object_base base;
68 
69    VkSemaphoreType type;
70 
71    struct vn_sync_payload *payload;
72 
73    struct vn_sync_payload permanent;
74    struct vn_sync_payload temporary;
75 };
76 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_semaphore,
77                                base.base,
78                                VkSemaphore,
79                                VK_OBJECT_TYPE_SEMAPHORE)
80 
81 struct vn_event {
82    struct vn_object_base base;
83 
84    /* non-NULL if below are satisfied:
85     * - event is created without VK_EVENT_CREATE_DEVICE_ONLY_BIT
86     * - VN_PERF_NO_EVENT_FEEDBACK is disabled
87     */
88    struct vn_feedback_slot *feedback_slot;
89 };
90 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_event,
91                                base.base,
92                                VkEvent,
93                                VK_OBJECT_TYPE_EVENT)
94 
95 void
96 vn_fence_signal_wsi(struct vn_device *dev, struct vn_fence *fence);
97 
98 void
99 vn_semaphore_signal_wsi(struct vn_device *dev, struct vn_semaphore *sem);
100 
101 #endif /* VN_QUEUE_H */
102