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 /* Pointers to workaround instructions */ 37 uint64_t wa_insts_addr; 38 39 /* Stride between each elements of the indirect data buffer */ 40 uint32_t indirect_data_stride; 41 42 /* Bitfield of ANV_GENERATED_FLAG_* */ 43 uint32_t flags; 44 45 /* MOCS to use for VERTEX_BUFFER_STATE (only used on Gfx9) */ 46 uint32_t mocs; 47 48 /* 3DPRIMITIVE instruction size (in bytes) */ 49 uint32_t cmd_primitive_size; 50 51 /* Base number of the draw ID, it is added to the index computed from the 52 * gl_FragCoord 53 */ 54 uint32_t draw_base; 55 56 /* Maximum number of draws (equals to draw_count for indirect draws without 57 * an indirect count) 58 */ 59 uint32_t max_draw_count; 60 61 /* Number of draws to generate in the ring buffer (only useful in ring 62 * buffer mode) 63 */ 64 uint32_t ring_count; 65 66 /* Instance multiplier for multi view */ 67 uint32_t instance_multiplier; 68 69 /* Address where to jump at to generate further draws (used with ring mode) 70 */ 71 uint64_t gen_addr; 72 73 /* Address where to jump at after the generated draw (only used with 74 * indirect draw count variants) 75 */ 76 uint64_t end_addr; 77 78 /* Destination of the generated draw commands */ 79 uint64_t generated_cmds_addr; 80 81 /* Draw count address (points to the draw_count field in cases) */ 82 uint64_t draw_count_addr; 83 84 /* Draw count value for non count variants of draw indirect commands */ 85 uint32_t draw_count; 86 87 /* CPU side pointer to the previous item when number of draws has to be 88 * split into smaller chunks, see while loop in 89 * genX(cmd_buffer_emit_indirect_generated_draws) 90 */ 91 struct anv_gen_indirect_params *prev; 92 }; 93 94 struct PACKED anv_query_copy_params { 95 /* ANV_COPY_QUERY_FLAG_* flags */ 96 uint32_t flags; 97 98 /* Number of queries to copy */ 99 uint32_t num_queries; 100 101 /* Number of items to write back in the results per query */ 102 uint32_t num_items; 103 104 /* First query to copy result from */ 105 uint32_t query_base; 106 107 /* Query stride in bytes */ 108 uint32_t query_stride; 109 110 /* Offset at which the data should be read from */ 111 uint32_t query_data_offset; 112 113 /* Stride of destination writes */ 114 uint32_t destination_stride; 115 116 /* We need to be 64 bit aligned, or 32 bit builds get 117 * very unhappy. 118 */ 119 uint32_t padding; 120 121 /* Address of the query pool */ 122 uint64_t query_data_addr; 123 124 /* Destination address of the results */ 125 uint64_t destination_addr; 126 }; 127 128 struct PACKED anv_memcpy_params { 129 /* Number of dwords to copy*/ 130 uint32_t num_dwords; 131 132 uint32_t pad; 133 134 /* Source address of the copy */ 135 uint64_t src_addr; 136 137 /* Destination address of the copy */ 138 uint64_t dst_addr; 139 }; 140 141 #endif /* ANV_GENERATED_INDIRECT_DRAWS_H */ 142