xref: /aosp_15_r20/external/mesa3d/src/nouveau/vulkan/nvk_queue.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2022 Collabora Ltd. and Red Hat Inc.
3  * SPDX-License-Identifier: MIT
4  */
5 #ifndef NVK_QUEUE_H
6 #define NVK_QUEUE_H 1
7 
8 #include "nvk_private.h"
9 
10 #include "vk_queue.h"
11 
12 struct nouveau_ws_bo;
13 struct nouveau_ws_context;
14 struct novueau_ws_push;
15 struct nv_push;
16 struct nvk_device;
17 struct nvkmd_mem;
18 struct nvkmd_ctx;
19 
20 struct nvk_queue_state {
21    struct {
22       struct nvkmd_mem *mem;
23       uint32_t alloc_count;
24    } images;
25 
26    struct {
27       struct nvkmd_mem *mem;
28       uint32_t alloc_count;
29    } samplers;
30 
31    struct {
32       struct nvkmd_mem *mem;
33       uint32_t bytes_per_warp;
34       uint32_t bytes_per_tpc;
35    } slm;
36 
37    struct {
38       struct nvkmd_mem *mem;
39       uint32_t dw_count;
40    } push;
41 };
42 
43 VkResult nvk_queue_state_update(struct nvk_device *dev,
44                                 struct nvk_queue_state *qs);
45 
46 struct nvk_queue {
47    struct vk_queue vk;
48 
49    struct nvkmd_ctx *bind_ctx;
50    struct nvkmd_ctx *exec_ctx;
51 
52    struct nvk_queue_state state;
53 
54    /* CB0 for all draw commands on this queue */
55    struct nvkmd_mem *draw_cb0;
56 };
57 
58 static inline struct nvk_device *
nvk_queue_device(struct nvk_queue * queue)59 nvk_queue_device(struct nvk_queue *queue)
60 {
61    return (struct nvk_device *)queue->vk.base.device;
62 }
63 
64 VkResult nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
65                         const VkDeviceQueueCreateInfo *pCreateInfo,
66                         uint32_t index_in_family);
67 
68 void nvk_queue_finish(struct nvk_device *dev, struct nvk_queue *queue);
69 
70 VkResult nvk_push_draw_state_init(struct nvk_queue *queue,
71                                   struct nv_push *p);
72 
73 VkResult nvk_push_dispatch_state_init(struct nvk_queue *queue,
74                                       struct nv_push *p);
75 
76 #endif
77