Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef __NOUVEAU_DRM_H__ |
| 8 | #define __NOUVEAU_DRM_H__ |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 9 | #define DRM_NOUVEAU_EVENT_NVIF 0x80000000 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 10 | #include "drm.h" |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 11 | #ifdef __cplusplus |
Christopher Ferris | 48fe0ae | 2019-01-10 15:59:33 -0800 | [diff] [blame] | 12 | extern "C" { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 13 | #endif |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 14 | #define NOUVEAU_GETPARAM_PCI_VENDOR 3 |
| 15 | #define NOUVEAU_GETPARAM_PCI_DEVICE 4 |
| 16 | #define NOUVEAU_GETPARAM_BUS_TYPE 5 |
| 17 | #define NOUVEAU_GETPARAM_FB_SIZE 8 |
| 18 | #define NOUVEAU_GETPARAM_AGP_SIZE 9 |
| 19 | #define NOUVEAU_GETPARAM_CHIPSET_ID 11 |
| 20 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 |
| 21 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 |
| 22 | #define NOUVEAU_GETPARAM_PTIMER_TIME 14 |
| 23 | #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 |
| 24 | #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16 |
| 25 | #define NOUVEAU_GETPARAM_EXEC_PUSH_MAX 17 |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 26 | #define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18 |
| 27 | #define NOUVEAU_GETPARAM_VRAM_USED 19 |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 28 | struct drm_nouveau_getparam { |
| 29 | __u64 param; |
| 30 | __u64 value; |
| 31 | }; |
| 32 | struct drm_nouveau_channel_alloc { |
| 33 | __u32 fb_ctxdma_handle; |
| 34 | __u32 tt_ctxdma_handle; |
| 35 | __s32 channel; |
| 36 | __u32 pushbuf_domains; |
| 37 | __u32 notifier_handle; |
| 38 | struct { |
| 39 | __u32 handle; |
| 40 | __u32 grclass; |
| 41 | } subchan[8]; |
| 42 | __u32 nr_subchan; |
| 43 | }; |
| 44 | struct drm_nouveau_channel_free { |
| 45 | __s32 channel; |
| 46 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 47 | #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 48 | #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 49 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) |
| 50 | #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 51 | #define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 52 | #define NOUVEAU_GEM_DOMAIN_NO_SHARE (1 << 5) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 53 | #define NOUVEAU_GEM_TILE_COMP 0x00030000 |
| 54 | #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 55 | #define NOUVEAU_GEM_TILE_16BPP 0x00000001 |
| 56 | #define NOUVEAU_GEM_TILE_32BPP 0x00000002 |
| 57 | #define NOUVEAU_GEM_TILE_ZETA 0x00000004 |
| 58 | #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 59 | struct drm_nouveau_gem_info { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 60 | __u32 handle; |
| 61 | __u32 domain; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 62 | __u64 size; |
| 63 | __u64 offset; |
| 64 | __u64 map_handle; |
| 65 | __u32 tile_mode; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 66 | __u32 tile_flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 67 | }; |
| 68 | struct drm_nouveau_gem_new { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 69 | struct drm_nouveau_gem_info info; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 70 | __u32 channel_hint; |
| 71 | __u32 align; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 72 | }; |
| 73 | #define NOUVEAU_GEM_MAX_BUFFERS 1024 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 74 | struct drm_nouveau_gem_pushbuf_bo_presumed { |
| 75 | __u32 valid; |
| 76 | __u32 domain; |
| 77 | __u64 offset; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 78 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 79 | struct drm_nouveau_gem_pushbuf_bo { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 80 | __u64 user_priv; |
| 81 | __u32 handle; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 82 | __u32 read_domains; |
| 83 | __u32 write_domains; |
| 84 | __u32 valid_domains; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 85 | struct drm_nouveau_gem_pushbuf_bo_presumed presumed; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 86 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 87 | #define NOUVEAU_GEM_RELOC_LOW (1 << 0) |
| 88 | #define NOUVEAU_GEM_RELOC_HIGH (1 << 1) |
| 89 | #define NOUVEAU_GEM_RELOC_OR (1 << 2) |
| 90 | #define NOUVEAU_GEM_MAX_RELOCS 1024 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 91 | struct drm_nouveau_gem_pushbuf_reloc { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 92 | __u32 reloc_bo_index; |
| 93 | __u32 reloc_bo_offset; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 94 | __u32 bo_index; |
| 95 | __u32 flags; |
| 96 | __u32 data; |
| 97 | __u32 vor; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 98 | __u32 tor; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 99 | }; |
| 100 | #define NOUVEAU_GEM_MAX_PUSH 512 |
| 101 | struct drm_nouveau_gem_pushbuf_push { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 102 | __u32 bo_index; |
| 103 | __u32 pad; |
| 104 | __u64 offset; |
| 105 | __u64 length; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 106 | #define NOUVEAU_GEM_PUSHBUF_NO_PREFETCH (1 << 23) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 107 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 108 | struct drm_nouveau_gem_pushbuf { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 109 | __u32 channel; |
| 110 | __u32 nr_buffers; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 111 | __u64 buffers; |
| 112 | __u32 nr_relocs; |
| 113 | __u32 nr_push; |
| 114 | __u64 relocs; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 115 | __u64 push; |
| 116 | __u32 suffix0; |
| 117 | __u32 suffix1; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 118 | #define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 119 | __u64 vram_available; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 120 | __u64 gart_available; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 121 | }; |
| 122 | #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 |
| 123 | #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 |
| 124 | struct drm_nouveau_gem_cpu_prep { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 125 | __u32 handle; |
| 126 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 127 | }; |
| 128 | struct drm_nouveau_gem_cpu_fini { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 129 | __u32 handle; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 130 | }; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 131 | struct drm_nouveau_sync { |
| 132 | __u32 flags; |
| 133 | #define DRM_NOUVEAU_SYNC_SYNCOBJ 0x0 |
| 134 | #define DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ 0x1 |
| 135 | #define DRM_NOUVEAU_SYNC_TYPE_MASK 0xf |
| 136 | __u32 handle; |
| 137 | __u64 timeline_value; |
| 138 | }; |
| 139 | struct drm_nouveau_vm_init { |
| 140 | __u64 kernel_managed_addr; |
| 141 | __u64 kernel_managed_size; |
| 142 | }; |
| 143 | struct drm_nouveau_vm_bind_op { |
| 144 | __u32 op; |
| 145 | #define DRM_NOUVEAU_VM_BIND_OP_MAP 0x0 |
| 146 | #define DRM_NOUVEAU_VM_BIND_OP_UNMAP 0x1 |
| 147 | __u32 flags; |
| 148 | #define DRM_NOUVEAU_VM_BIND_SPARSE (1 << 8) |
| 149 | __u32 handle; |
| 150 | __u32 pad; |
| 151 | __u64 addr; |
| 152 | __u64 bo_offset; |
| 153 | __u64 range; |
| 154 | }; |
| 155 | struct drm_nouveau_vm_bind { |
| 156 | __u32 op_count; |
| 157 | __u32 flags; |
| 158 | #define DRM_NOUVEAU_VM_BIND_RUN_ASYNC 0x1 |
| 159 | __u32 wait_count; |
| 160 | __u32 sig_count; |
| 161 | __u64 wait_ptr; |
| 162 | __u64 sig_ptr; |
| 163 | __u64 op_ptr; |
| 164 | }; |
| 165 | struct drm_nouveau_exec_push { |
| 166 | __u64 va; |
| 167 | __u32 va_len; |
| 168 | __u32 flags; |
| 169 | #define DRM_NOUVEAU_EXEC_PUSH_NO_PREFETCH 0x1 |
| 170 | }; |
| 171 | struct drm_nouveau_exec { |
| 172 | __u32 channel; |
| 173 | __u32 push_count; |
| 174 | __u32 wait_count; |
| 175 | __u32 sig_count; |
| 176 | __u64 wait_ptr; |
| 177 | __u64 sig_ptr; |
| 178 | __u64 push_ptr; |
| 179 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 180 | #define DRM_NOUVEAU_GETPARAM 0x00 |
| 181 | #define DRM_NOUVEAU_SETPARAM 0x01 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 182 | #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 |
| 183 | #define DRM_NOUVEAU_CHANNEL_FREE 0x03 |
| 184 | #define DRM_NOUVEAU_GROBJ_ALLOC 0x04 |
| 185 | #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 186 | #define DRM_NOUVEAU_GPUOBJ_FREE 0x06 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 187 | #define DRM_NOUVEAU_NVIF 0x07 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 188 | #define DRM_NOUVEAU_SVM_INIT 0x08 |
| 189 | #define DRM_NOUVEAU_SVM_BIND 0x09 |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 190 | #define DRM_NOUVEAU_VM_INIT 0x10 |
| 191 | #define DRM_NOUVEAU_VM_BIND 0x11 |
| 192 | #define DRM_NOUVEAU_EXEC 0x12 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 193 | #define DRM_NOUVEAU_GEM_NEW 0x40 |
| 194 | #define DRM_NOUVEAU_GEM_PUSHBUF 0x41 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 195 | #define DRM_NOUVEAU_GEM_CPU_PREP 0x42 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 196 | #define DRM_NOUVEAU_GEM_CPU_FINI 0x43 |
| 197 | #define DRM_NOUVEAU_GEM_INFO 0x44 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 198 | struct drm_nouveau_svm_init { |
| 199 | __u64 unmanaged_addr; |
| 200 | __u64 unmanaged_size; |
| 201 | }; |
| 202 | struct drm_nouveau_svm_bind { |
| 203 | __u64 header; |
| 204 | __u64 va_start; |
| 205 | __u64 va_end; |
| 206 | __u64 npages; |
| 207 | __u64 stride; |
| 208 | __u64 result; |
| 209 | __u64 reserved0; |
| 210 | __u64 reserved1; |
| 211 | }; |
| 212 | #define NOUVEAU_SVM_BIND_COMMAND_SHIFT 0 |
| 213 | #define NOUVEAU_SVM_BIND_COMMAND_BITS 8 |
| 214 | #define NOUVEAU_SVM_BIND_COMMAND_MASK ((1 << 8) - 1) |
| 215 | #define NOUVEAU_SVM_BIND_PRIORITY_SHIFT 8 |
| 216 | #define NOUVEAU_SVM_BIND_PRIORITY_BITS 8 |
| 217 | #define NOUVEAU_SVM_BIND_PRIORITY_MASK ((1 << 8) - 1) |
| 218 | #define NOUVEAU_SVM_BIND_TARGET_SHIFT 16 |
| 219 | #define NOUVEAU_SVM_BIND_TARGET_BITS 32 |
| 220 | #define NOUVEAU_SVM_BIND_TARGET_MASK 0xffffffff |
| 221 | #define NOUVEAU_SVM_BIND_VALID_BITS 48 |
| 222 | #define NOUVEAU_SVM_BIND_VALID_MASK ((1ULL << NOUVEAU_SVM_BIND_VALID_BITS) - 1) |
| 223 | #define NOUVEAU_SVM_BIND_COMMAND__MIGRATE 0 |
| 224 | #define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM (1UL << 31) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 225 | #define DRM_IOCTL_NOUVEAU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam) |
| 226 | #define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc) |
| 227 | #define DRM_IOCTL_NOUVEAU_CHANNEL_FREE DRM_IOW(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 228 | #define DRM_IOCTL_NOUVEAU_SVM_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_INIT, struct drm_nouveau_svm_init) |
| 229 | #define DRM_IOCTL_NOUVEAU_SVM_BIND DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_BIND, struct drm_nouveau_svm_bind) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 230 | #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new) |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 231 | #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 232 | #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep) |
| 233 | #define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 234 | #define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 235 | #define DRM_IOCTL_NOUVEAU_VM_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_VM_INIT, struct drm_nouveau_vm_init) |
| 236 | #define DRM_IOCTL_NOUVEAU_VM_BIND DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_VM_BIND, struct drm_nouveau_vm_bind) |
| 237 | #define DRM_IOCTL_NOUVEAU_EXEC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_EXEC, struct drm_nouveau_exec) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 238 | #ifdef __cplusplus |
Christopher Ferris | 48fe0ae | 2019-01-10 15:59:33 -0800 | [diff] [blame] | 239 | } |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 240 | #endif |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 241 | #endif |