Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 1 | /* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*- |
| 2 | * |
| 3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. |
| 4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. |
| 5 | * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. |
| 6 | * Copyright 2014 Advanced Micro Devices, Inc. |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | * copy of this software and associated documentation files (the "Software"), |
| 10 | * to deal in the Software without restriction, including without limitation |
| 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 | * and/or sell copies of the Software, and to permit persons to whom the |
| 13 | * Software is furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included in |
| 16 | * all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 24 | * OTHER DEALINGS IN THE SOFTWARE. |
| 25 | * |
| 26 | * Authors: |
| 27 | * Kevin E. Martin <martin@valinux.com> |
| 28 | * Gareth Hughes <gareth@valinux.com> |
| 29 | * Keith Whitwell <keith@tungstengraphics.com> |
| 30 | */ |
| 31 | |
| 32 | #ifndef __AMDGPU_DRM_H__ |
| 33 | #define __AMDGPU_DRM_H__ |
| 34 | |
Michel Dänzer | b3fcf36a | 2015-07-22 17:29:01 +0900 | [diff] [blame] | 35 | #include "drm.h" |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 36 | |
Emil Velikov | cfa7152 | 2016-04-07 18:45:18 +0100 | [diff] [blame] | 37 | #if defined(__cplusplus) |
| 38 | extern "C" { |
| 39 | #endif |
| 40 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 41 | #define DRM_AMDGPU_GEM_CREATE 0x00 |
| 42 | #define DRM_AMDGPU_GEM_MMAP 0x01 |
| 43 | #define DRM_AMDGPU_CTX 0x02 |
| 44 | #define DRM_AMDGPU_BO_LIST 0x03 |
| 45 | #define DRM_AMDGPU_CS 0x04 |
| 46 | #define DRM_AMDGPU_INFO 0x05 |
| 47 | #define DRM_AMDGPU_GEM_METADATA 0x06 |
| 48 | #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 |
| 49 | #define DRM_AMDGPU_GEM_VA 0x08 |
| 50 | #define DRM_AMDGPU_WAIT_CS 0x09 |
| 51 | #define DRM_AMDGPU_GEM_OP 0x10 |
| 52 | #define DRM_AMDGPU_GEM_USERPTR 0x11 |
| 53 | |
| 54 | #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) |
| 55 | #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) |
| 56 | #define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx) |
| 57 | #define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list) |
| 58 | #define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs) |
| 59 | #define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info) |
| 60 | #define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata) |
| 61 | #define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle) |
Christian König | 34b5f6a | 2015-06-08 15:03:00 +0200 | [diff] [blame] | 62 | #define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va) |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 63 | #define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) |
| 64 | #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) |
| 65 | #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) |
| 66 | |
| 67 | #define AMDGPU_GEM_DOMAIN_CPU 0x1 |
| 68 | #define AMDGPU_GEM_DOMAIN_GTT 0x2 |
| 69 | #define AMDGPU_GEM_DOMAIN_VRAM 0x4 |
| 70 | #define AMDGPU_GEM_DOMAIN_GDS 0x8 |
| 71 | #define AMDGPU_GEM_DOMAIN_GWS 0x10 |
| 72 | #define AMDGPU_GEM_DOMAIN_OA 0x20 |
| 73 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 74 | /* Flag that CPU access will be required for the case of VRAM domain */ |
| 75 | #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0) |
| 76 | /* Flag that CPU access will not work, this VRAM domain is invisible */ |
| 77 | #define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1) |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 78 | /* Flag that USWC attributes should be used for GTT */ |
Jammy Zhou | 8867128 | 2015-05-06 18:44:29 +0800 | [diff] [blame] | 79 | #define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2) |
Flora Cui | 4fea83f | 2016-07-20 14:44:38 +0800 | [diff] [blame] | 80 | /* Flag that the memory should be in VRAM and cleared */ |
| 81 | #define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3) |
Chunming Zhou | e7893c4 | 2016-07-26 14:13:21 +0800 | [diff] [blame] | 82 | /* Flag that create shadow bo(GTT) while allocating vram bo */ |
| 83 | #define AMDGPU_GEM_CREATE_SHADOW (1 << 4) |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 84 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 85 | struct drm_amdgpu_gem_create_in { |
| 86 | /** the requested memory size */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 87 | __u64 bo_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 88 | /** physical start_addr alignment in bytes for some HW requirements */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 89 | __u64 alignment; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 90 | /** the requested memory domains */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 91 | __u64 domains; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 92 | /** allocation flags */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 93 | __u64 domain_flags; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 94 | }; |
| 95 | |
| 96 | struct drm_amdgpu_gem_create_out { |
| 97 | /** returned GEM object handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 98 | __u32 handle; |
| 99 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | union drm_amdgpu_gem_create { |
| 103 | struct drm_amdgpu_gem_create_in in; |
| 104 | struct drm_amdgpu_gem_create_out out; |
| 105 | }; |
| 106 | |
| 107 | /** Opcode to create new residency list. */ |
| 108 | #define AMDGPU_BO_LIST_OP_CREATE 0 |
| 109 | /** Opcode to destroy previously created residency list */ |
| 110 | #define AMDGPU_BO_LIST_OP_DESTROY 1 |
| 111 | /** Opcode to update resource information in the list */ |
| 112 | #define AMDGPU_BO_LIST_OP_UPDATE 2 |
| 113 | |
| 114 | struct drm_amdgpu_bo_list_in { |
| 115 | /** Type of operation */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 116 | __u32 operation; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 117 | /** Handle of list or 0 if we want to create one */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 118 | __u32 list_handle; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 119 | /** Number of BOs in list */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 120 | __u32 bo_number; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 121 | /** Size of each element describing BO */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 122 | __u32 bo_info_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 123 | /** Pointer to array describing BOs */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 124 | __u64 bo_info_ptr; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | struct drm_amdgpu_bo_list_entry { |
| 128 | /** Handle of BO */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 129 | __u32 bo_handle; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 130 | /** New (if specified) BO priority to be used during migration */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 131 | __u32 bo_priority; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | struct drm_amdgpu_bo_list_out { |
| 135 | /** Handle of resource list */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 136 | __u32 list_handle; |
| 137 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | union drm_amdgpu_bo_list { |
| 141 | struct drm_amdgpu_bo_list_in in; |
| 142 | struct drm_amdgpu_bo_list_out out; |
| 143 | }; |
| 144 | |
| 145 | /* context related */ |
| 146 | #define AMDGPU_CTX_OP_ALLOC_CTX 1 |
| 147 | #define AMDGPU_CTX_OP_FREE_CTX 2 |
| 148 | #define AMDGPU_CTX_OP_QUERY_STATE 3 |
| 149 | |
Marek Olšák | d94aed5 | 2015-05-05 21:13:49 +0200 | [diff] [blame] | 150 | /* GPU reset status */ |
| 151 | #define AMDGPU_CTX_NO_RESET 0 |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 152 | /* this the context caused it */ |
| 153 | #define AMDGPU_CTX_GUILTY_RESET 1 |
| 154 | /* some other context caused it */ |
| 155 | #define AMDGPU_CTX_INNOCENT_RESET 2 |
| 156 | /* unknown cause */ |
| 157 | #define AMDGPU_CTX_UNKNOWN_RESET 3 |
Marek Olšák | d94aed5 | 2015-05-05 21:13:49 +0200 | [diff] [blame] | 158 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 159 | struct drm_amdgpu_ctx_in { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 160 | /** AMDGPU_CTX_OP_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 161 | __u32 op; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 162 | /** For future use, no flags defined so far */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 163 | __u32 flags; |
| 164 | __u32 ctx_id; |
| 165 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | union drm_amdgpu_ctx_out { |
| 169 | struct { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 170 | __u32 ctx_id; |
| 171 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 172 | } alloc; |
| 173 | |
| 174 | struct { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 175 | /** For future use, no flags defined so far */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 176 | __u64 flags; |
Marek Olšák | d94aed5 | 2015-05-05 21:13:49 +0200 | [diff] [blame] | 177 | /** Number of resets caused by this context so far. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 178 | __u32 hangs; |
Marek Olšák | d94aed5 | 2015-05-05 21:13:49 +0200 | [diff] [blame] | 179 | /** Reset status since the last call of the ioctl. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 180 | __u32 reset_status; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 181 | } state; |
| 182 | }; |
| 183 | |
| 184 | union drm_amdgpu_ctx { |
| 185 | struct drm_amdgpu_ctx_in in; |
| 186 | union drm_amdgpu_ctx_out out; |
| 187 | }; |
| 188 | |
| 189 | /* |
| 190 | * This is not a reliable API and you should expect it to fail for any |
| 191 | * number of reasons and have fallback path that do not use userptr to |
| 192 | * perform any operation. |
| 193 | */ |
| 194 | #define AMDGPU_GEM_USERPTR_READONLY (1 << 0) |
| 195 | #define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1) |
| 196 | #define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2) |
| 197 | #define AMDGPU_GEM_USERPTR_REGISTER (1 << 3) |
| 198 | |
| 199 | struct drm_amdgpu_gem_userptr { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 200 | __u64 addr; |
| 201 | __u64 size; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 202 | /* AMDGPU_GEM_USERPTR_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 203 | __u32 flags; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 204 | /* Resulting GEM handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 205 | __u32 handle; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 206 | }; |
| 207 | |
Marek Olšák | fbd76d5 | 2015-05-14 23:48:26 +0200 | [diff] [blame] | 208 | /* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */ |
| 209 | #define AMDGPU_TILING_ARRAY_MODE_SHIFT 0 |
| 210 | #define AMDGPU_TILING_ARRAY_MODE_MASK 0xf |
| 211 | #define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4 |
| 212 | #define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f |
| 213 | #define AMDGPU_TILING_TILE_SPLIT_SHIFT 9 |
| 214 | #define AMDGPU_TILING_TILE_SPLIT_MASK 0x7 |
| 215 | #define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12 |
| 216 | #define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7 |
| 217 | #define AMDGPU_TILING_BANK_WIDTH_SHIFT 15 |
| 218 | #define AMDGPU_TILING_BANK_WIDTH_MASK 0x3 |
| 219 | #define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17 |
| 220 | #define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3 |
| 221 | #define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19 |
| 222 | #define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3 |
| 223 | #define AMDGPU_TILING_NUM_BANKS_SHIFT 21 |
| 224 | #define AMDGPU_TILING_NUM_BANKS_MASK 0x3 |
| 225 | |
| 226 | #define AMDGPU_TILING_SET(field, value) \ |
| 227 | (((value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT) |
| 228 | #define AMDGPU_TILING_GET(value, field) \ |
| 229 | (((value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK) |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 230 | |
| 231 | #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1 |
| 232 | #define AMDGPU_GEM_METADATA_OP_GET_METADATA 2 |
| 233 | |
| 234 | /** The same structure is shared for input/output */ |
| 235 | struct drm_amdgpu_gem_metadata { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 236 | /** GEM Object handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 237 | __u32 handle; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 238 | /** Do we want get or set metadata */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 239 | __u32 op; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 240 | struct { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 241 | /** For future use, no flags defined so far */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 242 | __u64 flags; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 243 | /** family specific tiling info */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 244 | __u64 tiling_info; |
| 245 | __u32 data_size_bytes; |
| 246 | __u32 data[64]; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 247 | } data; |
| 248 | }; |
| 249 | |
| 250 | struct drm_amdgpu_gem_mmap_in { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 251 | /** the GEM object handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 252 | __u32 handle; |
| 253 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 254 | }; |
| 255 | |
| 256 | struct drm_amdgpu_gem_mmap_out { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 257 | /** mmap offset from the vma offset manager */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 258 | __u64 addr_ptr; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 259 | }; |
| 260 | |
| 261 | union drm_amdgpu_gem_mmap { |
| 262 | struct drm_amdgpu_gem_mmap_in in; |
| 263 | struct drm_amdgpu_gem_mmap_out out; |
| 264 | }; |
| 265 | |
| 266 | struct drm_amdgpu_gem_wait_idle_in { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 267 | /** GEM object handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 268 | __u32 handle; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 269 | /** For future use, no flags defined so far */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 270 | __u32 flags; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 271 | /** Absolute timeout to wait */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 272 | __u64 timeout; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 273 | }; |
| 274 | |
| 275 | struct drm_amdgpu_gem_wait_idle_out { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 276 | /** BO status: 0 - BO is idle, 1 - BO is busy */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 277 | __u32 status; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 278 | /** Returned current memory domain */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 279 | __u32 domain; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 280 | }; |
| 281 | |
| 282 | union drm_amdgpu_gem_wait_idle { |
| 283 | struct drm_amdgpu_gem_wait_idle_in in; |
| 284 | struct drm_amdgpu_gem_wait_idle_out out; |
| 285 | }; |
| 286 | |
| 287 | struct drm_amdgpu_wait_cs_in { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 288 | /** Command submission handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 289 | __u64 handle; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 290 | /** Absolute timeout to wait */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 291 | __u64 timeout; |
| 292 | __u32 ip_type; |
| 293 | __u32 ip_instance; |
| 294 | __u32 ring; |
| 295 | __u32 ctx_id; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 296 | }; |
| 297 | |
| 298 | struct drm_amdgpu_wait_cs_out { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 299 | /** CS status: 0 - CS completed, 1 - CS still busy */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 300 | __u64 status; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 301 | }; |
| 302 | |
| 303 | union drm_amdgpu_wait_cs { |
| 304 | struct drm_amdgpu_wait_cs_in in; |
| 305 | struct drm_amdgpu_wait_cs_out out; |
| 306 | }; |
| 307 | |
Marek Olšák | d8f65a2 | 2015-05-27 14:30:38 +0200 | [diff] [blame] | 308 | #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 |
| 309 | #define AMDGPU_GEM_OP_SET_PLACEMENT 1 |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 310 | |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 311 | /* Sets or returns a value associated with a buffer. */ |
| 312 | struct drm_amdgpu_gem_op { |
| 313 | /** GEM object handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 314 | __u32 handle; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 315 | /** AMDGPU_GEM_OP_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 316 | __u32 op; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 317 | /** Input or return value */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 318 | __u64 value; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 319 | }; |
| 320 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 321 | #define AMDGPU_VA_OP_MAP 1 |
| 322 | #define AMDGPU_VA_OP_UNMAP 2 |
| 323 | |
Christian König | fc220f6 | 2015-06-29 17:12:20 +0200 | [diff] [blame] | 324 | /* Delay the page table update till the next CS */ |
| 325 | #define AMDGPU_VM_DELAY_UPDATE (1 << 0) |
| 326 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 327 | /* Mapping flags */ |
| 328 | /* readable mapping */ |
| 329 | #define AMDGPU_VM_PAGE_READABLE (1 << 1) |
| 330 | /* writable mapping */ |
| 331 | #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) |
| 332 | /* executable mapping, new for VI */ |
| 333 | #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) |
| 334 | |
Christian König | 34b5f6a | 2015-06-08 15:03:00 +0200 | [diff] [blame] | 335 | struct drm_amdgpu_gem_va { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 336 | /** GEM object handle */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 337 | __u32 handle; |
| 338 | __u32 _pad; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 339 | /** AMDGPU_VA_OP_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 340 | __u32 operation; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 341 | /** AMDGPU_VM_PAGE_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 342 | __u32 flags; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 343 | /** va address to assign . Must be correctly aligned.*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 344 | __u64 va_address; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 345 | /** Specify offset inside of BO to assign. Must be correctly aligned.*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 346 | __u64 offset_in_bo; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 347 | /** Specify mapping size. Must be correctly aligned. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 348 | __u64 map_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 349 | }; |
| 350 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 351 | #define AMDGPU_HW_IP_GFX 0 |
| 352 | #define AMDGPU_HW_IP_COMPUTE 1 |
| 353 | #define AMDGPU_HW_IP_DMA 2 |
| 354 | #define AMDGPU_HW_IP_UVD 3 |
| 355 | #define AMDGPU_HW_IP_VCE 4 |
| 356 | #define AMDGPU_HW_IP_NUM 5 |
| 357 | |
| 358 | #define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1 |
| 359 | |
| 360 | #define AMDGPU_CHUNK_ID_IB 0x01 |
| 361 | #define AMDGPU_CHUNK_ID_FENCE 0x02 |
Christian König | 2b48d32 | 2015-06-19 17:31:29 +0200 | [diff] [blame] | 362 | #define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03 |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 363 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 364 | struct drm_amdgpu_cs_chunk { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 365 | __u32 chunk_id; |
| 366 | __u32 length_dw; |
| 367 | __u64 chunk_data; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 368 | }; |
| 369 | |
| 370 | struct drm_amdgpu_cs_in { |
| 371 | /** Rendering context id */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 372 | __u32 ctx_id; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 373 | /** Handle of resource list associated with CS */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 374 | __u32 bo_list_handle; |
| 375 | __u32 num_chunks; |
| 376 | __u32 _pad; |
| 377 | /** this points to __u64 * which point to cs chunks */ |
| 378 | __u64 chunks; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 379 | }; |
| 380 | |
| 381 | struct drm_amdgpu_cs_out { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 382 | __u64 handle; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 383 | }; |
| 384 | |
| 385 | union drm_amdgpu_cs { |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 386 | struct drm_amdgpu_cs_in in; |
| 387 | struct drm_amdgpu_cs_out out; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 388 | }; |
| 389 | |
| 390 | /* Specify flags to be used for IB */ |
| 391 | |
| 392 | /* This IB should be submitted to CE */ |
| 393 | #define AMDGPU_IB_FLAG_CE (1<<0) |
| 394 | |
Jammy Zhou | aa2bdb24 | 2015-05-11 23:49:34 +0800 | [diff] [blame] | 395 | /* CE Preamble */ |
Jammy Zhou | cab6d57 | 2015-06-06 04:49:22 +0800 | [diff] [blame] | 396 | #define AMDGPU_IB_FLAG_PREAMBLE (1<<1) |
Jammy Zhou | aa2bdb24 | 2015-05-11 23:49:34 +0800 | [diff] [blame] | 397 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 398 | struct drm_amdgpu_cs_chunk_ib { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 399 | __u32 _pad; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 400 | /** AMDGPU_IB_FLAG_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 401 | __u32 flags; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 402 | /** Virtual address to begin IB execution */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 403 | __u64 va_start; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 404 | /** Size of submission */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 405 | __u32 ib_bytes; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 406 | /** HW IP to submit to */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 407 | __u32 ip_type; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 408 | /** HW IP index of the same type to submit to */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 409 | __u32 ip_instance; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 410 | /** Ring index to submit to */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 411 | __u32 ring; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 412 | }; |
| 413 | |
Christian König | 2b48d32 | 2015-06-19 17:31:29 +0200 | [diff] [blame] | 414 | struct drm_amdgpu_cs_chunk_dep { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 415 | __u32 ip_type; |
| 416 | __u32 ip_instance; |
| 417 | __u32 ring; |
| 418 | __u32 ctx_id; |
| 419 | __u64 handle; |
Christian König | 2b48d32 | 2015-06-19 17:31:29 +0200 | [diff] [blame] | 420 | }; |
| 421 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 422 | struct drm_amdgpu_cs_chunk_fence { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 423 | __u32 handle; |
| 424 | __u32 offset; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 425 | }; |
| 426 | |
| 427 | struct drm_amdgpu_cs_chunk_data { |
| 428 | union { |
| 429 | struct drm_amdgpu_cs_chunk_ib ib_data; |
| 430 | struct drm_amdgpu_cs_chunk_fence fence_data; |
| 431 | }; |
| 432 | }; |
| 433 | |
| 434 | /** |
| 435 | * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU |
| 436 | * |
| 437 | */ |
| 438 | #define AMDGPU_IDS_FLAGS_FUSION 0x1 |
| 439 | |
| 440 | /* indicate if acceleration can be working */ |
| 441 | #define AMDGPU_INFO_ACCEL_WORKING 0x00 |
| 442 | /* get the crtc_id from the mode object id? */ |
| 443 | #define AMDGPU_INFO_CRTC_FROM_ID 0x01 |
| 444 | /* query hw IP info */ |
| 445 | #define AMDGPU_INFO_HW_IP_INFO 0x02 |
| 446 | /* query hw IP instance count for the specified type */ |
| 447 | #define AMDGPU_INFO_HW_IP_COUNT 0x03 |
| 448 | /* timestamp for GL_ARB_timer_query */ |
| 449 | #define AMDGPU_INFO_TIMESTAMP 0x05 |
| 450 | /* Query the firmware version */ |
| 451 | #define AMDGPU_INFO_FW_VERSION 0x0e |
| 452 | /* Subquery id: Query VCE firmware version */ |
| 453 | #define AMDGPU_INFO_FW_VCE 0x1 |
| 454 | /* Subquery id: Query UVD firmware version */ |
| 455 | #define AMDGPU_INFO_FW_UVD 0x2 |
| 456 | /* Subquery id: Query GMC firmware version */ |
| 457 | #define AMDGPU_INFO_FW_GMC 0x03 |
| 458 | /* Subquery id: Query GFX ME firmware version */ |
| 459 | #define AMDGPU_INFO_FW_GFX_ME 0x04 |
| 460 | /* Subquery id: Query GFX PFP firmware version */ |
| 461 | #define AMDGPU_INFO_FW_GFX_PFP 0x05 |
| 462 | /* Subquery id: Query GFX CE firmware version */ |
| 463 | #define AMDGPU_INFO_FW_GFX_CE 0x06 |
| 464 | /* Subquery id: Query GFX RLC firmware version */ |
| 465 | #define AMDGPU_INFO_FW_GFX_RLC 0x07 |
| 466 | /* Subquery id: Query GFX MEC firmware version */ |
| 467 | #define AMDGPU_INFO_FW_GFX_MEC 0x08 |
| 468 | /* Subquery id: Query SMC firmware version */ |
| 469 | #define AMDGPU_INFO_FW_SMC 0x0a |
| 470 | /* Subquery id: Query SDMA firmware version */ |
| 471 | #define AMDGPU_INFO_FW_SDMA 0x0b |
| 472 | /* number of bytes moved for TTM migration */ |
| 473 | #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f |
| 474 | /* the used VRAM size */ |
| 475 | #define AMDGPU_INFO_VRAM_USAGE 0x10 |
| 476 | /* the used GTT size */ |
| 477 | #define AMDGPU_INFO_GTT_USAGE 0x11 |
| 478 | /* Information about GDS, etc. resource configuration */ |
| 479 | #define AMDGPU_INFO_GDS_CONFIG 0x13 |
| 480 | /* Query information about VRAM and GTT domains */ |
| 481 | #define AMDGPU_INFO_VRAM_GTT 0x14 |
| 482 | /* Query information about register in MMR address space*/ |
| 483 | #define AMDGPU_INFO_READ_MMR_REG 0x15 |
| 484 | /* Query information about device: rev id, family, etc. */ |
| 485 | #define AMDGPU_INFO_DEV_INFO 0x16 |
| 486 | /* visible vram usage */ |
| 487 | #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 |
Marek Olšák | 83a59b6 | 2016-08-17 23:58:58 +0200 | [diff] [blame^] | 488 | /* number of TTM buffer evictions */ |
| 489 | #define AMDGPU_INFO_NUM_EVICTIONS 0x18 |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 490 | |
| 491 | #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 |
| 492 | #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff |
| 493 | #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8 |
| 494 | #define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff |
| 495 | |
Huang Rui | 000cab9 | 2016-06-12 15:44:44 +0800 | [diff] [blame] | 496 | struct drm_amdgpu_query_fw { |
| 497 | /** AMDGPU_INFO_FW_* */ |
| 498 | __u32 fw_type; |
| 499 | /** |
| 500 | * Index of the IP if there are more IPs of |
| 501 | * the same type. |
| 502 | */ |
| 503 | __u32 ip_instance; |
| 504 | /** |
| 505 | * Index of the engine. Whether this is used depends |
| 506 | * on the firmware type. (e.g. MEC, SDMA) |
| 507 | */ |
| 508 | __u32 index; |
| 509 | __u32 _pad; |
| 510 | }; |
| 511 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 512 | /* Input structure for the INFO ioctl */ |
| 513 | struct drm_amdgpu_info { |
| 514 | /* Where the return value will be stored */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 515 | __u64 return_pointer; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 516 | /* The size of the return value. Just like "size" in "snprintf", |
| 517 | * it limits how many bytes the kernel can write. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 518 | __u32 return_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 519 | /* The query request id. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 520 | __u32 query; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 521 | |
| 522 | union { |
| 523 | struct { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 524 | __u32 id; |
| 525 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 526 | } mode_crtc; |
| 527 | |
| 528 | struct { |
| 529 | /** AMDGPU_HW_IP_* */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 530 | __u32 type; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 531 | /** |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 532 | * Index of the IP if there are more IPs of the same |
| 533 | * type. Ignored by AMDGPU_INFO_HW_IP_COUNT. |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 534 | */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 535 | __u32 ip_instance; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 536 | } query_hw_ip; |
| 537 | |
| 538 | struct { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 539 | __u32 dword_offset; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 540 | /** number of registers to read */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 541 | __u32 count; |
| 542 | __u32 instance; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 543 | /** For future use, no flags defined so far */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 544 | __u32 flags; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 545 | } read_mmr_reg; |
| 546 | |
Huang Rui | 000cab9 | 2016-06-12 15:44:44 +0800 | [diff] [blame] | 547 | struct drm_amdgpu_query_fw query_fw; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 548 | }; |
| 549 | }; |
| 550 | |
| 551 | struct drm_amdgpu_info_gds { |
| 552 | /** GDS GFX partition size */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 553 | __u32 gds_gfx_partition_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 554 | /** GDS compute partition size */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 555 | __u32 compute_partition_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 556 | /** total GDS memory size */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 557 | __u32 gds_total_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 558 | /** GWS size per GFX partition */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 559 | __u32 gws_per_gfx_partition; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 560 | /** GSW size per compute partition */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 561 | __u32 gws_per_compute_partition; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 562 | /** OA size per GFX partition */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 563 | __u32 oa_per_gfx_partition; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 564 | /** OA size per compute partition */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 565 | __u32 oa_per_compute_partition; |
| 566 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 567 | }; |
| 568 | |
| 569 | struct drm_amdgpu_info_vram_gtt { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 570 | __u64 vram_size; |
| 571 | __u64 vram_cpu_accessible_size; |
| 572 | __u64 gtt_size; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 573 | }; |
| 574 | |
| 575 | struct drm_amdgpu_info_firmware { |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 576 | __u32 ver; |
| 577 | __u32 feature; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 578 | }; |
| 579 | |
Ken Wang | 81c59f5 | 2015-06-03 21:02:01 +0800 | [diff] [blame] | 580 | #define AMDGPU_VRAM_TYPE_UNKNOWN 0 |
| 581 | #define AMDGPU_VRAM_TYPE_GDDR1 1 |
| 582 | #define AMDGPU_VRAM_TYPE_DDR2 2 |
| 583 | #define AMDGPU_VRAM_TYPE_GDDR3 3 |
| 584 | #define AMDGPU_VRAM_TYPE_GDDR4 4 |
| 585 | #define AMDGPU_VRAM_TYPE_GDDR5 5 |
| 586 | #define AMDGPU_VRAM_TYPE_HBM 6 |
| 587 | #define AMDGPU_VRAM_TYPE_DDR3 7 |
| 588 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 589 | struct drm_amdgpu_info_device { |
| 590 | /** PCI Device ID */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 591 | __u32 device_id; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 592 | /** Internal chip revision: A0, A1, etc.) */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 593 | __u32 chip_rev; |
| 594 | __u32 external_rev; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 595 | /** Revision id in PCI Config space */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 596 | __u32 pci_rev; |
| 597 | __u32 family; |
| 598 | __u32 num_shader_engines; |
| 599 | __u32 num_shader_arrays_per_engine; |
Christian König | 675da0d | 2015-06-09 15:54:37 +0200 | [diff] [blame] | 600 | /* in KHz */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 601 | __u32 gpu_counter_freq; |
| 602 | __u64 max_engine_clock; |
| 603 | __u64 max_memory_clock; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 604 | /* cu information */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 605 | __u32 cu_active_number; |
| 606 | __u32 cu_ao_mask; |
| 607 | __u32 cu_bitmap[4][4]; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 608 | /** Render backend pipe mask. One render backend is CB+DB. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 609 | __u32 enabled_rb_pipes_mask; |
| 610 | __u32 num_rb_pipes; |
| 611 | __u32 num_hw_gfx_contexts; |
| 612 | __u32 _pad; |
| 613 | __u64 ids_flags; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 614 | /** Starting virtual address for UMDs. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 615 | __u64 virtual_address_offset; |
Jammy Zhou | 02b70c8 | 2015-05-12 22:46:45 +0800 | [diff] [blame] | 616 | /** The maximum virtual address */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 617 | __u64 virtual_address_max; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 618 | /** Required alignment of virtual addresses. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 619 | __u32 virtual_address_alignment; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 620 | /** Page table entry - fragment size */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 621 | __u32 pte_fragment_size; |
| 622 | __u32 gart_page_size; |
Ken Wang | a101a89 | 2015-06-03 17:47:54 +0800 | [diff] [blame] | 623 | /** constant engine ram size*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 624 | __u32 ce_ram_size; |
Jammy Zhou | cab6d57 | 2015-06-06 04:49:22 +0800 | [diff] [blame] | 625 | /** video memory type info*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 626 | __u32 vram_type; |
Ken Wang | 81c59f5 | 2015-06-03 21:02:01 +0800 | [diff] [blame] | 627 | /** video memory bit width*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 628 | __u32 vram_bit_width; |
Leo Liu | fa92754 | 2015-07-13 12:46:23 -0400 | [diff] [blame] | 629 | /* vce harvesting instance */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 630 | __u32 vce_harvest_config; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 631 | }; |
| 632 | |
| 633 | struct drm_amdgpu_info_hw_ip { |
| 634 | /** Version of h/w IP */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 635 | __u32 hw_ip_version_major; |
| 636 | __u32 hw_ip_version_minor; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 637 | /** Capabilities */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 638 | __u64 capabilities_flags; |
Ken Wang | 71062f4 | 2015-06-04 21:26:57 +0800 | [diff] [blame] | 639 | /** command buffer address start alignment*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 640 | __u32 ib_start_alignment; |
Ken Wang | 71062f4 | 2015-06-04 21:26:57 +0800 | [diff] [blame] | 641 | /** command buffer size alignment*/ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 642 | __u32 ib_size_alignment; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 643 | /** Bitmask of available rings. Bit 0 means ring 0, etc. */ |
Mikko Rapeli | 2ce9dde | 2015-12-02 23:44:33 +0100 | [diff] [blame] | 644 | __u32 available_rings; |
| 645 | __u32 _pad; |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 646 | }; |
| 647 | |
| 648 | /* |
| 649 | * Supported GPU families |
| 650 | */ |
| 651 | #define AMDGPU_FAMILY_UNKNOWN 0 |
| 652 | #define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */ |
| 653 | #define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */ |
| 654 | #define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */ |
Samuel Li | 39bb0c9 | 2015-10-08 16:31:43 -0400 | [diff] [blame] | 655 | #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 656 | |
Emil Velikov | cfa7152 | 2016-04-07 18:45:18 +0100 | [diff] [blame] | 657 | #if defined(__cplusplus) |
| 658 | } |
| 659 | #endif |
| 660 | |
Alex Deucher | 81629cb | 2015-04-20 16:42:01 -0400 | [diff] [blame] | 661 | #endif |