blob: e2cfe80f6fcae39be38334a03dd81b1752aae90c [file] [log] [blame]
Ben Skeggs6ee73862009-12-11 19:24:15 +10001/*
2 * Copyright 2005 Stephane Marchesin.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * 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 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef __NOUVEAU_DRM_H__
26#define __NOUVEAU_DRM_H__
27
Ben Skeggsa1606a92010-02-12 10:27:35 +100028#define NOUVEAU_DRM_HEADER_PATCHLEVEL 16
Ben Skeggs6ee73862009-12-11 19:24:15 +100029
30struct drm_nouveau_channel_alloc {
31 uint32_t fb_ctxdma_handle;
32 uint32_t tt_ctxdma_handle;
33
34 int channel;
Ben Skeggsa1606a92010-02-12 10:27:35 +100035 uint32_t pushbuf_domains;
Ben Skeggs6ee73862009-12-11 19:24:15 +100036
37 /* Notifier memory */
38 uint32_t notifier_handle;
39
40 /* DRM-enforced subchannel assignments */
41 struct {
42 uint32_t handle;
43 uint32_t grclass;
44 } subchan[8];
45 uint32_t nr_subchan;
46};
47
48struct drm_nouveau_channel_free {
49 int channel;
50};
51
52struct drm_nouveau_grobj_alloc {
53 int channel;
54 uint32_t handle;
55 int class;
56};
57
58struct drm_nouveau_notifierobj_alloc {
59 uint32_t channel;
60 uint32_t handle;
61 uint32_t size;
62 uint32_t offset;
63};
64
65struct drm_nouveau_gpuobj_free {
66 int channel;
67 uint32_t handle;
68};
69
70/* FIXME : maybe unify {GET,SET}PARAMs */
71#define NOUVEAU_GETPARAM_PCI_VENDOR 3
72#define NOUVEAU_GETPARAM_PCI_DEVICE 4
73#define NOUVEAU_GETPARAM_BUS_TYPE 5
Ben Skeggs6ee73862009-12-11 19:24:15 +100074#define NOUVEAU_GETPARAM_FB_SIZE 8
75#define NOUVEAU_GETPARAM_AGP_SIZE 9
Ben Skeggs6ee73862009-12-11 19:24:15 +100076#define NOUVEAU_GETPARAM_CHIPSET_ID 11
77#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
Marcin Koƛcielnicki69c97002010-01-26 18:39:20 +000078#define NOUVEAU_GETPARAM_GRAPH_UNITS 13
Marcin Koƛcielnicki7fc74f12010-05-23 11:36:04 +000079#define NOUVEAU_GETPARAM_PTIMER_TIME 14
Francisco Jerezf13b3262010-10-10 06:01:08 +020080#define NOUVEAU_GETPARAM_HAS_BO_USAGE 15
Francisco Jerez332b2422010-10-20 23:35:40 +020081#define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16
Ben Skeggs6ee73862009-12-11 19:24:15 +100082struct drm_nouveau_getparam {
83 uint64_t param;
84 uint64_t value;
85};
86
87struct drm_nouveau_setparam {
88 uint64_t param;
89 uint64_t value;
90};
91
92#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
93#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
94#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
95#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
96
Francisco Jerezf13b3262010-10-10 06:01:08 +020097#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
98#define NOUVEAU_GEM_TILE_16BPP 0x00000001
99#define NOUVEAU_GEM_TILE_32BPP 0x00000002
100#define NOUVEAU_GEM_TILE_ZETA 0x00000004
101#define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008
102
Ben Skeggs6ee73862009-12-11 19:24:15 +1000103struct drm_nouveau_gem_info {
104 uint32_t handle;
105 uint32_t domain;
106 uint64_t size;
107 uint64_t offset;
108 uint64_t map_handle;
109 uint32_t tile_mode;
110 uint32_t tile_flags;
111};
112
113struct drm_nouveau_gem_new {
114 struct drm_nouveau_gem_info info;
115 uint32_t channel_hint;
116 uint32_t align;
117};
118
Ben Skeggsa1606a92010-02-12 10:27:35 +1000119#define NOUVEAU_GEM_MAX_BUFFERS 1024
120struct drm_nouveau_gem_pushbuf_bo_presumed {
121 uint32_t valid;
122 uint32_t domain;
123 uint64_t offset;
124};
125
Ben Skeggs6ee73862009-12-11 19:24:15 +1000126struct drm_nouveau_gem_pushbuf_bo {
127 uint64_t user_priv;
128 uint32_t handle;
129 uint32_t read_domains;
130 uint32_t write_domains;
131 uint32_t valid_domains;
Ben Skeggsa1606a92010-02-12 10:27:35 +1000132 struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000133};
134
135#define NOUVEAU_GEM_RELOC_LOW (1 << 0)
136#define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
137#define NOUVEAU_GEM_RELOC_OR (1 << 2)
Ben Skeggsa1606a92010-02-12 10:27:35 +1000138#define NOUVEAU_GEM_MAX_RELOCS 1024
Ben Skeggs6ee73862009-12-11 19:24:15 +1000139struct drm_nouveau_gem_pushbuf_reloc {
Ben Skeggsa1606a92010-02-12 10:27:35 +1000140 uint32_t reloc_bo_index;
141 uint32_t reloc_bo_offset;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000142 uint32_t bo_index;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000143 uint32_t flags;
144 uint32_t data;
145 uint32_t vor;
146 uint32_t tor;
147};
148
Ben Skeggsa1606a92010-02-12 10:27:35 +1000149#define NOUVEAU_GEM_MAX_PUSH 512
150struct drm_nouveau_gem_pushbuf_push {
151 uint32_t bo_index;
152 uint32_t pad;
153 uint64_t offset;
154 uint64_t length;
155};
Ben Skeggs6ee73862009-12-11 19:24:15 +1000156
157struct drm_nouveau_gem_pushbuf {
158 uint32_t channel;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000159 uint32_t nr_buffers;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000160 uint64_t buffers;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000161 uint32_t nr_relocs;
Ben Skeggsa1606a92010-02-12 10:27:35 +1000162 uint32_t nr_push;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000163 uint64_t relocs;
Ben Skeggsa1606a92010-02-12 10:27:35 +1000164 uint64_t push;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000165 uint32_t suffix0;
166 uint32_t suffix1;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000167 uint64_t vram_available;
168 uint64_t gart_available;
169};
170
Ben Skeggs6ee73862009-12-11 19:24:15 +1000171#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
Ben Skeggs6ee73862009-12-11 19:24:15 +1000172#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
173struct drm_nouveau_gem_cpu_prep {
174 uint32_t handle;
175 uint32_t flags;
176};
177
178struct drm_nouveau_gem_cpu_fini {
179 uint32_t handle;
180};
181
Ben Skeggs6ee73862009-12-11 19:24:15 +1000182enum nouveau_bus_type {
183 NV_AGP = 0,
184 NV_PCI = 1,
185 NV_PCIE = 2,
186};
187
188struct drm_nouveau_sarea {
189};
190
Ben Skeggsa1606a92010-02-12 10:27:35 +1000191#define DRM_NOUVEAU_GETPARAM 0x00
192#define DRM_NOUVEAU_SETPARAM 0x01
193#define DRM_NOUVEAU_CHANNEL_ALLOC 0x02
194#define DRM_NOUVEAU_CHANNEL_FREE 0x03
195#define DRM_NOUVEAU_GROBJ_ALLOC 0x04
196#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05
197#define DRM_NOUVEAU_GPUOBJ_FREE 0x06
Ben Skeggs6ee73862009-12-11 19:24:15 +1000198#define DRM_NOUVEAU_GEM_NEW 0x40
199#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
Ben Skeggsa1606a92010-02-12 10:27:35 +1000200#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
201#define DRM_NOUVEAU_GEM_CPU_FINI 0x43
202#define DRM_NOUVEAU_GEM_INFO 0x44
Ben Skeggs6ee73862009-12-11 19:24:15 +1000203
Dave Airlie1b2f1482010-08-14 20:20:34 +1000204#define DRM_IOCTL_NOUVEAU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
205#define DRM_IOCTL_NOUVEAU_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)
206#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
207#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
208#define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)
209#define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)
210#define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)
211#define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
212#define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
213#define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep)
214#define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini)
215#define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info)
216
Ben Skeggs6ee73862009-12-11 19:24:15 +1000217#endif /* __NOUVEAU_DRM_H__ */