Debian Codegraph @

src/panfrost/vulkan/csf/panvk_queue.h

raw
1 /*
2 * Copyright © 2021 Collabora Ltd.
3 * SPDX-License-Identifier: MIT
4 */
5
6 #ifndef PANVK_QUEUE_H
7 #define PANVK_QUEUE_H
8
9 #ifndef PAN_ARCH
10 #error "PAN_ARCH must be defined"
11 #endif
12
13 #include "genxml/gen_macros.h"
14
15 #include <stdint.h>
16
17 #include "panvk_device.h"
18
19 #include "vk_queue.h"
20
21 enum panvk_subqueue_id {
22 PANVK_SUBQUEUE_VERTEX_TILER = 0,
23 PANVK_SUBQUEUE_FRAGMENT,
24 PANVK_SUBQUEUE_COMPUTE,
25 PANVK_SUBQUEUE_COUNT,
26 };
27
28 struct panvk_tiler_heap {
29 uint32_t chunk_size;
30 struct panvk_priv_mem desc;
31 struct panvk_priv_mem oom_fbd;
32 struct {
33 uint32_t handle;
34 uint64_t dev_addr;
35 } context;
36 };
37
38 struct panvk_subqueue {
39 struct panvk_priv_mem context;
40 uint32_t *reg_file;
41
42 /* Memory to save/restore CS registers in functions/exception handlers.
43 * Because registers are dumped to a fixed address rather than a moving
44 * stack pointer, nested function/exception handler calls are not supported.
45 */
46 struct panvk_priv_mem regs_save;
47
48
49 struct {
50 /* Mask of resources requested by this subqueue. */
51 uint32_t mask;
52 /* Address and size of the linear buffer containing REQ_RESOURCE. */
53 uint32_t cs_buffer_size;
54 uint64_t cs_buffer_addr;
55 /* Allocation */
56 struct panvk_priv_mem buf;
57 } req_resource;
58
59 struct {
60 struct pan_kmod_bo *bo;
61 uint64_t size;
62 struct {
63 uint64_t dev;
64 void *host;
65 } addr;
66 } tracebuf;
67 };
68
69 struct panvk_desc_ringbuf {
70 struct panvk_priv_mem syncobj;
71 struct pan_kmod_bo *bo;
72 uint64_t size;
73 struct {
74 uint64_t dev;
75 void *host;
76 } addr;
77 };
78
79 struct panvk_gpu_queue {
80 struct vk_queue vk;
81
82 uint32_t group_handle;
83 uint32_t syncobj_handle;
84
85 struct panvk_tiler_heap tiler_heap;
86 struct panvk_desc_ringbuf render_desc_ringbuf;
87 struct panvk_priv_mem syncobjs;
88
89 struct {
90 struct vk_sync *sync;
91 uint64_t next_value;
92 } utrace;
93
94 struct panvk_subqueue subqueues[PANVK_SUBQUEUE_COUNT];
95 };
96
97 VK_DEFINE_HANDLE_CASTS(panvk_gpu_queue, vk.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
98
99 VkResult panvk_per_arch(create_gpu_queue)(
100 struct panvk_device *dev, const VkDeviceQueueCreateInfo *create_info,
101 uint32_t queue_idx, struct vk_queue **out_queue);
102 void panvk_per_arch(destroy_gpu_queue)(struct vk_queue *vk_queue);
103 VkResult panvk_per_arch(gpu_queue_submit)(struct vk_queue *vk_queue,
104 struct vk_queue_submit *vk_submit);
105 VkResult panvk_per_arch(gpu_queue_check_status)(struct vk_queue *vk_queue);
106
107 struct panvk_bind_queue {
108 struct vk_queue vk;
109
110 uint32_t syncobj_handle;
111 };
112
113 VK_DEFINE_HANDLE_CASTS(panvk_bind_queue, vk.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
114
115 VkResult panvk_per_arch(create_bind_queue)(
116 struct panvk_device *dev, const VkDeviceQueueCreateInfo *create_info,
117 uint32_t queue_idx,struct vk_queue **out_queue);
118 void panvk_per_arch(destroy_bind_queue)(struct vk_queue *vk_queue);
119 VkResult panvk_per_arch(bind_queue_submit)(struct vk_queue *vk_queue,
120 struct vk_queue_submit *vk_submit);
121 VkResult panvk_per_arch(bind_queue_check_status)(struct vk_queue *vk_queue);
122
123 #endif