Merge branch 'x86-microcode-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / include / drm / nouveau_drm.h
CommitLineData
6ee73861
BS
1/*
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
a1606a95 28#define NOUVEAU_DRM_HEADER_PATCHLEVEL 16
6ee73861
BS
29
30struct drm_nouveau_channel_alloc {
31 uint32_t fb_ctxdma_handle;
32 uint32_t tt_ctxdma_handle;
33
34 int channel;
a1606a95 35 uint32_t pushbuf_domains;
6ee73861
BS
36
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
74#define NOUVEAU_GETPARAM_FB_PHYSICAL 6
75#define NOUVEAU_GETPARAM_AGP_PHYSICAL 7
76#define NOUVEAU_GETPARAM_FB_SIZE 8
77#define NOUVEAU_GETPARAM_AGP_SIZE 9
78#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10
79#define NOUVEAU_GETPARAM_CHIPSET_ID 11
80#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
69c9700b 81#define NOUVEAU_GETPARAM_GRAPH_UNITS 13
6ee73861
BS
82struct 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
97struct drm_nouveau_gem_info {
98 uint32_t handle;
99 uint32_t domain;
100 uint64_t size;
101 uint64_t offset;
102 uint64_t map_handle;
103 uint32_t tile_mode;
104 uint32_t tile_flags;
105};
106
107struct drm_nouveau_gem_new {
108 struct drm_nouveau_gem_info info;
109 uint32_t channel_hint;
110 uint32_t align;
111};
112
a1606a95
BS
113#define NOUVEAU_GEM_MAX_BUFFERS 1024
114struct drm_nouveau_gem_pushbuf_bo_presumed {
115 uint32_t valid;
116 uint32_t domain;
117 uint64_t offset;
118};
119
6ee73861
BS
120struct drm_nouveau_gem_pushbuf_bo {
121 uint64_t user_priv;
122 uint32_t handle;
123 uint32_t read_domains;
124 uint32_t write_domains;
125 uint32_t valid_domains;
a1606a95 126 struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
6ee73861
BS
127};
128
129#define NOUVEAU_GEM_RELOC_LOW (1 << 0)
130#define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
131#define NOUVEAU_GEM_RELOC_OR (1 << 2)
a1606a95 132#define NOUVEAU_GEM_MAX_RELOCS 1024
6ee73861 133struct drm_nouveau_gem_pushbuf_reloc {
a1606a95
BS
134 uint32_t reloc_bo_index;
135 uint32_t reloc_bo_offset;
6ee73861 136 uint32_t bo_index;
6ee73861
BS
137 uint32_t flags;
138 uint32_t data;
139 uint32_t vor;
140 uint32_t tor;
141};
142
a1606a95
BS
143#define NOUVEAU_GEM_MAX_PUSH 512
144struct drm_nouveau_gem_pushbuf_push {
145 uint32_t bo_index;
146 uint32_t pad;
147 uint64_t offset;
148 uint64_t length;
149};
6ee73861
BS
150
151struct drm_nouveau_gem_pushbuf {
152 uint32_t channel;
6ee73861 153 uint32_t nr_buffers;
6ee73861 154 uint64_t buffers;
6ee73861 155 uint32_t nr_relocs;
a1606a95 156 uint32_t nr_push;
6ee73861 157 uint64_t relocs;
a1606a95 158 uint64_t push;
6ee73861
BS
159 uint32_t suffix0;
160 uint32_t suffix1;
6ee73861
BS
161 uint64_t vram_available;
162 uint64_t gart_available;
163};
164
6ee73861
BS
165#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
166#define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002
167#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
168struct drm_nouveau_gem_cpu_prep {
169 uint32_t handle;
170 uint32_t flags;
171};
172
173struct drm_nouveau_gem_cpu_fini {
174 uint32_t handle;
175};
176
6ee73861
BS
177enum nouveau_bus_type {
178 NV_AGP = 0,
179 NV_PCI = 1,
180 NV_PCIE = 2,
181};
182
183struct drm_nouveau_sarea {
184};
185
a1606a95
BS
186#define DRM_NOUVEAU_GETPARAM 0x00
187#define DRM_NOUVEAU_SETPARAM 0x01
188#define DRM_NOUVEAU_CHANNEL_ALLOC 0x02
189#define DRM_NOUVEAU_CHANNEL_FREE 0x03
190#define DRM_NOUVEAU_GROBJ_ALLOC 0x04
191#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05
192#define DRM_NOUVEAU_GPUOBJ_FREE 0x06
6ee73861
BS
193#define DRM_NOUVEAU_GEM_NEW 0x40
194#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
a1606a95
BS
195#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
196#define DRM_NOUVEAU_GEM_CPU_FINI 0x43
197#define DRM_NOUVEAU_GEM_INFO 0x44
6ee73861
BS
198
199#endif /* __NOUVEAU_DRM_H__ */