blob: f7d870e737f48a93c53b1d7e721f42da503ce17a [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 Cheng655a7c02013-10-16 16:09:24 -07007#ifndef __NOUVEAU_DRM_H__
8#define __NOUVEAU_DRM_H__
Christopher Ferris82d75042015-01-26 10:57:07 -08009#define DRM_NOUVEAU_EVENT_NVIF 0x80000000
Christopher Ferris106b3a82016-08-24 12:15:38 -070010#include "drm.h"
Christopher Ferris106b3a82016-08-24 12:15:38 -070011#ifdef __cplusplus
Christopher Ferris48fe0ae2019-01-10 15:59:33 -080012extern "C" {
Christopher Ferris106b3a82016-08-24 12:15:38 -070013#endif
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070014#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 Ferrisb830ddf2024-03-28 11:48:08 -070026#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
27#define NOUVEAU_GETPARAM_VRAM_USED 19
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070028struct drm_nouveau_getparam {
29 __u64 param;
30 __u64 value;
31};
32struct 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};
44struct drm_nouveau_channel_free {
45 __s32 channel;
46};
Christopher Ferris106b3a82016-08-24 12:15:38 -070047#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -080048#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070049#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
50#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
Christopher Ferris05d08e92016-02-04 13:16:38 -080051#define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070052#define NOUVEAU_GEM_DOMAIN_NO_SHARE (1 << 5)
Ben Cheng655a7c02013-10-16 16:09:24 -070053#define NOUVEAU_GEM_TILE_COMP 0x00030000
54#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
Ben Cheng655a7c02013-10-16 16:09:24 -070055#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 Cheng655a7c02013-10-16 16:09:24 -070059struct drm_nouveau_gem_info {
Christopher Ferris106b3a82016-08-24 12:15:38 -070060 __u32 handle;
61 __u32 domain;
Christopher Ferris106b3a82016-08-24 12:15:38 -070062 __u64 size;
63 __u64 offset;
64 __u64 map_handle;
65 __u32 tile_mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -070066 __u32 tile_flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070067};
68struct drm_nouveau_gem_new {
Tao Baod7db5942015-01-28 10:07:51 -080069 struct drm_nouveau_gem_info info;
Christopher Ferris106b3a82016-08-24 12:15:38 -070070 __u32 channel_hint;
71 __u32 align;
Ben Cheng655a7c02013-10-16 16:09:24 -070072};
73#define NOUVEAU_GEM_MAX_BUFFERS 1024
Christopher Ferris106b3a82016-08-24 12:15:38 -070074struct drm_nouveau_gem_pushbuf_bo_presumed {
75 __u32 valid;
76 __u32 domain;
77 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070078};
Ben Cheng655a7c02013-10-16 16:09:24 -070079struct drm_nouveau_gem_pushbuf_bo {
Christopher Ferris106b3a82016-08-24 12:15:38 -070080 __u64 user_priv;
81 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070082 __u32 read_domains;
83 __u32 write_domains;
84 __u32 valid_domains;
Tao Baod7db5942015-01-28 10:07:51 -080085 struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
Ben Cheng655a7c02013-10-16 16:09:24 -070086};
Ben Cheng655a7c02013-10-16 16:09:24 -070087#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 Cheng655a7c02013-10-16 16:09:24 -070091struct drm_nouveau_gem_pushbuf_reloc {
Christopher Ferris106b3a82016-08-24 12:15:38 -070092 __u32 reloc_bo_index;
93 __u32 reloc_bo_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -070094 __u32 bo_index;
95 __u32 flags;
96 __u32 data;
97 __u32 vor;
Christopher Ferris106b3a82016-08-24 12:15:38 -070098 __u32 tor;
Ben Cheng655a7c02013-10-16 16:09:24 -070099};
100#define NOUVEAU_GEM_MAX_PUSH 512
101struct drm_nouveau_gem_pushbuf_push {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700102 __u32 bo_index;
103 __u32 pad;
104 __u64 offset;
105 __u64 length;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700106#define NOUVEAU_GEM_PUSHBUF_NO_PREFETCH (1 << 23)
Ben Cheng655a7c02013-10-16 16:09:24 -0700107};
Ben Cheng655a7c02013-10-16 16:09:24 -0700108struct drm_nouveau_gem_pushbuf {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700109 __u32 channel;
110 __u32 nr_buffers;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700111 __u64 buffers;
112 __u32 nr_relocs;
113 __u32 nr_push;
114 __u64 relocs;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700115 __u64 push;
116 __u32 suffix0;
117 __u32 suffix1;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700118#define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700119 __u64 vram_available;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700120 __u64 gart_available;
Ben Cheng655a7c02013-10-16 16:09:24 -0700121};
122#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
123#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
124struct drm_nouveau_gem_cpu_prep {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700125 __u32 handle;
126 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700127};
128struct drm_nouveau_gem_cpu_fini {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700129 __u32 handle;
Ben Cheng655a7c02013-10-16 16:09:24 -0700130};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700131struct 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};
139struct drm_nouveau_vm_init {
140 __u64 kernel_managed_addr;
141 __u64 kernel_managed_size;
142};
143struct 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};
155struct 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};
165struct drm_nouveau_exec_push {
166 __u64 va;
167 __u32 va_len;
168 __u32 flags;
169#define DRM_NOUVEAU_EXEC_PUSH_NO_PREFETCH 0x1
170};
171struct 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 Cheng655a7c02013-10-16 16:09:24 -0700180#define DRM_NOUVEAU_GETPARAM 0x00
181#define DRM_NOUVEAU_SETPARAM 0x01
Ben Cheng655a7c02013-10-16 16:09:24 -0700182#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 Cheng655a7c02013-10-16 16:09:24 -0700186#define DRM_NOUVEAU_GPUOBJ_FREE 0x06
Christopher Ferris82d75042015-01-26 10:57:07 -0800187#define DRM_NOUVEAU_NVIF 0x07
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700188#define DRM_NOUVEAU_SVM_INIT 0x08
189#define DRM_NOUVEAU_SVM_BIND 0x09
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700190#define DRM_NOUVEAU_VM_INIT 0x10
191#define DRM_NOUVEAU_VM_BIND 0x11
192#define DRM_NOUVEAU_EXEC 0x12
Ben Cheng655a7c02013-10-16 16:09:24 -0700193#define DRM_NOUVEAU_GEM_NEW 0x40
194#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
Christopher Ferris82d75042015-01-26 10:57:07 -0800195#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
Ben Cheng655a7c02013-10-16 16:09:24 -0700196#define DRM_NOUVEAU_GEM_CPU_FINI 0x43
197#define DRM_NOUVEAU_GEM_INFO 0x44
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700198struct drm_nouveau_svm_init {
199 __u64 unmanaged_addr;
200 __u64 unmanaged_size;
201};
202struct 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 Ferris67d1e5e2023-10-31 13:36:37 -0700225#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 Ferris24f97eb2019-05-20 12:58:13 -0700228#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 Cheng655a7c02013-10-16 16:09:24 -0700230#define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
Christopher Ferris82d75042015-01-26 10:57:07 -0800231#define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
Tao Baod7db5942015-01-28 10:07:51 -0800232#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 Cheng655a7c02013-10-16 16:09:24 -0700234#define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700235#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 Ferris106b3a82016-08-24 12:15:38 -0700238#ifdef __cplusplus
Christopher Ferris48fe0ae2019-01-10 15:59:33 -0800239}
Christopher Ferris82d75042015-01-26 10:57:07 -0800240#endif
Christopher Ferris106b3a82016-08-24 12:15:38 -0700241#endif