xref: /aosp_15_r20/external/mesa3d/src/intel/vulkan/anv_internal_kernels.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2022 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef ANV_GENERATED_INDIRECT_DRAWS_H
25 #define ANV_GENERATED_INDIRECT_DRAWS_H
26 
27 #include "libintel_shaders.h"
28 
29 struct PACKED anv_gen_indirect_params {
30    /* Draw ID buffer address (only used on Gfx9) */
31    uint64_t draw_id_addr;
32 
33    /* Indirect data buffer address (only used on Gfx9) */
34    uint64_t indirect_data_addr;
35 
36    /* Stride between each elements of the indirect data buffer */
37    uint32_t indirect_data_stride;
38 
39    uint32_t flags; /* 0-7: bits, 8-15: mocs, 16-23: cmd_dws */
40 
41    /* Base number of the draw ID, it is added to the index computed from the
42     * gl_FragCoord
43     */
44    uint32_t draw_base;
45 
46    /* Maximum number of draws (equals to draw_count for indirect draws without
47     * an indirect count)
48     */
49    uint32_t max_draw_count;
50 
51    /* Number of draws to generate in the ring buffer (only useful in ring
52     * buffer mode)
53     */
54    uint32_t ring_count;
55 
56    /* Instance multiplier for multi view */
57    uint32_t instance_multiplier;
58 
59    /* Address where to jump at to generate further draws (used with ring mode)
60     */
61    uint64_t gen_addr;
62 
63    /* Address where to jump at after the generated draw (only used with
64     * indirect draw count variants)
65     */
66    uint64_t end_addr;
67 
68    /* Destination of the generated draw commands */
69    uint64_t generated_cmds_addr;
70 
71    /* Draw count address (points to the draw_count field in cases) */
72    uint64_t draw_count_addr;
73 
74    /* Draw count value for non count variants of draw indirect commands */
75    uint32_t draw_count;
76 
77    /* CPU side pointer to the previous item when number of draws has to be
78     * split into smaller chunks, see while loop in
79     * genX(cmd_buffer_emit_indirect_generated_draws)
80     */
81    struct anv_gen_indirect_params *prev;
82 };
83 
84 struct PACKED anv_query_copy_params {
85    /* ANV_COPY_QUERY_FLAG_* flags */
86    uint32_t flags;
87 
88    /* Number of queries to copy */
89    uint32_t num_queries;
90 
91    /* Number of items to write back in the results per query */
92    uint32_t num_items;
93 
94    /* First query to copy result from */
95    uint32_t query_base;
96 
97    /* Query stride in bytes */
98    uint32_t query_stride;
99 
100    /* Offset at which the data should be read from */
101    uint32_t query_data_offset;
102 
103    /* Stride of destination writes */
104    uint32_t destination_stride;
105 
106    /* We need to be 64 bit aligned, or 32 bit builds get
107     * very unhappy.
108     */
109    uint32_t padding;
110 
111    /* Address of the query pool */
112    uint64_t query_data_addr;
113 
114    /* Destination address of the results */
115    uint64_t destination_addr;
116 };
117 
118 struct PACKED anv_memcpy_params {
119    /* Number of dwords to copy*/
120    uint32_t num_dwords;
121 
122    uint32_t pad;
123 
124    /* Source address of the copy */
125    uint64_t src_addr;
126 
127    /* Destination address of the copy */
128    uint64_t dst_addr;
129 };
130 
131 #endif /* ANV_GENERATED_INDIRECT_DRAWS_H */
132