diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
| commit | 01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (patch) | |
| tree | 4ef34501728a087be24f4ba0af90f91486bf780b /include/gk20a/gr_gk20a.h | |
| parent | 306a03d18b305e4e573be3b2931978fa10679eb9 (diff) | |
Include nvgpu headers
These are needed to build on NVIDIA's Jetson boards for the time
being. Only a couple structs are required, so it should be fairly
easy to remove this dependency at some point in the future.
Diffstat (limited to 'include/gk20a/gr_gk20a.h')
| -rw-r--r-- | include/gk20a/gr_gk20a.h | 851 |
1 files changed, 851 insertions, 0 deletions
diff --git a/include/gk20a/gr_gk20a.h b/include/gk20a/gr_gk20a.h new file mode 100644 index 0000000..08b81e8 --- /dev/null +++ b/include/gk20a/gr_gk20a.h | |||
| @@ -0,0 +1,851 @@ | |||
| 1 | /* | ||
| 2 | * GK20A Graphics Engine | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the "Software"), | ||
| 8 | * to deal in the Software without restriction, including without limitation | ||
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 11 | * Software is furnished to do so, subject to the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice shall be included in | ||
| 14 | * all copies or substantial portions of the Software. | ||
| 15 | * | ||
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 22 | * DEALINGS IN THE SOFTWARE. | ||
| 23 | */ | ||
| 24 | #ifndef GR_GK20A_H | ||
| 25 | #define GR_GK20A_H | ||
| 26 | |||
| 27 | #include <nvgpu/types.h> | ||
| 28 | |||
| 29 | #include "gr_ctx_gk20a.h" | ||
| 30 | #include "mm_gk20a.h" | ||
| 31 | #include <nvgpu/power_features/pg.h> | ||
| 32 | |||
| 33 | #include <nvgpu/comptags.h> | ||
| 34 | #include <nvgpu/cond.h> | ||
| 35 | |||
| 36 | #define GR_IDLE_CHECK_DEFAULT 10 /* usec */ | ||
| 37 | #define GR_IDLE_CHECK_MAX 200 /* usec */ | ||
| 38 | #define GR_FECS_POLL_INTERVAL 5 /* usec */ | ||
| 39 | |||
| 40 | #define INVALID_SCREEN_TILE_ROW_OFFSET 0xFFFFFFFF | ||
| 41 | #define INVALID_MAX_WAYS 0xFFFFFFFF | ||
| 42 | |||
| 43 | #define GK20A_FECS_UCODE_IMAGE "fecs.bin" | ||
| 44 | #define GK20A_GPCCS_UCODE_IMAGE "gpccs.bin" | ||
| 45 | |||
| 46 | #define GK20A_GR_MAX_PES_PER_GPC 3 | ||
| 47 | |||
| 48 | #define GK20A_TIMEOUT_FPGA 100000 /* 100 sec */ | ||
| 49 | |||
| 50 | /* Flags to be passed to g->ops.gr.alloc_obj_ctx() */ | ||
| 51 | #define NVGPU_OBJ_CTX_FLAGS_SUPPORT_GFXP (1 << 1) | ||
| 52 | #define NVGPU_OBJ_CTX_FLAGS_SUPPORT_CILP (1 << 2) | ||
| 53 | |||
| 54 | /* | ||
| 55 | * allocate a minimum of 1 page (4KB) worth of patch space, this is 512 entries | ||
| 56 | * of address and data pairs | ||
| 57 | */ | ||
| 58 | #define PATCH_CTX_SLOTS_REQUIRED_PER_ENTRY 2 | ||
| 59 | #define PATCH_CTX_SLOTS_PER_PAGE \ | ||
| 60 | (PAGE_SIZE/(PATCH_CTX_SLOTS_REQUIRED_PER_ENTRY * sizeof(u32))) | ||
| 61 | #define PATCH_CTX_ENTRIES_FROM_SIZE(size) (size/sizeof(u32)) | ||
| 62 | |||
| 63 | #define NVGPU_PREEMPTION_MODE_GRAPHICS_WFI (1 << 0) | ||
| 64 | #define NVGPU_PREEMPTION_MODE_GRAPHICS_GFXP (1 << 1) | ||
| 65 | |||
| 66 | #define NVGPU_PREEMPTION_MODE_COMPUTE_WFI (1 << 0) | ||
| 67 | #define NVGPU_PREEMPTION_MODE_COMPUTE_CTA (1 << 1) | ||
| 68 | #define NVGPU_PREEMPTION_MODE_COMPUTE_CILP (1 << 2) | ||
| 69 | |||
| 70 | #define CTXSW_INTR0 BIT32(0) | ||
| 71 | #define CTXSW_INTR1 BIT32(1) | ||
| 72 | |||
| 73 | #define MAILBOX_VALUE_TIMESTAMP_BUFFER_FULL 0x26 | ||
| 74 | |||
| 75 | struct tsg_gk20a; | ||
| 76 | struct channel_gk20a; | ||
| 77 | struct nvgpu_warpstate; | ||
| 78 | |||
| 79 | enum ctxsw_addr_type; | ||
| 80 | |||
| 81 | enum /* global_ctx_buffer */ { | ||
| 82 | CIRCULAR = 0, | ||
| 83 | PAGEPOOL = 1, | ||
| 84 | ATTRIBUTE = 2, | ||
| 85 | CIRCULAR_VPR = 3, | ||
| 86 | PAGEPOOL_VPR = 4, | ||
| 87 | ATTRIBUTE_VPR = 5, | ||
| 88 | GOLDEN_CTX = 6, | ||
| 89 | PRIV_ACCESS_MAP = 7, | ||
| 90 | /* #8 is reserved */ | ||
| 91 | FECS_TRACE_BUFFER = 9, | ||
| 92 | NR_GLOBAL_CTX_BUF = 10 | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* either ATTRIBUTE or ATTRIBUTE_VPR maps to ATTRIBUTE_VA */ | ||
| 96 | enum /*global_ctx_buffer_va */ { | ||
| 97 | CIRCULAR_VA = 0, | ||
| 98 | PAGEPOOL_VA = 1, | ||
| 99 | ATTRIBUTE_VA = 2, | ||
| 100 | GOLDEN_CTX_VA = 3, | ||
| 101 | PRIV_ACCESS_MAP_VA = 4, | ||
| 102 | /* #5 is reserved */ | ||
| 103 | FECS_TRACE_BUFFER_VA = 6, | ||
| 104 | NR_GLOBAL_CTX_BUF_VA = 7 | ||
| 105 | }; | ||
| 106 | |||
| 107 | enum { | ||
| 108 | WAIT_UCODE_LOOP, | ||
| 109 | WAIT_UCODE_TIMEOUT, | ||
| 110 | WAIT_UCODE_ERROR, | ||
| 111 | WAIT_UCODE_OK | ||
| 112 | }; | ||
| 113 | |||
| 114 | enum { | ||
| 115 | GR_IS_UCODE_OP_EQUAL, | ||
| 116 | GR_IS_UCODE_OP_NOT_EQUAL, | ||
| 117 | GR_IS_UCODE_OP_AND, | ||
| 118 | GR_IS_UCODE_OP_LESSER, | ||
| 119 | GR_IS_UCODE_OP_LESSER_EQUAL, | ||
| 120 | GR_IS_UCODE_OP_SKIP | ||
| 121 | }; | ||
| 122 | |||
| 123 | enum { | ||
| 124 | eUcodeHandshakeInitComplete = 1, | ||
| 125 | eUcodeHandshakeMethodFinished | ||
| 126 | }; | ||
| 127 | |||
| 128 | enum { | ||
| 129 | ELCG_MODE = (1 << 0), | ||
| 130 | BLCG_MODE = (1 << 1), | ||
| 131 | INVALID_MODE = (1 << 2) | ||
| 132 | }; | ||
| 133 | |||
| 134 | enum { | ||
| 135 | NVGPU_EVENT_ID_BPT_INT = 0, | ||
| 136 | NVGPU_EVENT_ID_BPT_PAUSE, | ||
| 137 | NVGPU_EVENT_ID_BLOCKING_SYNC, | ||
| 138 | NVGPU_EVENT_ID_CILP_PREEMPTION_STARTED, | ||
| 139 | NVGPU_EVENT_ID_CILP_PREEMPTION_COMPLETE, | ||
| 140 | NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN, | ||
| 141 | NVGPU_EVENT_ID_MAX, | ||
| 142 | }; | ||
| 143 | |||
| 144 | #ifndef GR_GO_IDLE_BUNDLE | ||
| 145 | #define GR_GO_IDLE_BUNDLE 0x0000e100 /* --V-B */ | ||
| 146 | #endif | ||
| 147 | |||
| 148 | struct gr_channel_map_tlb_entry { | ||
| 149 | u32 curr_ctx; | ||
| 150 | u32 chid; | ||
| 151 | u32 tsgid; | ||
| 152 | }; | ||
| 153 | |||
| 154 | struct gr_zcull_gk20a { | ||
| 155 | u32 aliquot_width; | ||
| 156 | u32 aliquot_height; | ||
| 157 | u32 aliquot_size; | ||
| 158 | u32 total_aliquots; | ||
| 159 | |||
| 160 | u32 width_align_pixels; | ||
| 161 | u32 height_align_pixels; | ||
| 162 | u32 pixel_squares_by_aliquots; | ||
| 163 | }; | ||
| 164 | |||
| 165 | struct gr_zcull_info { | ||
| 166 | u32 width_align_pixels; | ||
| 167 | u32 height_align_pixels; | ||
| 168 | u32 pixel_squares_by_aliquots; | ||
| 169 | u32 aliquot_total; | ||
| 170 | u32 region_byte_multiplier; | ||
| 171 | u32 region_header_size; | ||
| 172 | u32 subregion_header_size; | ||
| 173 | u32 subregion_width_align_pixels; | ||
| 174 | u32 subregion_height_align_pixels; | ||
| 175 | u32 subregion_count; | ||
| 176 | }; | ||
| 177 | |||
| 178 | #define GK20A_ZBC_COLOR_VALUE_SIZE 4 /* RGBA */ | ||
| 179 | |||
| 180 | #define GK20A_STARTOF_ZBC_TABLE 1U /* index zero reserved to indicate "not ZBCd" */ | ||
| 181 | #define GK20A_SIZEOF_ZBC_TABLE 16 /* match ltcs_ltss_dstg_zbc_index_address width (4) */ | ||
| 182 | #define GK20A_ZBC_TABLE_SIZE (16 - 1) | ||
| 183 | |||
| 184 | #define GK20A_ZBC_TYPE_INVALID 0 | ||
| 185 | #define GK20A_ZBC_TYPE_COLOR 1 | ||
| 186 | #define GK20A_ZBC_TYPE_DEPTH 2 | ||
| 187 | #define T19X_ZBC 3 | ||
| 188 | |||
| 189 | struct zbc_color_table { | ||
| 190 | u32 color_ds[GK20A_ZBC_COLOR_VALUE_SIZE]; | ||
| 191 | u32 color_l2[GK20A_ZBC_COLOR_VALUE_SIZE]; | ||
| 192 | u32 format; | ||
| 193 | u32 ref_cnt; | ||
| 194 | }; | ||
| 195 | |||
| 196 | struct zbc_depth_table { | ||
| 197 | u32 depth; | ||
| 198 | u32 format; | ||
| 199 | u32 ref_cnt; | ||
| 200 | }; | ||
| 201 | |||
| 202 | struct zbc_s_table { | ||
| 203 | u32 stencil; | ||
| 204 | u32 format; | ||
| 205 | u32 ref_cnt; | ||
| 206 | }; | ||
| 207 | |||
| 208 | struct zbc_entry { | ||
| 209 | u32 color_ds[GK20A_ZBC_COLOR_VALUE_SIZE]; | ||
| 210 | u32 color_l2[GK20A_ZBC_COLOR_VALUE_SIZE]; | ||
| 211 | u32 depth; | ||
| 212 | u32 type; /* color or depth */ | ||
| 213 | u32 format; | ||
| 214 | }; | ||
| 215 | |||
| 216 | struct zbc_query_params { | ||
| 217 | u32 color_ds[GK20A_ZBC_COLOR_VALUE_SIZE]; | ||
| 218 | u32 color_l2[GK20A_ZBC_COLOR_VALUE_SIZE]; | ||
| 219 | u32 depth; | ||
| 220 | u32 ref_cnt; | ||
| 221 | u32 format; | ||
| 222 | u32 type; /* color or depth */ | ||
| 223 | u32 index_si | ||
