Commit 1d7f83d5ad6c30b385ba549c1c3a287cc872b7ae

Authored by Arnd Bergmann
Committed by Ingo Molnar
1 parent ccef7ab534

make drm headers use strict integer types

The drm headers are traditionally shared with BSD and
could not use the strict linux integer types. This is
over now, so we can use our own types now.

Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 6 changed files with 190 additions and 188 deletions Inline Diff

1 /** 1 /**
2 * \file drm.h 2 * \file drm.h
3 * Header for the Direct Rendering Manager 3 * Header for the Direct Rendering Manager
4 * 4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com> 5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * 6 *
7 * \par Acknowledgments: 7 * \par Acknowledgments:
8 * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg. 8 * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg.
9 */ 9 */
10 10
11 /* 11 /*
12 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 12 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
13 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 13 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
14 * All rights reserved. 14 * All rights reserved.
15 * 15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a 16 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"), 17 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation 18 * to deal in the Software without restriction, including without limitation
19 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 * and/or sell copies of the Software, and to permit persons to whom the 20 * and/or sell copies of the Software, and to permit persons to whom the
21 * Software is furnished to do so, subject to the following conditions: 21 * Software is furnished to do so, subject to the following conditions:
22 * 22 *
23 * The above copyright notice and this permission notice (including the next 23 * The above copyright notice and this permission notice (including the next
24 * paragraph) shall be included in all copies or substantial portions of the 24 * paragraph) shall be included in all copies or substantial portions of the
25 * Software. 25 * Software.
26 * 26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 29 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 30 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
31 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 31 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 32 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33 * OTHER DEALINGS IN THE SOFTWARE. 33 * OTHER DEALINGS IN THE SOFTWARE.
34 */ 34 */
35 35
36 #ifndef _DRM_H_ 36 #ifndef _DRM_H_
37 #define _DRM_H_ 37 #define _DRM_H_
38 38
39 #if defined(__KERNEL__) 39 #include <linux/types.h>
40 #endif
41 #include <asm/ioctl.h> /* For _IO* macros */ 40 #include <asm/ioctl.h> /* For _IO* macros */
42 #define DRM_IOCTL_NR(n) _IOC_NR(n) 41 #define DRM_IOCTL_NR(n) _IOC_NR(n)
43 #define DRM_IOC_VOID _IOC_NONE 42 #define DRM_IOC_VOID _IOC_NONE
44 #define DRM_IOC_READ _IOC_READ 43 #define DRM_IOC_READ _IOC_READ
45 #define DRM_IOC_WRITE _IOC_WRITE 44 #define DRM_IOC_WRITE _IOC_WRITE
46 #define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE 45 #define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
47 #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) 46 #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
48 47
49 #define DRM_MAJOR 226 48 #define DRM_MAJOR 226
50 #define DRM_MAX_MINOR 15 49 #define DRM_MAX_MINOR 15
51 50
52 #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ 51 #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
53 #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ 52 #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
54 #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ 53 #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
55 #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ 54 #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */
56 55
57 #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ 56 #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */
58 #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ 57 #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */
59 #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) 58 #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD)
60 #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) 59 #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)
61 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) 60 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
62 61
63 typedef unsigned int drm_handle_t; 62 typedef unsigned int drm_handle_t;
64 typedef unsigned int drm_context_t; 63 typedef unsigned int drm_context_t;
65 typedef unsigned int drm_drawable_t; 64 typedef unsigned int drm_drawable_t;
66 typedef unsigned int drm_magic_t; 65 typedef unsigned int drm_magic_t;
67 66
68 /** 67 /**
69 * Cliprect. 68 * Cliprect.
70 * 69 *
71 * \warning: If you change this structure, make sure you change 70 * \warning: If you change this structure, make sure you change
72 * XF86DRIClipRectRec in the server as well 71 * XF86DRIClipRectRec in the server as well
73 * 72 *
74 * \note KW: Actually it's illegal to change either for 73 * \note KW: Actually it's illegal to change either for
75 * backwards-compatibility reasons. 74 * backwards-compatibility reasons.
76 */ 75 */
77 struct drm_clip_rect { 76 struct drm_clip_rect {
78 unsigned short x1; 77 unsigned short x1;
79 unsigned short y1; 78 unsigned short y1;
80 unsigned short x2; 79 unsigned short x2;
81 unsigned short y2; 80 unsigned short y2;
82 }; 81 };
83 82
84 /** 83 /**
85 * Drawable information. 84 * Drawable information.
86 */ 85 */
87 struct drm_drawable_info { 86 struct drm_drawable_info {
88 unsigned int num_rects; 87 unsigned int num_rects;
89 struct drm_clip_rect *rects; 88 struct drm_clip_rect *rects;
90 }; 89 };
91 90
92 /** 91 /**
93 * Texture region, 92 * Texture region,
94 */ 93 */
95 struct drm_tex_region { 94 struct drm_tex_region {
96 unsigned char next; 95 unsigned char next;
97 unsigned char prev; 96 unsigned char prev;
98 unsigned char in_use; 97 unsigned char in_use;
99 unsigned char padding; 98 unsigned char padding;
100 unsigned int age; 99 unsigned int age;
101 }; 100 };
102 101
103 /** 102 /**
104 * Hardware lock. 103 * Hardware lock.
105 * 104 *
106 * The lock structure is a simple cache-line aligned integer. To avoid 105 * The lock structure is a simple cache-line aligned integer. To avoid
107 * processor bus contention on a multiprocessor system, there should not be any 106 * processor bus contention on a multiprocessor system, there should not be any
108 * other data stored in the same cache line. 107 * other data stored in the same cache line.
109 */ 108 */
110 struct drm_hw_lock { 109 struct drm_hw_lock {
111 __volatile__ unsigned int lock; /**< lock variable */ 110 __volatile__ unsigned int lock; /**< lock variable */
112 char padding[60]; /**< Pad to cache line */ 111 char padding[60]; /**< Pad to cache line */
113 }; 112 };
114 113
115 /** 114 /**
116 * DRM_IOCTL_VERSION ioctl argument type. 115 * DRM_IOCTL_VERSION ioctl argument type.
117 * 116 *
118 * \sa drmGetVersion(). 117 * \sa drmGetVersion().
119 */ 118 */
120 struct drm_version { 119 struct drm_version {
121 int version_major; /**< Major version */ 120 int version_major; /**< Major version */
122 int version_minor; /**< Minor version */ 121 int version_minor; /**< Minor version */
123 int version_patchlevel; /**< Patch level */ 122 int version_patchlevel; /**< Patch level */
124 size_t name_len; /**< Length of name buffer */ 123 size_t name_len; /**< Length of name buffer */
125 char __user *name; /**< Name of driver */ 124 char __user *name; /**< Name of driver */
126 size_t date_len; /**< Length of date buffer */ 125 size_t date_len; /**< Length of date buffer */
127 char __user *date; /**< User-space buffer to hold date */ 126 char __user *date; /**< User-space buffer to hold date */
128 size_t desc_len; /**< Length of desc buffer */ 127 size_t desc_len; /**< Length of desc buffer */
129 char __user *desc; /**< User-space buffer to hold desc */ 128 char __user *desc; /**< User-space buffer to hold desc */
130 }; 129 };
131 130
132 /** 131 /**
133 * DRM_IOCTL_GET_UNIQUE ioctl argument type. 132 * DRM_IOCTL_GET_UNIQUE ioctl argument type.
134 * 133 *
135 * \sa drmGetBusid() and drmSetBusId(). 134 * \sa drmGetBusid() and drmSetBusId().
136 */ 135 */
137 struct drm_unique { 136 struct drm_unique {
138 size_t unique_len; /**< Length of unique */ 137 size_t unique_len; /**< Length of unique */
139 char __user *unique; /**< Unique name for driver instantiation */ 138 char __user *unique; /**< Unique name for driver instantiation */
140 }; 139 };
141 140
142 struct drm_list { 141 struct drm_list {
143 int count; /**< Length of user-space structures */ 142 int count; /**< Length of user-space structures */
144 struct drm_version __user *version; 143 struct drm_version __user *version;
145 }; 144 };
146 145
147 struct drm_block { 146 struct drm_block {
148 int unused; 147 int unused;
149 }; 148 };
150 149
151 /** 150 /**
152 * DRM_IOCTL_CONTROL ioctl argument type. 151 * DRM_IOCTL_CONTROL ioctl argument type.
153 * 152 *
154 * \sa drmCtlInstHandler() and drmCtlUninstHandler(). 153 * \sa drmCtlInstHandler() and drmCtlUninstHandler().
155 */ 154 */
156 struct drm_control { 155 struct drm_control {
157 enum { 156 enum {
158 DRM_ADD_COMMAND, 157 DRM_ADD_COMMAND,
159 DRM_RM_COMMAND, 158 DRM_RM_COMMAND,
160 DRM_INST_HANDLER, 159 DRM_INST_HANDLER,
161 DRM_UNINST_HANDLER 160 DRM_UNINST_HANDLER
162 } func; 161 } func;
163 int irq; 162 int irq;
164 }; 163 };
165 164
166 /** 165 /**
167 * Type of memory to map. 166 * Type of memory to map.
168 */ 167 */
169 enum drm_map_type { 168 enum drm_map_type {
170 _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ 169 _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */
171 _DRM_REGISTERS = 1, /**< no caching, no core dump */ 170 _DRM_REGISTERS = 1, /**< no caching, no core dump */
172 _DRM_SHM = 2, /**< shared, cached */ 171 _DRM_SHM = 2, /**< shared, cached */
173 _DRM_AGP = 3, /**< AGP/GART */ 172 _DRM_AGP = 3, /**< AGP/GART */
174 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 173 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */
175 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ 174 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */
176 _DRM_GEM = 6, /**< GEM object */ 175 _DRM_GEM = 6, /**< GEM object */
177 }; 176 };
178 177
179 /** 178 /**
180 * Memory mapping flags. 179 * Memory mapping flags.
181 */ 180 */
182 enum drm_map_flags { 181 enum drm_map_flags {
183 _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ 182 _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */
184 _DRM_READ_ONLY = 0x02, 183 _DRM_READ_ONLY = 0x02,
185 _DRM_LOCKED = 0x04, /**< shared, cached, locked */ 184 _DRM_LOCKED = 0x04, /**< shared, cached, locked */
186 _DRM_KERNEL = 0x08, /**< kernel requires access */ 185 _DRM_KERNEL = 0x08, /**< kernel requires access */
187 _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ 186 _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
188 _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ 187 _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */
189 _DRM_REMOVABLE = 0x40, /**< Removable mapping */ 188 _DRM_REMOVABLE = 0x40, /**< Removable mapping */
190 _DRM_DRIVER = 0x80 /**< Managed by driver */ 189 _DRM_DRIVER = 0x80 /**< Managed by driver */
191 }; 190 };
192 191
193 struct drm_ctx_priv_map { 192 struct drm_ctx_priv_map {
194 unsigned int ctx_id; /**< Context requesting private mapping */ 193 unsigned int ctx_id; /**< Context requesting private mapping */
195 void *handle; /**< Handle of map */ 194 void *handle; /**< Handle of map */
196 }; 195 };
197 196
198 /** 197 /**
199 * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls 198 * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
200 * argument type. 199 * argument type.
201 * 200 *
202 * \sa drmAddMap(). 201 * \sa drmAddMap().
203 */ 202 */
204 struct drm_map { 203 struct drm_map {
205 unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 204 unsigned long offset; /**< Requested physical address (0 for SAREA)*/
206 unsigned long size; /**< Requested physical size (bytes) */ 205 unsigned long size; /**< Requested physical size (bytes) */
207 enum drm_map_type type; /**< Type of memory to map */ 206 enum drm_map_type type; /**< Type of memory to map */
208 enum drm_map_flags flags; /**< Flags */ 207 enum drm_map_flags flags; /**< Flags */
209 void *handle; /**< User-space: "Handle" to pass to mmap() */ 208 void *handle; /**< User-space: "Handle" to pass to mmap() */
210 /**< Kernel-space: kernel-virtual address */ 209 /**< Kernel-space: kernel-virtual address */
211 int mtrr; /**< MTRR slot used */ 210 int mtrr; /**< MTRR slot used */
212 /* Private data */ 211 /* Private data */
213 }; 212 };
214 213
215 /** 214 /**
216 * DRM_IOCTL_GET_CLIENT ioctl argument type. 215 * DRM_IOCTL_GET_CLIENT ioctl argument type.
217 */ 216 */
218 struct drm_client { 217 struct drm_client {
219 int idx; /**< Which client desired? */ 218 int idx; /**< Which client desired? */
220 int auth; /**< Is client authenticated? */ 219 int auth; /**< Is client authenticated? */
221 unsigned long pid; /**< Process ID */ 220 unsigned long pid; /**< Process ID */
222 unsigned long uid; /**< User ID */ 221 unsigned long uid; /**< User ID */
223 unsigned long magic; /**< Magic */ 222 unsigned long magic; /**< Magic */
224 unsigned long iocs; /**< Ioctl count */ 223 unsigned long iocs; /**< Ioctl count */
225 }; 224 };
226 225
227 enum drm_stat_type { 226 enum drm_stat_type {
228 _DRM_STAT_LOCK, 227 _DRM_STAT_LOCK,
229 _DRM_STAT_OPENS, 228 _DRM_STAT_OPENS,
230 _DRM_STAT_CLOSES, 229 _DRM_STAT_CLOSES,
231 _DRM_STAT_IOCTLS, 230 _DRM_STAT_IOCTLS,
232 _DRM_STAT_LOCKS, 231 _DRM_STAT_LOCKS,
233 _DRM_STAT_UNLOCKS, 232 _DRM_STAT_UNLOCKS,
234 _DRM_STAT_VALUE, /**< Generic value */ 233 _DRM_STAT_VALUE, /**< Generic value */
235 _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ 234 _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */
236 _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ 235 _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */
237 236
238 _DRM_STAT_IRQ, /**< IRQ */ 237 _DRM_STAT_IRQ, /**< IRQ */
239 _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ 238 _DRM_STAT_PRIMARY, /**< Primary DMA bytes */
240 _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ 239 _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */
241 _DRM_STAT_DMA, /**< DMA */ 240 _DRM_STAT_DMA, /**< DMA */
242 _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ 241 _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */
243 _DRM_STAT_MISSED /**< Missed DMA opportunity */ 242 _DRM_STAT_MISSED /**< Missed DMA opportunity */
244 /* Add to the *END* of the list */ 243 /* Add to the *END* of the list */
245 }; 244 };
246 245
247 /** 246 /**
248 * DRM_IOCTL_GET_STATS ioctl argument type. 247 * DRM_IOCTL_GET_STATS ioctl argument type.
249 */ 248 */
250 struct drm_stats { 249 struct drm_stats {
251 unsigned long count; 250 unsigned long count;
252 struct { 251 struct {
253 unsigned long value; 252 unsigned long value;
254 enum drm_stat_type type; 253 enum drm_stat_type type;
255 } data[15]; 254 } data[15];
256 }; 255 };
257 256
258 /** 257 /**
259 * Hardware locking flags. 258 * Hardware locking flags.
260 */ 259 */
261 enum drm_lock_flags { 260 enum drm_lock_flags {
262 _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 261 _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */
263 _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 262 _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */
264 _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 263 _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */
265 _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ 264 _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */
266 /* These *HALT* flags aren't supported yet 265 /* These *HALT* flags aren't supported yet
267 -- they will be used to support the 266 -- they will be used to support the
268 full-screen DGA-like mode. */ 267 full-screen DGA-like mode. */
269 _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 268 _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
270 _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 269 _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */
271 }; 270 };
272 271
273 /** 272 /**
274 * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. 273 * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
275 * 274 *
276 * \sa drmGetLock() and drmUnlock(). 275 * \sa drmGetLock() and drmUnlock().
277 */ 276 */
278 struct drm_lock { 277 struct drm_lock {
279 int context; 278 int context;
280 enum drm_lock_flags flags; 279 enum drm_lock_flags flags;
281 }; 280 };
282 281
283 /** 282 /**
284 * DMA flags 283 * DMA flags
285 * 284 *
286 * \warning 285 * \warning
287 * These values \e must match xf86drm.h. 286 * These values \e must match xf86drm.h.
288 * 287 *
289 * \sa drm_dma. 288 * \sa drm_dma.
290 */ 289 */
291 enum drm_dma_flags { 290 enum drm_dma_flags {
292 /* Flags for DMA buffer dispatch */ 291 /* Flags for DMA buffer dispatch */
293 _DRM_DMA_BLOCK = 0x01, /**< 292 _DRM_DMA_BLOCK = 0x01, /**<
294 * Block until buffer dispatched. 293 * Block until buffer dispatched.
295 * 294 *
296 * \note The buffer may not yet have 295 * \note The buffer may not yet have
297 * been processed by the hardware -- 296 * been processed by the hardware --
298 * getting a hardware lock with the 297 * getting a hardware lock with the
299 * hardware quiescent will ensure 298 * hardware quiescent will ensure
300 * that the buffer has been 299 * that the buffer has been
301 * processed. 300 * processed.
302 */ 301 */
303 _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ 302 _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
304 _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ 303 _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */
305 304
306 /* Flags for DMA buffer request */ 305 /* Flags for DMA buffer request */
307 _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 306 _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */
308 _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 307 _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */
309 _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 308 _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */
310 }; 309 };
311 310
312 /** 311 /**
313 * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. 312 * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
314 * 313 *
315 * \sa drmAddBufs(). 314 * \sa drmAddBufs().
316 */ 315 */
317 struct drm_buf_desc { 316 struct drm_buf_desc {
318 int count; /**< Number of buffers of this size */ 317 int count; /**< Number of buffers of this size */
319 int size; /**< Size in bytes */ 318 int size; /**< Size in bytes */
320 int low_mark; /**< Low water mark */ 319 int low_mark; /**< Low water mark */
321 int high_mark; /**< High water mark */ 320 int high_mark; /**< High water mark */
322 enum { 321 enum {
323 _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ 322 _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
324 _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ 323 _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
325 _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ 324 _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */
326 _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ 325 _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */
327 _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ 326 _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
328 } flags; 327 } flags;
329 unsigned long agp_start; /**< 328 unsigned long agp_start; /**<
330 * Start address of where the AGP buffers are 329 * Start address of where the AGP buffers are
331 * in the AGP aperture 330 * in the AGP aperture
332 */ 331 */
333 }; 332 };
334 333
335 /** 334 /**
336 * DRM_IOCTL_INFO_BUFS ioctl argument type. 335 * DRM_IOCTL_INFO_BUFS ioctl argument type.
337 */ 336 */
338 struct drm_buf_info { 337 struct drm_buf_info {
339 int count; /**< Entries in list */ 338 int count; /**< Entries in list */
340 struct drm_buf_desc __user *list; 339 struct drm_buf_desc __user *list;
341 }; 340 };
342 341
343 /** 342 /**
344 * DRM_IOCTL_FREE_BUFS ioctl argument type. 343 * DRM_IOCTL_FREE_BUFS ioctl argument type.
345 */ 344 */
346 struct drm_buf_free { 345 struct drm_buf_free {
347 int count; 346 int count;
348 int __user *list; 347 int __user *list;
349 }; 348 };
350 349
351 /** 350 /**
352 * Buffer information 351 * Buffer information
353 * 352 *
354 * \sa drm_buf_map. 353 * \sa drm_buf_map.
355 */ 354 */
356 struct drm_buf_pub { 355 struct drm_buf_pub {
357 int idx; /**< Index into the master buffer list */ 356 int idx; /**< Index into the master buffer list */
358 int total; /**< Buffer size */ 357 int total; /**< Buffer size */
359 int used; /**< Amount of buffer in use (for DMA) */ 358 int used; /**< Amount of buffer in use (for DMA) */
360 void __user *address; /**< Address of buffer */ 359 void __user *address; /**< Address of buffer */
361 }; 360 };
362 361
363 /** 362 /**
364 * DRM_IOCTL_MAP_BUFS ioctl argument type. 363 * DRM_IOCTL_MAP_BUFS ioctl argument type.
365 */ 364 */
366 struct drm_buf_map { 365 struct drm_buf_map {
367 int count; /**< Length of the buffer list */ 366 int count; /**< Length of the buffer list */
368 void __user *virtual; /**< Mmap'd area in user-virtual */ 367 void __user *virtual; /**< Mmap'd area in user-virtual */
369 struct drm_buf_pub __user *list; /**< Buffer information */ 368 struct drm_buf_pub __user *list; /**< Buffer information */
370 }; 369 };
371 370
372 /** 371 /**
373 * DRM_IOCTL_DMA ioctl argument type. 372 * DRM_IOCTL_DMA ioctl argument type.
374 * 373 *
375 * Indices here refer to the offset into the buffer list in drm_buf_get. 374 * Indices here refer to the offset into the buffer list in drm_buf_get.
376 * 375 *
377 * \sa drmDMA(). 376 * \sa drmDMA().
378 */ 377 */
379 struct drm_dma { 378 struct drm_dma {
380 int context; /**< Context handle */ 379 int context; /**< Context handle */
381 int send_count; /**< Number of buffers to send */ 380 int send_count; /**< Number of buffers to send */
382 int __user *send_indices; /**< List of handles to buffers */ 381 int __user *send_indices; /**< List of handles to buffers */
383 int __user *send_sizes; /**< Lengths of data to send */ 382 int __user *send_sizes; /**< Lengths of data to send */
384 enum drm_dma_flags flags; /**< Flags */ 383 enum drm_dma_flags flags; /**< Flags */
385 int request_count; /**< Number of buffers requested */ 384 int request_count; /**< Number of buffers requested */
386 int request_size; /**< Desired size for buffers */ 385 int request_size; /**< Desired size for buffers */
387 int __user *request_indices; /**< Buffer information */ 386 int __user *request_indices; /**< Buffer information */
388 int __user *request_sizes; 387 int __user *request_sizes;
389 int granted_count; /**< Number of buffers granted */ 388 int granted_count; /**< Number of buffers granted */
390 }; 389 };
391 390
392 enum drm_ctx_flags { 391 enum drm_ctx_flags {
393 _DRM_CONTEXT_PRESERVED = 0x01, 392 _DRM_CONTEXT_PRESERVED = 0x01,
394 _DRM_CONTEXT_2DONLY = 0x02 393 _DRM_CONTEXT_2DONLY = 0x02
395 }; 394 };
396 395
397 /** 396 /**
398 * DRM_IOCTL_ADD_CTX ioctl argument type. 397 * DRM_IOCTL_ADD_CTX ioctl argument type.
399 * 398 *
400 * \sa drmCreateContext() and drmDestroyContext(). 399 * \sa drmCreateContext() and drmDestroyContext().
401 */ 400 */
402 struct drm_ctx { 401 struct drm_ctx {
403 drm_context_t handle; 402 drm_context_t handle;
404 enum drm_ctx_flags flags; 403 enum drm_ctx_flags flags;
405 }; 404 };
406 405
407 /** 406 /**
408 * DRM_IOCTL_RES_CTX ioctl argument type. 407 * DRM_IOCTL_RES_CTX ioctl argument type.
409 */ 408 */
410 struct drm_ctx_res { 409 struct drm_ctx_res {
411 int count; 410 int count;
412 struct drm_ctx __user *contexts; 411 struct drm_ctx __user *contexts;
413 }; 412 };
414 413
415 /** 414 /**
416 * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. 415 * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
417 */ 416 */
418 struct drm_draw { 417 struct drm_draw {
419 drm_drawable_t handle; 418 drm_drawable_t handle;
420 }; 419 };
421 420
422 /** 421 /**
423 * DRM_IOCTL_UPDATE_DRAW ioctl argument type. 422 * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
424 */ 423 */
425 typedef enum { 424 typedef enum {
426 DRM_DRAWABLE_CLIPRECTS, 425 DRM_DRAWABLE_CLIPRECTS,
427 } drm_drawable_info_type_t; 426 } drm_drawable_info_type_t;
428 427
429 struct drm_update_draw { 428 struct drm_update_draw {
430 drm_drawable_t handle; 429 drm_drawable_t handle;
431 unsigned int type; 430 unsigned int type;
432 unsigned int num; 431 unsigned int num;
433 unsigned long long data; 432 unsigned long long data;
434 }; 433 };
435 434
436 /** 435 /**
437 * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. 436 * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
438 */ 437 */
439 struct drm_auth { 438 struct drm_auth {
440 drm_magic_t magic; 439 drm_magic_t magic;
441 }; 440 };
442 441
443 /** 442 /**
444 * DRM_IOCTL_IRQ_BUSID ioctl argument type. 443 * DRM_IOCTL_IRQ_BUSID ioctl argument type.
445 * 444 *
446 * \sa drmGetInterruptFromBusID(). 445 * \sa drmGetInterruptFromBusID().
447 */ 446 */
448 struct drm_irq_busid { 447 struct drm_irq_busid {
449 int irq; /**< IRQ number */ 448 int irq; /**< IRQ number */
450 int busnum; /**< bus number */ 449 int busnum; /**< bus number */
451 int devnum; /**< device number */ 450 int devnum; /**< device number */
452 int funcnum; /**< function number */ 451 int funcnum; /**< function number */
453 }; 452 };
454 453
455 enum drm_vblank_seq_type { 454 enum drm_vblank_seq_type {
456 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 455 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
457 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 456 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
458 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 457 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
459 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 458 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
460 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 459 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
461 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 460 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */
462 }; 461 };
463 462
464 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 463 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
465 #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ 464 #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \
466 _DRM_VBLANK_NEXTONMISS) 465 _DRM_VBLANK_NEXTONMISS)
467 466
468 struct drm_wait_vblank_request { 467 struct drm_wait_vblank_request {
469 enum drm_vblank_seq_type type; 468 enum drm_vblank_seq_type type;
470 unsigned int sequence; 469 unsigned int sequence;
471 unsigned long signal; 470 unsigned long signal;
472 }; 471 };
473 472
474 struct drm_wait_vblank_reply { 473 struct drm_wait_vblank_reply {
475 enum drm_vblank_seq_type type; 474 enum drm_vblank_seq_type type;
476 unsigned int sequence; 475 unsigned int sequence;
477 long tval_sec; 476 long tval_sec;
478 long tval_usec; 477 long tval_usec;
479 }; 478 };
480 479
481 /** 480 /**
482 * DRM_IOCTL_WAIT_VBLANK ioctl argument type. 481 * DRM_IOCTL_WAIT_VBLANK ioctl argument type.
483 * 482 *
484 * \sa drmWaitVBlank(). 483 * \sa drmWaitVBlank().
485 */ 484 */
486 union drm_wait_vblank { 485 union drm_wait_vblank {
487 struct drm_wait_vblank_request request; 486 struct drm_wait_vblank_request request;
488 struct drm_wait_vblank_reply reply; 487 struct drm_wait_vblank_reply reply;
489 }; 488 };
490 489
491 #define _DRM_PRE_MODESET 1 490 #define _DRM_PRE_MODESET 1
492 #define _DRM_POST_MODESET 2 491 #define _DRM_POST_MODESET 2
493 492
494 /** 493 /**
495 * DRM_IOCTL_MODESET_CTL ioctl argument type 494 * DRM_IOCTL_MODESET_CTL ioctl argument type
496 * 495 *
497 * \sa drmModesetCtl(). 496 * \sa drmModesetCtl().
498 */ 497 */
499 struct drm_modeset_ctl { 498 struct drm_modeset_ctl {
500 uint32_t crtc; 499 __u32 crtc;
501 uint32_t cmd; 500 __u32 cmd;
502 }; 501 };
503 502
504 /** 503 /**
505 * DRM_IOCTL_AGP_ENABLE ioctl argument type. 504 * DRM_IOCTL_AGP_ENABLE ioctl argument type.
506 * 505 *
507 * \sa drmAgpEnable(). 506 * \sa drmAgpEnable().
508 */ 507 */
509 struct drm_agp_mode { 508 struct drm_agp_mode {
510 unsigned long mode; /**< AGP mode */ 509 unsigned long mode; /**< AGP mode */
511 }; 510 };
512 511
513 /** 512 /**
514 * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. 513 * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
515 * 514 *
516 * \sa drmAgpAlloc() and drmAgpFree(). 515 * \sa drmAgpAlloc() and drmAgpFree().
517 */ 516 */
518 struct drm_agp_buffer { 517 struct drm_agp_buffer {
519 unsigned long size; /**< In bytes -- will round to page boundary */ 518 unsigned long size; /**< In bytes -- will round to page boundary */
520 unsigned long handle; /**< Used for binding / unbinding */ 519 unsigned long handle; /**< Used for binding / unbinding */
521 unsigned long type; /**< Type of memory to allocate */ 520 unsigned long type; /**< Type of memory to allocate */
522 unsigned long physical; /**< Physical used by i810 */ 521 unsigned long physical; /**< Physical used by i810 */
523 }; 522 };
524 523
525 /** 524 /**
526 * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. 525 * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
527 * 526 *
528 * \sa drmAgpBind() and drmAgpUnbind(). 527 * \sa drmAgpBind() and drmAgpUnbind().
529 */ 528 */
530 struct drm_agp_binding { 529 struct drm_agp_binding {
531 unsigned long handle; /**< From drm_agp_buffer */ 530 unsigned long handle; /**< From drm_agp_buffer */
532 unsigned long offset; /**< In bytes -- will round to page boundary */ 531 unsigned long offset; /**< In bytes -- will round to page boundary */
533 }; 532 };
534 533
535 /** 534 /**
536 * DRM_IOCTL_AGP_INFO ioctl argument type. 535 * DRM_IOCTL_AGP_INFO ioctl argument type.
537 * 536 *
538 * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), 537 * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),
539 * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), 538 * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
540 * drmAgpVendorId() and drmAgpDeviceId(). 539 * drmAgpVendorId() and drmAgpDeviceId().
541 */ 540 */
542 struct drm_agp_info { 541 struct drm_agp_info {
543 int agp_version_major; 542 int agp_version_major;
544 int agp_version_minor; 543 int agp_version_minor;
545 unsigned long mode; 544 unsigned long mode;
546 unsigned long aperture_base; /* physical address */ 545 unsigned long aperture_base; /* physical address */
547 unsigned long aperture_size; /* bytes */ 546 unsigned long aperture_size; /* bytes */
548 unsigned long memory_allowed; /* bytes */ 547 unsigned long memory_allowed; /* bytes */
549 unsigned long memory_used; 548 unsigned long memory_used;
550 549
551 /* PCI information */ 550 /* PCI information */
552 unsigned short id_vendor; 551 unsigned short id_vendor;
553 unsigned short id_device; 552 unsigned short id_device;
554 }; 553 };
555 554
556 /** 555 /**
557 * DRM_IOCTL_SG_ALLOC ioctl argument type. 556 * DRM_IOCTL_SG_ALLOC ioctl argument type.
558 */ 557 */
559 struct drm_scatter_gather { 558 struct drm_scatter_gather {
560 unsigned long size; /**< In bytes -- will round to page boundary */ 559 unsigned long size; /**< In bytes -- will round to page boundary */
561 unsigned long handle; /**< Used for mapping / unmapping */ 560 unsigned long handle; /**< Used for mapping / unmapping */
562 }; 561 };
563 562
564 /** 563 /**
565 * DRM_IOCTL_SET_VERSION ioctl argument type. 564 * DRM_IOCTL_SET_VERSION ioctl argument type.
566 */ 565 */
567 struct drm_set_version { 566 struct drm_set_version {
568 int drm_di_major; 567 int drm_di_major;
569 int drm_di_minor; 568 int drm_di_minor;
570 int drm_dd_major; 569 int drm_dd_major;
571 int drm_dd_minor; 570 int drm_dd_minor;
572 }; 571 };
573 572
574 /** DRM_IOCTL_GEM_CLOSE ioctl argument type */ 573 /** DRM_IOCTL_GEM_CLOSE ioctl argument type */
575 struct drm_gem_close { 574 struct drm_gem_close {
576 /** Handle of the object to be closed. */ 575 /** Handle of the object to be closed. */
577 uint32_t handle; 576 __u32 handle;
578 uint32_t pad; 577 __u32 pad;
579 }; 578 };
580 579
581 /** DRM_IOCTL_GEM_FLINK ioctl argument type */ 580 /** DRM_IOCTL_GEM_FLINK ioctl argument type */
582 struct drm_gem_flink { 581 struct drm_gem_flink {
583 /** Handle for the object being named */ 582 /** Handle for the object being named */
584 uint32_t handle; 583 __u32 handle;
585 584
586 /** Returned global name */ 585 /** Returned global name */
587 uint32_t name; 586 __u32 name;
588 }; 587 };
589 588
590 /** DRM_IOCTL_GEM_OPEN ioctl argument type */ 589 /** DRM_IOCTL_GEM_OPEN ioctl argument type */
591 struct drm_gem_open { 590 struct drm_gem_open {
592 /** Name of object being opened */ 591 /** Name of object being opened */
593 uint32_t name; 592 __u32 name;
594 593
595 /** Returned handle for the object */ 594 /** Returned handle for the object */
596 uint32_t handle; 595 __u32 handle;
597 596
598 /** Returned size of the object */ 597 /** Returned size of the object */
599 uint64_t size; 598 __u64 size;
600 }; 599 };
601 600
602 #include "drm_mode.h" 601 #include "drm_mode.h"
603 602
604 #define DRM_IOCTL_BASE 'd' 603 #define DRM_IOCTL_BASE 'd'
605 #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 604 #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
606 #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 605 #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
607 #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) 606 #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)
608 #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) 607 #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)
609 608
610 #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) 609 #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version)
611 #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) 610 #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique)
612 #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) 611 #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth)
613 #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) 612 #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid)
614 #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) 613 #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map)
615 #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 614 #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)
616 #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 615 #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)
617 #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 616 #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)
618 #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) 617 #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)
619 #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 618 #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)
620 #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 619 #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
621 #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 620 #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
622 621
623 #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 622 #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
624 #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 623 #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
625 #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) 624 #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block)
626 #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) 625 #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block)
627 #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) 626 #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control)
628 #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) 627 #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map)
629 #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) 628 #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc)
630 #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) 629 #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc)
631 #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) 630 #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info)
632 #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) 631 #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map)
633 #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) 632 #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free)
634 633
635 #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) 634 #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map)
636 635
637 #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) 636 #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)
638 #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) 637 #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)
639 638
640 #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) 639 #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e)
641 #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) 640 #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f)
642 641
643 #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) 642 #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)
644 #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) 643 #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)
645 #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) 644 #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)
646 #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) 645 #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx)
647 #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) 646 #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx)
648 #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) 647 #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx)
649 #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) 648 #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res)
650 #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) 649 #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw)
651 #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) 650 #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw)
652 #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) 651 #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma)
653 #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) 652 #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock)
654 #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 653 #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
655 #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 654 #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
656 655
657 #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 656 #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
658 #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 657 #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
659 #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 658 #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)
660 #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) 659 #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info)
661 #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) 660 #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer)
662 #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) 661 #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer)
663 #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) 662 #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding)
664 #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) 663 #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding)
665 664
666 #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) 665 #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather)
667 #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) 666 #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather)
668 667
669 #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) 668 #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank)
670 669
671 #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) 670 #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw)
672 671
673 #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) 672 #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res)
674 #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) 673 #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc)
675 #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) 674 #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc)
676 #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) 675 #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor)
677 #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) 676 #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
678 #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) 677 #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
679 #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) 678 #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder)
680 #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) 679 #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector)
681 #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) 680 #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd)
682 #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) 681 #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd)
683 682
684 #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) 683 #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property)
685 #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) 684 #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
686 #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 685 #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob)
687 #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 686 #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
688 #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 687 #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
689 #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 688 #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
690 689
691 /** 690 /**
692 * Device specific ioctls should only be in their respective headers 691 * Device specific ioctls should only be in their respective headers
693 * The device specific ioctl range is from 0x40 to 0x99. 692 * The device specific ioctl range is from 0x40 to 0x99.
694 * Generic IOCTLS restart at 0xA0. 693 * Generic IOCTLS restart at 0xA0.
695 * 694 *
696 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 695 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
697 * drmCommandReadWrite(). 696 * drmCommandReadWrite().
698 */ 697 */
699 #define DRM_COMMAND_BASE 0x40 698 #define DRM_COMMAND_BASE 0x40
700 #define DRM_COMMAND_END 0xA0 699 #define DRM_COMMAND_END 0xA0
701 700
702 /* typedef area */ 701 /* typedef area */
703 #ifndef __KERNEL__ 702 #ifndef __KERNEL__
704 typedef struct drm_clip_rect drm_clip_rect_t; 703 typedef struct drm_clip_rect drm_clip_rect_t;
705 typedef struct drm_drawable_info drm_drawable_info_t; 704 typedef struct drm_drawable_info drm_drawable_info_t;
706 typedef struct drm_tex_region drm_tex_region_t; 705 typedef struct drm_tex_region drm_tex_region_t;
707 typedef struct drm_hw_lock drm_hw_lock_t; 706 typedef struct drm_hw_lock drm_hw_lock_t;
708 typedef struct drm_version drm_version_t; 707 typedef struct drm_version drm_version_t;
709 typedef struct drm_unique drm_unique_t; 708 typedef struct drm_unique drm_unique_t;
710 typedef struct drm_list drm_list_t; 709 typedef struct drm_list drm_list_t;
711 typedef struct drm_block drm_block_t; 710 typedef struct drm_block drm_block_t;
712 typedef struct drm_control drm_control_t; 711 typedef struct drm_control drm_control_t;
713 typedef enum drm_map_type drm_map_type_t; 712 typedef enum drm_map_type drm_map_type_t;
714 typedef enum drm_map_flags drm_map_flags_t; 713 typedef enum drm_map_flags drm_map_flags_t;
715 typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; 714 typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
716 typedef struct drm_map drm_map_t; 715 typedef struct drm_map drm_map_t;
717 typedef struct drm_client drm_client_t; 716 typedef struct drm_client drm_client_t;
718 typedef enum drm_stat_type drm_stat_type_t; 717 typedef enum drm_stat_type drm_stat_type_t;
719 typedef struct drm_stats drm_stats_t; 718 typedef struct drm_stats drm_stats_t;
720 typedef enum drm_lock_flags drm_lock_flags_t; 719 typedef enum drm_lock_flags drm_lock_flags_t;
721 typedef struct drm_lock drm_lock_t; 720 typedef struct drm_lock drm_lock_t;
722 typedef enum drm_dma_flags drm_dma_flags_t; 721 typedef enum drm_dma_flags drm_dma_flags_t;
723 typedef struct drm_buf_desc drm_buf_desc_t; 722 typedef struct drm_buf_desc drm_buf_desc_t;
724 typedef struct drm_buf_info drm_buf_info_t; 723 typedef struct drm_buf_info drm_buf_info_t;
725 typedef struct drm_buf_free drm_buf_free_t; 724 typedef struct drm_buf_free drm_buf_free_t;
726 typedef struct drm_buf_pub drm_buf_pub_t; 725 typedef struct drm_buf_pub drm_buf_pub_t;
727 typedef struct drm_buf_map drm_buf_map_t; 726 typedef struct drm_buf_map drm_buf_map_t;
728 typedef struct drm_dma drm_dma_t; 727 typedef struct drm_dma drm_dma_t;
729 typedef union drm_wait_vblank drm_wait_vblank_t; 728 typedef union drm_wait_vblank drm_wait_vblank_t;
730 typedef struct drm_agp_mode drm_agp_mode_t; 729 typedef struct drm_agp_mode drm_agp_mode_t;
731 typedef enum drm_ctx_flags drm_ctx_flags_t; 730 typedef enum drm_ctx_flags drm_ctx_flags_t;
732 typedef struct drm_ctx drm_ctx_t; 731 typedef struct drm_ctx drm_ctx_t;
733 typedef struct drm_ctx_res drm_ctx_res_t; 732 typedef struct drm_ctx_res drm_ctx_res_t;
734 typedef struct drm_draw drm_draw_t; 733 typedef struct drm_draw drm_draw_t;
735 typedef struct drm_update_draw drm_update_draw_t; 734 typedef struct drm_update_draw drm_update_draw_t;
736 typedef struct drm_auth drm_auth_t; 735 typedef struct drm_auth drm_auth_t;
737 typedef struct drm_irq_busid drm_irq_busid_t; 736 typedef struct drm_irq_busid drm_irq_busid_t;
738 typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; 737 typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
739 738
740 typedef struct drm_agp_buffer drm_agp_buffer_t; 739 typedef struct drm_agp_buffer drm_agp_buffer_t;
741 typedef struct drm_agp_binding drm_agp_binding_t; 740 typedef struct drm_agp_binding drm_agp_binding_t;
742 typedef struct drm_agp_info drm_agp_info_t; 741 typedef struct drm_agp_info drm_agp_info_t;
743 typedef struct drm_scatter_gather drm_scatter_gather_t; 742 typedef struct drm_scatter_gather drm_scatter_gather_t;
744 typedef struct drm_set_version drm_set_version_t; 743 typedef struct drm_set_version drm_set_version_t;
745 #endif 744 #endif
746 745
747 #endif 746 #endif
748 747
include/drm/drm_mode.h
1 /* 1 /*
2 * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> 2 * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
3 * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com> 3 * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com>
4 * Copyright (c) 2008 Red Hat Inc. 4 * Copyright (c) 2008 Red Hat Inc.
5 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA 5 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
6 * Copyright (c) 2007-2008 Intel Corporation 6 * Copyright (c) 2007-2008 Intel Corporation
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"), 9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation 10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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 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: 13 * Software is furnished to do so, subject to the following conditions:
14 * 14 *
15 * The above copyright notice and this permission notice shall be included in 15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software. 16 * all copies or substantial portions of the Software.
17 * 17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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, 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE. 24 * IN THE SOFTWARE.
25 */ 25 */
26 26
27 #ifndef _DRM_MODE_H 27 #ifndef _DRM_MODE_H
28 #define _DRM_MODE_H 28 #define _DRM_MODE_H
29 29
30 #if !defined(__KERNEL__) && !defined(_KERNEL)
31 #include <stdint.h>
32 #else
33 #include <linux/kernel.h> 30 #include <linux/kernel.h>
34 #endif 31 #include <linux/types.h>
35 32
36 #define DRM_DISPLAY_INFO_LEN 32 33 #define DRM_DISPLAY_INFO_LEN 32
37 #define DRM_CONNECTOR_NAME_LEN 32 34 #define DRM_CONNECTOR_NAME_LEN 32
38 #define DRM_DISPLAY_MODE_LEN 32 35 #define DRM_DISPLAY_MODE_LEN 32
39 #define DRM_PROP_NAME_LEN 32 36 #define DRM_PROP_NAME_LEN 32
40 37
41 #define DRM_MODE_TYPE_BUILTIN (1<<0) 38 #define DRM_MODE_TYPE_BUILTIN (1<<0)
42 #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) 39 #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
43 #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) 40 #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
44 #define DRM_MODE_TYPE_PREFERRED (1<<3) 41 #define DRM_MODE_TYPE_PREFERRED (1<<3)
45 #define DRM_MODE_TYPE_DEFAULT (1<<4) 42 #define DRM_MODE_TYPE_DEFAULT (1<<4)
46 #define DRM_MODE_TYPE_USERDEF (1<<5) 43 #define DRM_MODE_TYPE_USERDEF (1<<5)
47 #define DRM_MODE_TYPE_DRIVER (1<<6) 44 #define DRM_MODE_TYPE_DRIVER (1<<6)
48 45
49 /* Video mode flags */ 46 /* Video mode flags */
50 /* bit compatible with the xorg definitions. */ 47 /* bit compatible with the xorg definitions. */
51 #define DRM_MODE_FLAG_PHSYNC (1<<0) 48 #define DRM_MODE_FLAG_PHSYNC (1<<0)
52 #define DRM_MODE_FLAG_NHSYNC (1<<1) 49 #define DRM_MODE_FLAG_NHSYNC (1<<1)
53 #define DRM_MODE_FLAG_PVSYNC (1<<2) 50 #define DRM_MODE_FLAG_PVSYNC (1<<2)
54 #define DRM_MODE_FLAG_NVSYNC (1<<3) 51 #define DRM_MODE_FLAG_NVSYNC (1<<3)
55 #define DRM_MODE_FLAG_INTERLACE (1<<4) 52 #define DRM_MODE_FLAG_INTERLACE (1<<4)
56 #define DRM_MODE_FLAG_DBLSCAN (1<<5) 53 #define DRM_MODE_FLAG_DBLSCAN (1<<5)
57 #define DRM_MODE_FLAG_CSYNC (1<<6) 54 #define DRM_MODE_FLAG_CSYNC (1<<6)
58 #define DRM_MODE_FLAG_PCSYNC (1<<7) 55 #define DRM_MODE_FLAG_PCSYNC (1<<7)
59 #define DRM_MODE_FLAG_NCSYNC (1<<8) 56 #define DRM_MODE_FLAG_NCSYNC (1<<8)
60 #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ 57 #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
61 #define DRM_MODE_FLAG_BCAST (1<<10) 58 #define DRM_MODE_FLAG_BCAST (1<<10)
62 #define DRM_MODE_FLAG_PIXMUX (1<<11) 59 #define DRM_MODE_FLAG_PIXMUX (1<<11)
63 #define DRM_MODE_FLAG_DBLCLK (1<<12) 60 #define DRM_MODE_FLAG_DBLCLK (1<<12)
64 #define DRM_MODE_FLAG_CLKDIV2 (1<<13) 61 #define DRM_MODE_FLAG_CLKDIV2 (1<<13)
65 62
66 /* DPMS flags */ 63 /* DPMS flags */
67 /* bit compatible with the xorg definitions. */ 64 /* bit compatible with the xorg definitions. */
68 #define DRM_MODE_DPMS_ON 0 65 #define DRM_MODE_DPMS_ON 0
69 #define DRM_MODE_DPMS_STANDBY 1 66 #define DRM_MODE_DPMS_STANDBY 1
70 #define DRM_MODE_DPMS_SUSPEND 2 67 #define DRM_MODE_DPMS_SUSPEND 2
71 #define DRM_MODE_DPMS_OFF 3 68 #define DRM_MODE_DPMS_OFF 3
72 69
73 /* Scaling mode options */ 70 /* Scaling mode options */
74 #define DRM_MODE_SCALE_NON_GPU 0 71 #define DRM_MODE_SCALE_NON_GPU 0
75 #define DRM_MODE_SCALE_FULLSCREEN 1 72 #define DRM_MODE_SCALE_FULLSCREEN 1
76 #define DRM_MODE_SCALE_NO_SCALE 2 73 #define DRM_MODE_SCALE_NO_SCALE 2
77 #define DRM_MODE_SCALE_ASPECT 3 74 #define DRM_MODE_SCALE_ASPECT 3
78 75
79 /* Dithering mode options */ 76 /* Dithering mode options */
80 #define DRM_MODE_DITHERING_OFF 0 77 #define DRM_MODE_DITHERING_OFF 0
81 #define DRM_MODE_DITHERING_ON 1 78 #define DRM_MODE_DITHERING_ON 1
82 79
83 struct drm_mode_modeinfo { 80 struct drm_mode_modeinfo {
84 uint32_t clock; 81 __u32 clock;
85 uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew; 82 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
86 uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; 83 __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
87 84
88 uint32_t vrefresh; /* vertical refresh * 1000 */ 85 __u32 vrefresh; /* vertical refresh * 1000 */
89 86
90 uint32_t flags; 87 __u32 flags;
91 uint32_t type; 88 __u32 type;
92 char name[DRM_DISPLAY_MODE_LEN]; 89 char name[DRM_DISPLAY_MODE_LEN];
93 }; 90 };
94 91
95 struct drm_mode_card_res { 92 struct drm_mode_card_res {
96 uint64_t fb_id_ptr; 93 __u64 fb_id_ptr;
97 uint64_t crtc_id_ptr; 94 __u64 crtc_id_ptr;
98 uint64_t connector_id_ptr; 95 __u64 connector_id_ptr;
99 uint64_t encoder_id_ptr; 96 __u64 encoder_id_ptr;
100 uint32_t count_fbs; 97 __u32 count_fbs;
101 uint32_t count_crtcs; 98 __u32 count_crtcs;
102 uint32_t count_connectors; 99 __u32 count_connectors;
103 uint32_t count_encoders; 100 __u32 count_encoders;
104 uint32_t min_width, max_width; 101 __u32 min_width, max_width;
105 uint32_t min_height, max_height; 102 __u32 min_height, max_height;
106 }; 103 };
107 104
108 struct drm_mode_crtc { 105 struct drm_mode_crtc {
109 uint64_t set_connectors_ptr; 106 __u64 set_connectors_ptr;
110 uint32_t count_connectors; 107 __u32 count_connectors;
111 108
112 uint32_t crtc_id; /**< Id */ 109 __u32 crtc_id; /**< Id */
113 uint32_t fb_id; /**< Id of framebuffer */ 110 __u32 fb_id; /**< Id of framebuffer */
114 111
115 uint32_t x, y; /**< Position on the frameuffer */ 112 __u32 x, y; /**< Position on the frameuffer */
116 113
117 uint32_t gamma_size; 114 __u32 gamma_size;
118 uint32_t mode_valid; 115 __u32 mode_valid;
119 struct drm_mode_modeinfo mode; 116 struct drm_mode_modeinfo mode;
120 }; 117 };
121 118
122 #define DRM_MODE_ENCODER_NONE 0 119 #define DRM_MODE_ENCODER_NONE 0
123 #define DRM_MODE_ENCODER_DAC 1 120 #define DRM_MODE_ENCODER_DAC 1
124 #define DRM_MODE_ENCODER_TMDS 2 121 #define DRM_MODE_ENCODER_TMDS 2
125 #define DRM_MODE_ENCODER_LVDS 3 122 #define DRM_MODE_ENCODER_LVDS 3
126 #define DRM_MODE_ENCODER_TVDAC 4 123 #define DRM_MODE_ENCODER_TVDAC 4
127 124
128 struct drm_mode_get_encoder { 125 struct drm_mode_get_encoder {
129 uint32_t encoder_id; 126 __u32 encoder_id;
130 uint32_t encoder_type; 127 __u32 encoder_type;
131 128
132 uint32_t crtc_id; /**< Id of crtc */ 129 __u32 crtc_id; /**< Id of crtc */
133 130
134 uint32_t possible_crtcs; 131 __u32 possible_crtcs;
135 uint32_t possible_clones; 132 __u32 possible_clones;
136 }; 133 };
137 134
138 /* This is for connectors with multiple signal types. */ 135 /* This is for connectors with multiple signal types. */
139 /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ 136 /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */
140 #define DRM_MODE_SUBCONNECTOR_Automatic 0 137 #define DRM_MODE_SUBCONNECTOR_Automatic 0
141 #define DRM_MODE_SUBCONNECTOR_Unknown 0 138 #define DRM_MODE_SUBCONNECTOR_Unknown 0
142 #define DRM_MODE_SUBCONNECTOR_DVID 3 139 #define DRM_MODE_SUBCONNECTOR_DVID 3
143 #define DRM_MODE_SUBCONNECTOR_DVIA 4 140 #define DRM_MODE_SUBCONNECTOR_DVIA 4
144 #define DRM_MODE_SUBCONNECTOR_Composite 5 141 #define DRM_MODE_SUBCONNECTOR_Composite 5
145 #define DRM_MODE_SUBCONNECTOR_SVIDEO 6 142 #define DRM_MODE_SUBCONNECTOR_SVIDEO 6
146 #define DRM_MODE_SUBCONNECTOR_Component 8 143 #define DRM_MODE_SUBCONNECTOR_Component 8
147 144
148 #define DRM_MODE_CONNECTOR_Unknown 0 145 #define DRM_MODE_CONNECTOR_Unknown 0
149 #define DRM_MODE_CONNECTOR_VGA 1 146 #define DRM_MODE_CONNECTOR_VGA 1
150 #define DRM_MODE_CONNECTOR_DVII 2 147 #define DRM_MODE_CONNECTOR_DVII 2
151 #define DRM_MODE_CONNECTOR_DVID 3 148 #define DRM_MODE_CONNECTOR_DVID 3
152 #define DRM_MODE_CONNECTOR_DVIA 4 149 #define DRM_MODE_CONNECTOR_DVIA 4
153 #define DRM_MODE_CONNECTOR_Composite 5 150 #define DRM_MODE_CONNECTOR_Composite 5
154 #define DRM_MODE_CONNECTOR_SVIDEO 6 151 #define DRM_MODE_CONNECTOR_SVIDEO 6
155 #define DRM_MODE_CONNECTOR_LVDS 7 152 #define DRM_MODE_CONNECTOR_LVDS 7
156 #define DRM_MODE_CONNECTOR_Component 8 153 #define DRM_MODE_CONNECTOR_Component 8
157 #define DRM_MODE_CONNECTOR_9PinDIN 9 154 #define DRM_MODE_CONNECTOR_9PinDIN 9
158 #define DRM_MODE_CONNECTOR_DisplayPort 10 155 #define DRM_MODE_CONNECTOR_DisplayPort 10
159 #define DRM_MODE_CONNECTOR_HDMIA 11 156 #define DRM_MODE_CONNECTOR_HDMIA 11
160 #define DRM_MODE_CONNECTOR_HDMIB 12 157 #define DRM_MODE_CONNECTOR_HDMIB 12
161 158
162 struct drm_mode_get_connector { 159 struct drm_mode_get_connector {
163 160
164 uint64_t encoders_ptr; 161 __u64 encoders_ptr;
165 uint64_t modes_ptr; 162 __u64 modes_ptr;
166 uint64_t props_ptr; 163 __u64 props_ptr;
167 uint64_t prop_values_ptr; 164 __u64 prop_values_ptr;
168 165
169 uint32_t count_modes; 166 __u32 count_modes;
170 uint32_t count_props; 167 __u32 count_props;
171 uint32_t count_encoders; 168 __u32 count_encoders;
172 169
173 uint32_t encoder_id; /**< Current Encoder */ 170 __u32 encoder_id; /**< Current Encoder */
174 uint32_t connector_id; /**< Id */ 171 __u32 connector_id; /**< Id */
175 uint32_t connector_type; 172 __u32 connector_type;
176 uint32_t connector_type_id; 173 __u32 connector_type_id;
177 174
178 uint32_t connection; 175 __u32 connection;
179 uint32_t mm_width, mm_height; /**< HxW in millimeters */ 176 __u32 mm_width, mm_height; /**< HxW in millimeters */
180 uint32_t subpixel; 177 __u32 subpixel;
181 }; 178 };
182 179
183 #define DRM_MODE_PROP_PENDING (1<<0) 180 #define DRM_MODE_PROP_PENDING (1<<0)
184 #define DRM_MODE_PROP_RANGE (1<<1) 181 #define DRM_MODE_PROP_RANGE (1<<1)
185 #define DRM_MODE_PROP_IMMUTABLE (1<<2) 182 #define DRM_MODE_PROP_IMMUTABLE (1<<2)
186 #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ 183 #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
187 #define DRM_MODE_PROP_BLOB (1<<4) 184 #define DRM_MODE_PROP_BLOB (1<<4)
188 185
189 struct drm_mode_property_enum { 186 struct drm_mode_property_enum {
190 uint64_t value; 187 __u64 value;
191 char name[DRM_PROP_NAME_LEN]; 188 char name[DRM_PROP_NAME_LEN];
192 }; 189 };
193 190
194 struct drm_mode_get_property { 191 struct drm_mode_get_property {
195 uint64_t values_ptr; /* values and blob lengths */ 192 __u64 values_ptr; /* values and blob lengths */
196 uint64_t enum_blob_ptr; /* enum and blob id ptrs */ 193 __u64 enum_blob_ptr; /* enum and blob id ptrs */
197 194
198 uint32_t prop_id; 195 __u32 prop_id;
199 uint32_t flags; 196 __u32 flags;
200 char name[DRM_PROP_NAME_LEN]; 197 char name[DRM_PROP_NAME_LEN];
201 198
202 uint32_t count_values; 199 __u32 count_values;
203 uint32_t count_enum_blobs; 200 __u32 count_enum_blobs;
204 }; 201 };
205 202
206 struct drm_mode_connector_set_property { 203 struct drm_mode_connector_set_property {
207 uint64_t value; 204 __u64 value;
208 uint32_t prop_id; 205 __u32 prop_id;
209 uint32_t connector_id; 206 __u32 connector_id;
210 }; 207 };
211 208
212 struct drm_mode_get_blob { 209 struct drm_mode_get_blob {
213 uint32_t blob_id; 210 __u32 blob_id;
214 uint32_t length; 211 __u32 length;
215 uint64_t data; 212 __u64 data;
216 }; 213 };
217 214
218 struct drm_mode_fb_cmd { 215 struct drm_mode_fb_cmd {
219 uint32_t fb_id; 216 __u32 fb_id;
220 uint32_t width, height; 217 __u32 width, height;
221 uint32_t pitch; 218 __u32 pitch;
222 uint32_t bpp; 219 __u32 bpp;
223 uint32_t depth; 220 __u32 depth;
224 /* driver specific handle */ 221 /* driver specific handle */
225 uint32_t handle; 222 __u32 handle;
226 }; 223 };
227 224
228 struct drm_mode_mode_cmd { 225 struct drm_mode_mode_cmd {
229 uint32_t connector_id; 226 __u32 connector_id;
230 struct drm_mode_modeinfo mode; 227 struct drm_mode_modeinfo mode;
231 }; 228 };
232 229
233 #define DRM_MODE_CURSOR_BO (1<<0) 230 #define DRM_MODE_CURSOR_BO (1<<0)
234 #define DRM_MODE_CURSOR_MOVE (1<<1) 231 #define DRM_MODE_CURSOR_MOVE (1<<1)
235 232
236 /* 233 /*
237 * depending on the value in flags diffrent members are used. 234 * depending on the value in flags diffrent members are used.
238 * 235 *
239 * CURSOR_BO uses 236 * CURSOR_BO uses
240 * crtc 237 * crtc
241 * width 238 * width
242 * height 239 * height
243 * handle - if 0 turns the cursor of 240 * handle - if 0 turns the cursor of
244 * 241 *
245 * CURSOR_MOVE uses 242 * CURSOR_MOVE uses
246 * crtc 243 * crtc
247 * x 244 * x
248 * y 245 * y
249 */ 246 */
250 struct drm_mode_cursor { 247 struct drm_mode_cursor {
251 uint32_t flags; 248 __u32 flags;
252 uint32_t crtc_id; 249 __u32 crtc_id;
253 int32_t x; 250 __s32 x;
254 int32_t y; 251 __s32 y;
255 uint32_t width; 252 __u32 width;
256 uint32_t height; 253 __u32 height;
257 /* driver specific handle */ 254 /* driver specific handle */
258 uint32_t handle; 255 __u32 handle;
259 }; 256 };
260 257
261 struct drm_mode_crtc_lut { 258 struct drm_mode_crtc_lut {
262 uint32_t crtc_id; 259 __u32 crtc_id;
263 uint32_t gamma_size; 260 __u32 gamma_size;
264 261
265 /* pointers to arrays */ 262 /* pointers to arrays */
266 uint64_t red; 263 __u64 red;
267 uint64_t green; 264 __u64 green;
268 uint64_t blue; 265 __u64 blue;
269 }; 266 };
270 267
271 #endif 268 #endif
272 269
include/drm/i915_drm.h
1 /* 1 /*
2 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 2 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
3 * All Rights Reserved. 3 * All Rights Reserved.
4 * 4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a 5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the 6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including 7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish, 8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to 9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to 10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions: 11 * the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the 13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions 14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software. 15 * of the Software.
16 * 16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 20 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * 24 *
25 */ 25 */
26 26
27 #ifndef _I915_DRM_H_ 27 #ifndef _I915_DRM_H_
28 #define _I915_DRM_H_ 28 #define _I915_DRM_H_
29 29
30 /* Please note that modifications to all structs defined here are 30 /* Please note that modifications to all structs defined here are
31 * subject to backwards-compatibility constraints. 31 * subject to backwards-compatibility constraints.
32 */ 32 */
33 33 #include <linux/types.h>
34 #include "drm.h" 34 #include "drm.h"
35 35
36 /* Each region is a minimum of 16k, and there are at most 255 of them. 36 /* Each region is a minimum of 16k, and there are at most 255 of them.
37 */ 37 */
38 #define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use 38 #define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
39 * of chars for next/prev indices */ 39 * of chars for next/prev indices */
40 #define I915_LOG_MIN_TEX_REGION_SIZE 14 40 #define I915_LOG_MIN_TEX_REGION_SIZE 14
41 41
42 typedef struct _drm_i915_init { 42 typedef struct _drm_i915_init {
43 enum { 43 enum {
44 I915_INIT_DMA = 0x01, 44 I915_INIT_DMA = 0x01,
45 I915_CLEANUP_DMA = 0x02, 45 I915_CLEANUP_DMA = 0x02,
46 I915_RESUME_DMA = 0x03 46 I915_RESUME_DMA = 0x03
47 } func; 47 } func;
48 unsigned int mmio_offset; 48 unsigned int mmio_offset;
49 int sarea_priv_offset; 49 int sarea_priv_offset;
50 unsigned int ring_start; 50 unsigned int ring_start;
51 unsigned int ring_end; 51 unsigned int ring_end;
52 unsigned int ring_size; 52 unsigned int ring_size;
53 unsigned int front_offset; 53 unsigned int front_offset;
54 unsigned int back_offset; 54 unsigned int back_offset;
55 unsigned int depth_offset; 55 unsigned int depth_offset;
56 unsigned int w; 56 unsigned int w;
57 unsigned int h; 57 unsigned int h;
58 unsigned int pitch; 58 unsigned int pitch;
59 unsigned int pitch_bits; 59 unsigned int pitch_bits;
60 unsigned int back_pitch; 60 unsigned int back_pitch;
61 unsigned int depth_pitch; 61 unsigned int depth_pitch;
62 unsigned int cpp; 62 unsigned int cpp;
63 unsigned int chipset; 63 unsigned int chipset;
64 } drm_i915_init_t; 64 } drm_i915_init_t;
65 65
66 typedef struct _drm_i915_sarea { 66 typedef struct _drm_i915_sarea {
67 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; 67 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
68 int last_upload; /* last time texture was uploaded */ 68 int last_upload; /* last time texture was uploaded */
69 int last_enqueue; /* last time a buffer was enqueued */ 69 int last_enqueue; /* last time a buffer was enqueued */
70 int last_dispatch; /* age of the most recently dispatched buffer */ 70 int last_dispatch; /* age of the most recently dispatched buffer */
71 int ctxOwner; /* last context to upload state */ 71 int ctxOwner; /* last context to upload state */
72 int texAge; 72 int texAge;
73 int pf_enabled; /* is pageflipping allowed? */ 73 int pf_enabled; /* is pageflipping allowed? */
74 int pf_active; 74 int pf_active;
75 int pf_current_page; /* which buffer is being displayed? */ 75 int pf_current_page; /* which buffer is being displayed? */
76 int perf_boxes; /* performance boxes to be displayed */ 76 int perf_boxes; /* performance boxes to be displayed */
77 int width, height; /* screen size in pixels */ 77 int width, height; /* screen size in pixels */
78 78
79 drm_handle_t front_handle; 79 drm_handle_t front_handle;
80 int front_offset; 80 int front_offset;
81 int front_size; 81 int front_size;
82 82
83 drm_handle_t back_handle; 83 drm_handle_t back_handle;
84 int back_offset; 84 int back_offset;
85 int back_size; 85 int back_size;
86 86
87 drm_handle_t depth_handle; 87 drm_handle_t depth_handle;
88 int depth_offset; 88 int depth_offset;
89 int depth_size; 89 int depth_size;
90 90
91 drm_handle_t tex_handle; 91 drm_handle_t tex_handle;
92 int tex_offset; 92 int tex_offset;
93 int tex_size; 93 int tex_size;
94 int log_tex_granularity; 94 int log_tex_granularity;
95 int pitch; 95 int pitch;
96 int rotation; /* 0, 90, 180 or 270 */ 96 int rotation; /* 0, 90, 180 or 270 */
97 int rotated_offset; 97 int rotated_offset;
98 int rotated_size; 98 int rotated_size;
99 int rotated_pitch; 99 int rotated_pitch;
100 int virtualX, virtualY; 100 int virtualX, virtualY;
101 101
102 unsigned int front_tiled; 102 unsigned int front_tiled;
103 unsigned int back_tiled; 103 unsigned int back_tiled;
104 unsigned int depth_tiled; 104 unsigned int depth_tiled;
105 unsigned int rotated_tiled; 105 unsigned int rotated_tiled;
106 unsigned int rotated2_tiled; 106 unsigned int rotated2_tiled;
107 107
108 int pipeA_x; 108 int pipeA_x;
109 int pipeA_y; 109 int pipeA_y;
110 int pipeA_w; 110 int pipeA_w;
111 int pipeA_h; 111 int pipeA_h;
112 int pipeB_x; 112 int pipeB_x;
113 int pipeB_y; 113 int pipeB_y;
114 int pipeB_w; 114 int pipeB_w;
115 int pipeB_h; 115 int pipeB_h;
116 116
117 /* fill out some space for old userspace triple buffer */ 117 /* fill out some space for old userspace triple buffer */
118 drm_handle_t unused_handle; 118 drm_handle_t unused_handle;
119 uint32_t unused1, unused2, unused3; 119 __u32 unused1, unused2, unused3;
120 120
121 /* buffer object handles for static buffers. May change 121 /* buffer object handles for static buffers. May change
122 * over the lifetime of the client. 122 * over the lifetime of the client.
123 */ 123 */
124 uint32_t front_bo_handle; 124 __u32 front_bo_handle;
125 uint32_t back_bo_handle; 125 __u32 back_bo_handle;
126 uint32_t unused_bo_handle; 126 __u32 unused_bo_handle;
127 uint32_t depth_bo_handle; 127 __u32 depth_bo_handle;
128 128
129 } drm_i915_sarea_t; 129 } drm_i915_sarea_t;
130 130
131 /* due to userspace building against these headers we need some compat here */ 131 /* due to userspace building against these headers we need some compat here */
132 #define planeA_x pipeA_x 132 #define planeA_x pipeA_x
133 #define planeA_y pipeA_y 133 #define planeA_y pipeA_y
134 #define planeA_w pipeA_w 134 #define planeA_w pipeA_w
135 #define planeA_h pipeA_h 135 #define planeA_h pipeA_h
136 #define planeB_x pipeB_x 136 #define planeB_x pipeB_x
137 #define planeB_y pipeB_y 137 #define planeB_y pipeB_y
138 #define planeB_w pipeB_w 138 #define planeB_w pipeB_w
139 #define planeB_h pipeB_h 139 #define planeB_h pipeB_h
140 140
141 /* Flags for perf_boxes 141 /* Flags for perf_boxes
142 */ 142 */
143 #define I915_BOX_RING_EMPTY 0x1 143 #define I915_BOX_RING_EMPTY 0x1
144 #define I915_BOX_FLIP 0x2 144 #define I915_BOX_FLIP 0x2
145 #define I915_BOX_WAIT 0x4 145 #define I915_BOX_WAIT 0x4
146 #define I915_BOX_TEXTURE_LOAD 0x8 146 #define I915_BOX_TEXTURE_LOAD 0x8
147 #define I915_BOX_LOST_CONTEXT 0x10 147 #define I915_BOX_LOST_CONTEXT 0x10
148 148
149 /* I915 specific ioctls 149 /* I915 specific ioctls
150 * The device specific ioctl range is 0x40 to 0x79. 150 * The device specific ioctl range is 0x40 to 0x79.
151 */ 151 */
152 #define DRM_I915_INIT 0x00 152 #define DRM_I915_INIT 0x00
153 #define DRM_I915_FLUSH 0x01 153 #define DRM_I915_FLUSH 0x01
154 #define DRM_I915_FLIP 0x02 154 #define DRM_I915_FLIP 0x02
155 #define DRM_I915_BATCHBUFFER 0x03 155 #define DRM_I915_BATCHBUFFER 0x03
156 #define DRM_I915_IRQ_EMIT 0x04 156 #define DRM_I915_IRQ_EMIT 0x04
157 #define DRM_I915_IRQ_WAIT 0x05 157 #define DRM_I915_IRQ_WAIT 0x05
158 #define DRM_I915_GETPARAM 0x06 158 #define DRM_I915_GETPARAM 0x06
159 #define DRM_I915_SETPARAM 0x07 159 #define DRM_I915_SETPARAM 0x07
160 #define DRM_I915_ALLOC 0x08 160 #define DRM_I915_ALLOC 0x08
161 #define DRM_I915_FREE 0x09 161 #define DRM_I915_FREE 0x09
162 #define DRM_I915_INIT_HEAP 0x0a 162 #define DRM_I915_INIT_HEAP 0x0a
163 #define DRM_I915_CMDBUFFER 0x0b 163 #define DRM_I915_CMDBUFFER 0x0b
164 #define DRM_I915_DESTROY_HEAP 0x0c 164 #define DRM_I915_DESTROY_HEAP 0x0c
165 #define DRM_I915_SET_VBLANK_PIPE 0x0d 165 #define DRM_I915_SET_VBLANK_PIPE 0x0d
166 #define DRM_I915_GET_VBLANK_PIPE 0x0e 166 #define DRM_I915_GET_VBLANK_PIPE 0x0e
167 #define DRM_I915_VBLANK_SWAP 0x0f 167 #define DRM_I915_VBLANK_SWAP 0x0f
168 #define DRM_I915_HWS_ADDR 0x11 168 #define DRM_I915_HWS_ADDR 0x11
169 #define DRM_I915_GEM_INIT 0x13 169 #define DRM_I915_GEM_INIT 0x13
170 #define DRM_I915_GEM_EXECBUFFER 0x14 170 #define DRM_I915_GEM_EXECBUFFER 0x14
171 #define DRM_I915_GEM_PIN 0x15 171 #define DRM_I915_GEM_PIN 0x15
172 #define DRM_I915_GEM_UNPIN 0x16 172 #define DRM_I915_GEM_UNPIN 0x16
173 #define DRM_I915_GEM_BUSY 0x17 173 #define DRM_I915_GEM_BUSY 0x17
174 #define DRM_I915_GEM_THROTTLE 0x18 174 #define DRM_I915_GEM_THROTTLE 0x18
175 #define DRM_I915_GEM_ENTERVT 0x19 175 #define DRM_I915_GEM_ENTERVT 0x19
176 #define DRM_I915_GEM_LEAVEVT 0x1a 176 #define DRM_I915_GEM_LEAVEVT 0x1a
177 #define DRM_I915_GEM_CREATE 0x1b 177 #define DRM_I915_GEM_CREATE 0x1b
178 #define DRM_I915_GEM_PREAD 0x1c 178 #define DRM_I915_GEM_PREAD 0x1c
179 #define DRM_I915_GEM_PWRITE 0x1d 179 #define DRM_I915_GEM_PWRITE 0x1d
180 #define DRM_I915_GEM_MMAP 0x1e 180 #define DRM_I915_GEM_MMAP 0x1e
181 #define DRM_I915_GEM_SET_DOMAIN 0x1f 181 #define DRM_I915_GEM_SET_DOMAIN 0x1f
182 #define DRM_I915_GEM_SW_FINISH 0x20 182 #define DRM_I915_GEM_SW_FINISH 0x20
183 #define DRM_I915_GEM_SET_TILING 0x21 183 #define DRM_I915_GEM_SET_TILING 0x21
184 #define DRM_I915_GEM_GET_TILING 0x22 184 #define DRM_I915_GEM_GET_TILING 0x22
185 #define DRM_I915_GEM_GET_APERTURE 0x23 185 #define DRM_I915_GEM_GET_APERTURE 0x23
186 #define DRM_I915_GEM_MMAP_GTT 0x24 186 #define DRM_I915_GEM_MMAP_GTT 0x24
187 187
188 #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 188 #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
189 #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 189 #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
190 #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) 190 #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
191 #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) 191 #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
192 #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) 192 #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
193 #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) 193 #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
194 #define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) 194 #define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
195 #define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) 195 #define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
196 #define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) 196 #define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
197 #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) 197 #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
198 #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) 198 #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
199 #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) 199 #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
200 #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) 200 #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
201 #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 201 #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
202 #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 202 #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
203 #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 203 #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
204 #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 204 #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
205 #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 205 #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
206 #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 206 #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
207 #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 207 #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
208 #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 208 #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
209 #define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) 209 #define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
210 #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) 210 #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
211 #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) 211 #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
212 #define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) 212 #define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
213 #define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) 213 #define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
214 #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 214 #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
215 #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 215 #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
216 #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) 216 #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
217 #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 217 #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
218 #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 218 #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
219 #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 219 #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
220 #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 220 #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
221 #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 221 #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
222 222
223 /* Allow drivers to submit batchbuffers directly to hardware, relying 223 /* Allow drivers to submit batchbuffers directly to hardware, relying
224 * on the security mechanisms provided by hardware. 224 * on the security mechanisms provided by hardware.
225 */ 225 */
226 typedef struct drm_i915_batchbuffer { 226 typedef struct drm_i915_batchbuffer {
227 int start; /* agp offset */ 227 int start; /* agp offset */
228 int used; /* nr bytes in use */ 228 int used; /* nr bytes in use */
229 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 229 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
230 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 230 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
231 int num_cliprects; /* mulitpass with multiple cliprects? */ 231 int num_cliprects; /* mulitpass with multiple cliprects? */
232 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ 232 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
233 } drm_i915_batchbuffer_t; 233 } drm_i915_batchbuffer_t;
234 234
235 /* As above, but pass a pointer to userspace buffer which can be 235 /* As above, but pass a pointer to userspace buffer which can be
236 * validated by the kernel prior to sending to hardware. 236 * validated by the kernel prior to sending to hardware.
237 */ 237 */
238 typedef struct _drm_i915_cmdbuffer { 238 typedef struct _drm_i915_cmdbuffer {
239 char __user *buf; /* pointer to userspace command buffer */ 239 char __user *buf; /* pointer to userspace command buffer */
240 int sz; /* nr bytes in buf */ 240 int sz; /* nr bytes in buf */
241 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 241 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
242 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 242 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
243 int num_cliprects; /* mulitpass with multiple cliprects? */ 243 int num_cliprects; /* mulitpass with multiple cliprects? */
244 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ 244 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
245 } drm_i915_cmdbuffer_t; 245 } drm_i915_cmdbuffer_t;
246 246
247 /* Userspace can request & wait on irq's: 247 /* Userspace can request & wait on irq's:
248 */ 248 */
249 typedef struct drm_i915_irq_emit { 249 typedef struct drm_i915_irq_emit {
250 int __user *irq_seq; 250 int __user *irq_seq;
251 } drm_i915_irq_emit_t; 251 } drm_i915_irq_emit_t;
252 252
253 typedef struct drm_i915_irq_wait { 253 typedef struct drm_i915_irq_wait {
254 int irq_seq; 254 int irq_seq;
255 } drm_i915_irq_wait_t; 255 } drm_i915_irq_wait_t;
256 256
257 /* Ioctl to query kernel params: 257 /* Ioctl to query kernel params:
258 */ 258 */
259 #define I915_PARAM_IRQ_ACTIVE 1 259 #define I915_PARAM_IRQ_ACTIVE 1
260 #define I915_PARAM_ALLOW_BATCHBUFFER 2 260 #define I915_PARAM_ALLOW_BATCHBUFFER 2
261 #define I915_PARAM_LAST_DISPATCH 3 261 #define I915_PARAM_LAST_DISPATCH 3
262 #define I915_PARAM_CHIPSET_ID 4 262 #define I915_PARAM_CHIPSET_ID 4
263 #define I915_PARAM_HAS_GEM 5 263 #define I915_PARAM_HAS_GEM 5
264 264
265 typedef struct drm_i915_getparam { 265 typedef struct drm_i915_getparam {
266 int param; 266 int param;
267 int __user *value; 267 int __user *value;
268 } drm_i915_getparam_t; 268 } drm_i915_getparam_t;
269 269
270 /* Ioctl to set kernel params: 270 /* Ioctl to set kernel params:
271 */ 271 */
272 #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 272 #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
273 #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 273 #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
274 #define I915_SETPARAM_ALLOW_BATCHBUFFER 3 274 #define I915_SETPARAM_ALLOW_BATCHBUFFER 3
275 275
276 typedef struct drm_i915_setparam { 276 typedef struct drm_i915_setparam {
277 int param; 277 int param;
278 int value; 278 int value;
279 } drm_i915_setparam_t; 279 } drm_i915_setparam_t;
280 280
281 /* A memory manager for regions of shared memory: 281 /* A memory manager for regions of shared memory:
282 */ 282 */
283 #define I915_MEM_REGION_AGP 1 283 #define I915_MEM_REGION_AGP 1
284 284
285 typedef struct drm_i915_mem_alloc { 285 typedef struct drm_i915_mem_alloc {
286 int region; 286 int region;
287 int alignment; 287 int alignment;
288 int size; 288 int size;
289 int __user *region_offset; /* offset from start of fb or agp */ 289 int __user *region_offset; /* offset from start of fb or agp */
290 } drm_i915_mem_alloc_t; 290 } drm_i915_mem_alloc_t;
291 291
292 typedef struct drm_i915_mem_free { 292 typedef struct drm_i915_mem_free {
293 int region; 293 int region;
294 int region_offset; 294 int region_offset;
295 } drm_i915_mem_free_t; 295 } drm_i915_mem_free_t;
296 296
297 typedef struct drm_i915_mem_init_heap { 297 typedef struct drm_i915_mem_init_heap {
298 int region; 298 int region;
299 int size; 299 int size;
300 int start; 300 int start;
301 } drm_i915_mem_init_heap_t; 301 } drm_i915_mem_init_heap_t;
302 302
303 /* Allow memory manager to be torn down and re-initialized (eg on 303 /* Allow memory manager to be torn down and re-initialized (eg on
304 * rotate): 304 * rotate):
305 */ 305 */
306 typedef struct drm_i915_mem_destroy_heap { 306 typedef struct drm_i915_mem_destroy_heap {
307 int region; 307 int region;
308 } drm_i915_mem_destroy_heap_t; 308 } drm_i915_mem_destroy_heap_t;
309 309
310 /* Allow X server to configure which pipes to monitor for vblank signals 310 /* Allow X server to configure which pipes to monitor for vblank signals
311 */ 311 */
312 #define DRM_I915_VBLANK_PIPE_A 1 312 #define DRM_I915_VBLANK_PIPE_A 1
313 #define DRM_I915_VBLANK_PIPE_B 2 313 #define DRM_I915_VBLANK_PIPE_B 2
314 314
315 typedef struct drm_i915_vblank_pipe { 315 typedef struct drm_i915_vblank_pipe {
316 int pipe; 316 int pipe;
317 } drm_i915_vblank_pipe_t; 317 } drm_i915_vblank_pipe_t;
318 318
319 /* Schedule buffer swap at given vertical blank: 319 /* Schedule buffer swap at given vertical blank:
320 */ 320 */
321 typedef struct drm_i915_vblank_swap { 321 typedef struct drm_i915_vblank_swap {
322 drm_drawable_t drawable; 322 drm_drawable_t drawable;
323 enum drm_vblank_seq_type seqtype; 323 enum drm_vblank_seq_type seqtype;
324 unsigned int sequence; 324 unsigned int sequence;
325 } drm_i915_vblank_swap_t; 325 } drm_i915_vblank_swap_t;
326 326
327 typedef struct drm_i915_hws_addr { 327 typedef struct drm_i915_hws_addr {
328 uint64_t addr; 328 __u64 addr;
329 } drm_i915_hws_addr_t; 329 } drm_i915_hws_addr_t;
330 330
331 struct drm_i915_gem_init { 331 struct drm_i915_gem_init {
332 /** 332 /**
333 * Beginning offset in the GTT to be managed by the DRM memory 333 * Beginning offset in the GTT to be managed by the DRM memory
334 * manager. 334 * manager.
335 */ 335 */
336 uint64_t gtt_start; 336 __u64 gtt_start;
337 /** 337 /**
338 * Ending offset in the GTT to be managed by the DRM memory 338 * Ending offset in the GTT to be managed by the DRM memory
339 * manager. 339 * manager.
340 */ 340 */
341 uint64_t gtt_end; 341 __u64 gtt_end;
342 }; 342 };
343 343
344 struct drm_i915_gem_create { 344 struct drm_i915_gem_create {
345 /** 345 /**
346 * Requested size for the object. 346 * Requested size for the object.
347 * 347 *
348 * The (page-aligned) allocated size for the object will be returned. 348 * The (page-aligned) allocated size for the object will be returned.
349 */ 349 */
350 uint64_t size; 350 __u64 size;
351 /** 351 /**
352 * Returned handle for the object. 352 * Returned handle for the object.
353 * 353 *
354 * Object handles are nonzero. 354 * Object handles are nonzero.
355 */ 355 */
356 uint32_t handle; 356 __u32 handle;
357 uint32_t pad; 357 __u32 pad;
358 }; 358 };
359 359
360 struct drm_i915_gem_pread { 360 struct drm_i915_gem_pread {
361 /** Handle for the object being read. */ 361 /** Handle for the object being read. */
362 uint32_t handle; 362 __u32 handle;
363 uint32_t pad; 363 __u32 pad;
364 /** Offset into the object to read from */ 364 /** Offset into the object to read from */
365 uint64_t offset; 365 __u64 offset;
366 /** Length of data to read */ 366 /** Length of data to read */
367 uint64_t size; 367 __u64 size;
368 /** 368 /**
369 * Pointer to write the data into. 369 * Pointer to write the data into.
370 * 370 *
371 * This is a fixed-size type for 32/64 compatibility. 371 * This is a fixed-size type for 32/64 compatibility.
372 */ 372 */
373 uint64_t data_ptr; 373 __u64 data_ptr;
374 }; 374 };
375 375
376 struct drm_i915_gem_pwrite { 376 struct drm_i915_gem_pwrite {
377 /** Handle for the object being written to. */ 377 /** Handle for the object being written to. */
378 uint32_t handle; 378 __u32 handle;
379 uint32_t pad; 379 __u32 pad;
380 /** Offset into the object to write to */ 380 /** Offset into the object to write to */
381 uint64_t offset; 381 __u64 offset;
382 /** Length of data to write */ 382 /** Length of data to write */
383 uint64_t size; 383 __u64 size;
384 /** 384 /**
385 * Pointer to read the data from. 385 * Pointer to read the data from.
386 * 386 *
387 * This is a fixed-size type for 32/64 compatibility. 387 * This is a fixed-size type for 32/64 compatibility.
388 */ 388 */
389 uint64_t data_ptr; 389 __u64 data_ptr;
390 }; 390 };
391 391
392 struct drm_i915_gem_mmap { 392 struct drm_i915_gem_mmap {
393 /** Handle for the object being mapped. */ 393 /** Handle for the object being mapped. */
394 uint32_t handle; 394 __u32 handle;
395 uint32_t pad; 395 __u32 pad;
396 /** Offset in the object to map. */ 396 /** Offset in the object to map. */
397 uint64_t offset; 397 __u64 offset;
398 /** 398 /**
399 * Length of data to map. 399 * Length of data to map.
400 * 400 *
401 * The value will be page-aligned. 401 * The value will be page-aligned.
402 */ 402 */
403 uint64_t size; 403 __u64 size;
404 /** 404 /**
405 * Returned pointer the data was mapped at. 405 * Returned pointer the data was mapped at.
406 * 406 *
407 * This is a fixed-size type for 32/64 compatibility. 407 * This is a fixed-size type for 32/64 compatibility.
408 */ 408 */
409 uint64_t addr_ptr; 409 __u64 addr_ptr;
410 }; 410 };
411 411
412 struct drm_i915_gem_mmap_gtt { 412 struct drm_i915_gem_mmap_gtt {
413 /** Handle for the object being mapped. */ 413 /** Handle for the object being mapped. */
414 uint32_t handle; 414 __u32 handle;
415 uint32_t pad; 415 __u32 pad;
416 /** 416 /**
417 * Fake offset to use for subsequent mmap call 417 * Fake offset to use for subsequent mmap call
418 * 418 *
419 * This is a fixed-size type for 32/64 compatibility. 419 * This is a fixed-size type for 32/64 compatibility.
420 */ 420 */
421 uint64_t offset; 421 __u64 offset;
422 }; 422 };
423 423
424 struct drm_i915_gem_set_domain { 424 struct drm_i915_gem_set_domain {
425 /** Handle for the object */ 425 /** Handle for the object */
426 uint32_t handle; 426 __u32 handle;
427 427
428 /** New read domains */ 428 /** New read domains */
429 uint32_t read_domains; 429 __u32 read_domains;
430 430
431 /** New write domain */ 431 /** New write domain */
432 uint32_t write_domain; 432 __u32 write_domain;
433 }; 433 };
434 434
435 struct drm_i915_gem_sw_finish { 435 struct drm_i915_gem_sw_finish {
436 /** Handle for the object */ 436 /** Handle for the object */
437 uint32_t handle; 437 __u32 handle;
438 }; 438 };
439 439
440 struct drm_i915_gem_relocation_entry { 440 struct drm_i915_gem_relocation_entry {
441 /** 441 /**
442 * Handle of the buffer being pointed to by this relocation entry. 442 * Handle of the buffer being pointed to by this relocation entry.
443 * 443 *
444 * It's appealing to make this be an index into the mm_validate_entry 444 * It's appealing to make this be an index into the mm_validate_entry
445 * list to refer to the buffer, but this allows the driver to create 445 * list to refer to the buffer, but this allows the driver to create
446 * a relocation list for state buffers and not re-write it per 446 * a relocation list for state buffers and not re-write it per
447 * exec using the buffer. 447 * exec using the buffer.
448 */ 448 */
449 uint32_t target_handle; 449 __u32 target_handle;
450 450
451 /** 451 /**
452 * Value to be added to the offset of the target buffer to make up 452 * Value to be added to the offset of the target buffer to make up
453 * the relocation entry. 453 * the relocation entry.
454 */ 454 */
455 uint32_t delta; 455 __u32 delta;
456 456
457 /** Offset in the buffer the relocation entry will be written into */ 457 /** Offset in the buffer the relocation entry will be written into */
458 uint64_t offset; 458 __u64 offset;
459 459
460 /** 460 /**
461 * Offset value of the target buffer that the relocation entry was last 461 * Offset value of the target buffer that the relocation entry was last
462 * written as. 462 * written as.
463 * 463 *
464 * If the buffer has the same offset as last time, we can skip syncing 464 * If the buffer has the same offset as last time, we can skip syncing
465 * and writing the relocation. This value is written back out by 465 * and writing the relocation. This value is written back out by
466 * the execbuffer ioctl when the relocation is written. 466 * the execbuffer ioctl when the relocation is written.
467 */ 467 */
468 uint64_t presumed_offset; 468 __u64 presumed_offset;
469 469
470 /** 470 /**
471 * Target memory domains read by this operation. 471 * Target memory domains read by this operation.
472 */ 472 */
473 uint32_t read_domains; 473 __u32 read_domains;
474 474
475 /** 475 /**
476 * Target memory domains written by this operation. 476 * Target memory domains written by this operation.
477 * 477 *
478 * Note that only one domain may be written by the whole 478 * Note that only one domain may be written by the whole
479 * execbuffer operation, so that where there are conflicts, 479 * execbuffer operation, so that where there are conflicts,
480 * the application will get -EINVAL back. 480 * the application will get -EINVAL back.
481 */ 481 */
482 uint32_t write_domain; 482 __u32 write_domain;
483 }; 483 };
484 484
485 /** @{ 485 /** @{
486 * Intel memory domains 486 * Intel memory domains
487 * 487 *
488 * Most of these just align with the various caches in 488 * Most of these just align with the various caches in
489 * the system and are used to flush and invalidate as 489 * the system and are used to flush and invalidate as
490 * objects end up cached in different domains. 490 * objects end up cached in different domains.
491 */ 491 */
492 /** CPU cache */ 492 /** CPU cache */
493 #define I915_GEM_DOMAIN_CPU 0x00000001 493 #define I915_GEM_DOMAIN_CPU 0x00000001
494 /** Render cache, used by 2D and 3D drawing */ 494 /** Render cache, used by 2D and 3D drawing */
495 #define I915_GEM_DOMAIN_RENDER 0x00000002 495 #define I915_GEM_DOMAIN_RENDER 0x00000002
496 /** Sampler cache, used by texture engine */ 496 /** Sampler cache, used by texture engine */
497 #define I915_GEM_DOMAIN_SAMPLER 0x00000004 497 #define I915_GEM_DOMAIN_SAMPLER 0x00000004
498 /** Command queue, used to load batch buffers */ 498 /** Command queue, used to load batch buffers */
499 #define I915_GEM_DOMAIN_COMMAND 0x00000008 499 #define I915_GEM_DOMAIN_COMMAND 0x00000008
500 /** Instruction cache, used by shader programs */ 500 /** Instruction cache, used by shader programs */
501 #define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 501 #define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
502 /** Vertex address cache */ 502 /** Vertex address cache */
503 #define I915_GEM_DOMAIN_VERTEX 0x00000020 503 #define I915_GEM_DOMAIN_VERTEX 0x00000020
504 /** GTT domain - aperture and scanout */ 504 /** GTT domain - aperture and scanout */
505 #define I915_GEM_DOMAIN_GTT 0x00000040 505 #define I915_GEM_DOMAIN_GTT 0x00000040
506 /** @} */ 506 /** @} */
507 507
508 struct drm_i915_gem_exec_object { 508 struct drm_i915_gem_exec_object {
509 /** 509 /**
510 * User's handle for a buffer to be bound into the GTT for this 510 * User's handle for a buffer to be bound into the GTT for this
511 * operation. 511 * operation.
512 */ 512 */
513 uint32_t handle; 513 __u32 handle;
514 514
515 /** Number of relocations to be performed on this buffer */ 515 /** Number of relocations to be performed on this buffer */
516 uint32_t relocation_count; 516 __u32 relocation_count;
517 /** 517 /**
518 * Pointer to array of struct drm_i915_gem_relocation_entry containing 518 * Pointer to array of struct drm_i915_gem_relocation_entry containing
519 * the relocations to be performed in this buffer. 519 * the relocations to be performed in this buffer.
520 */ 520 */
521 uint64_t relocs_ptr; 521 __u64 relocs_ptr;
522 522
523 /** Required alignment in graphics aperture */ 523 /** Required alignment in graphics aperture */
524 uint64_t alignment; 524 __u64 alignment;
525 525
526 /** 526 /**
527 * Returned value of the updated offset of the object, for future 527 * Returned value of the updated offset of the object, for future
528 * presumed_offset writes. 528 * presumed_offset writes.
529 */ 529 */
530 uint64_t offset; 530 __u64 offset;
531 }; 531 };
532 532
533 struct drm_i915_gem_execbuffer { 533 struct drm_i915_gem_execbuffer {
534 /** 534 /**
535 * List of buffers to be validated with their relocations to be 535 * List of buffers to be validated with their relocations to be
536 * performend on them. 536 * performend on them.
537 * 537 *
538 * This is a pointer to an array of struct drm_i915_gem_validate_entry. 538 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
539 * 539 *
540 * These buffers must be listed in an order such that all relocations 540 * These buffers must be listed in an order such that all relocations
541 * a buffer is performing refer to buffers that have already appeared 541 * a buffer is performing refer to buffers that have already appeared
542 * in the validate list. 542 * in the validate list.
543 */ 543 */
544 uint64_t buffers_ptr; 544 __u64 buffers_ptr;
545 uint32_t buffer_count; 545 __u32 buffer_count;
546 546
547 /** Offset in the batchbuffer to start execution from. */ 547 /** Offset in the batchbuffer to start execution from. */
548 uint32_t batch_start_offset; 548 __u32 batch_start_offset;
549 /** Bytes used in batchbuffer from batch_start_offset */ 549 /** Bytes used in batchbuffer from batch_start_offset */
550 uint32_t batch_len; 550 __u32 batch_len;
551 uint32_t DR1; 551 __u32 DR1;
552 uint32_t DR4; 552 __u32 DR4;
553 uint32_t num_cliprects; 553 __u32 num_cliprects;
554 /** This is a struct drm_clip_rect *cliprects */ 554 /** This is a struct drm_clip_rect *cliprects */
555 uint64_t cliprects_ptr; 555 __u64 cliprects_ptr;
556 }; 556 };
557 557
558 struct drm_i915_gem_pin { 558 struct drm_i915_gem_pin {
559 /** Handle of the buffer to be pinned. */ 559 /** Handle of the buffer to be pinned. */
560 uint32_t handle; 560 __u32 handle;
561 uint32_t pad; 561 __u32 pad;
562 562
563 /** alignment required within the aperture */ 563 /** alignment required within the aperture */
564 uint64_t alignment; 564 __u64 alignment;
565 565
566 /** Returned GTT offset of the buffer. */ 566 /** Returned GTT offset of the buffer. */
567 uint64_t offset; 567 __u64 offset;
568 }; 568 };
569 569
570 struct drm_i915_gem_unpin { 570 struct drm_i915_gem_unpin {
571 /** Handle of the buffer to be unpinned. */ 571 /** Handle of the buffer to be unpinned. */
572 uint32_t handle; 572 __u32 handle;
573 uint32_t pad; 573 __u32 pad;
574 }; 574 };
575 575
576 struct drm_i915_gem_busy { 576 struct drm_i915_gem_busy {
577 /** Handle of the buffer to check for busy */ 577 /** Handle of the buffer to check for busy */
578 uint32_t handle; 578 __u32 handle;
579 579
580 /** Return busy status (1 if busy, 0 if idle) */ 580 /** Return busy status (1 if busy, 0 if idle) */
581 uint32_t busy; 581 __u32 busy;
582 }; 582 };
583 583
584 #define I915_TILING_NONE 0 584 #define I915_TILING_NONE 0
585 #define I915_TILING_X 1 585 #define I915_TILING_X 1
586 #define I915_TILING_Y 2 586 #define I915_TILING_Y 2
587 587
588 #define I915_BIT_6_SWIZZLE_NONE 0 588 #define I915_BIT_6_SWIZZLE_NONE 0
589 #define I915_BIT_6_SWIZZLE_9 1 589 #define I915_BIT_6_SWIZZLE_9 1
590 #define I915_BIT_6_SWIZZLE_9_10 2 590 #define I915_BIT_6_SWIZZLE_9_10 2
591 #define I915_BIT_6_SWIZZLE_9_11 3 591 #define I915_BIT_6_SWIZZLE_9_11 3
592 #define I915_BIT_6_SWIZZLE_9_10_11 4 592 #define I915_BIT_6_SWIZZLE_9_10_11 4
593 /* Not seen by userland */ 593 /* Not seen by userland */
594 #define I915_BIT_6_SWIZZLE_UNKNOWN 5 594 #define I915_BIT_6_SWIZZLE_UNKNOWN 5
595 595
596 struct drm_i915_gem_set_tiling { 596 struct drm_i915_gem_set_tiling {
597 /** Handle of the buffer to have its tiling state updated */ 597 /** Handle of the buffer to have its tiling state updated */
598 uint32_t handle; 598 __u32 handle;
599 599
600 /** 600 /**
601 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 601 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
602 * I915_TILING_Y). 602 * I915_TILING_Y).
603 * 603 *
604 * This value is to be set on request, and will be updated by the 604 * This value is to be set on request, and will be updated by the
605 * kernel on successful return with the actual chosen tiling layout. 605 * kernel on successful return with the actual chosen tiling layout.
606 * 606 *
607 * The tiling mode may be demoted to I915_TILING_NONE when the system 607 * The tiling mode may be demoted to I915_TILING_NONE when the system
608 * has bit 6 swizzling that can't be managed correctly by GEM. 608 * has bit 6 swizzling that can't be managed correctly by GEM.
609 * 609 *
610 * Buffer contents become undefined when changing tiling_mode. 610 * Buffer contents become undefined when changing tiling_mode.
611 */ 611 */
612 uint32_t tiling_mode; 612 __u32 tiling_mode;
613 613
614 /** 614 /**
615 * Stride in bytes for the object when in I915_TILING_X or 615 * Stride in bytes for the object when in I915_TILING_X or
616 * I915_TILING_Y. 616 * I915_TILING_Y.
617 */ 617 */
618 uint32_t stride; 618 __u32 stride;
619 619
620 /** 620 /**
621 * Returned address bit 6 swizzling required for CPU access through 621 * Returned address bit 6 swizzling required for CPU access through
622 * mmap mapping. 622 * mmap mapping.
623 */ 623 */
624 uint32_t swizzle_mode; 624 __u32 swizzle_mode;
625 }; 625 };
626 626
627 struct drm_i915_gem_get_tiling { 627 struct drm_i915_gem_get_tiling {
628 /** Handle of the buffer to get tiling state for. */ 628 /** Handle of the buffer to get tiling state for. */
629 uint32_t handle; 629 __u32 handle;
630 630
631 /** 631 /**
632 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 632 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
633 * I915_TILING_Y). 633 * I915_TILING_Y).
634 */ 634 */
635 uint32_t tiling_mode; 635 __u32 tiling_mode;
636 636
637 /** 637 /**
638 * Returned address bit 6 swizzling required for CPU access through 638 * Returned address bit 6 swizzling required for CPU access through
639 * mmap mapping. 639 * mmap mapping.
640 */ 640 */
641 uint32_t swizzle_mode; 641 __u32 swizzle_mode;
642 }; 642 };
643 643
644 struct drm_i915_gem_get_aperture { 644 struct drm_i915_gem_get_aperture {
645 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 645 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
646 uint64_t aper_size; 646 __u64 aper_size;
647 647
648 /** 648 /**
649 * Available space in the aperture used by i915_gem_execbuffer, in 649 * Available space in the aperture used by i915_gem_execbuffer, in
650 * bytes 650 * bytes
651 */ 651 */
652 uint64_t aper_available_size; 652 __u64 aper_available_size;
653 }; 653 };
654 654
655 #endif /* _I915_DRM_H_ */ 655 #endif /* _I915_DRM_H_ */
656 656
include/drm/mga_drm.h
1 /* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- 1 /* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*-
2 * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com 2 * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com
3 * 3 *
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"), 9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation 10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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 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: 13 * Software is furnished to do so, subject to the following conditions:
14 * 14 *
15 * The above copyright notice and this permission notice (including the next 15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the 16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software. 17 * Software.
18 * 18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE. 25 * OTHER DEALINGS IN THE SOFTWARE.
26 * 26 *
27 * Authors: 27 * Authors:
28 * Jeff Hartmann <jhartmann@valinux.com> 28 * Jeff Hartmann <jhartmann@valinux.com>
29 * Keith Whitwell <keith@tungstengraphics.com> 29 * Keith Whitwell <keith@tungstengraphics.com>
30 * 30 *
31 * Rewritten by: 31 * Rewritten by:
32 * Gareth Hughes <gareth@valinux.com> 32 * Gareth Hughes <gareth@valinux.com>
33 */ 33 */
34 34
35 #ifndef __MGA_DRM_H__ 35 #ifndef __MGA_DRM_H__
36 #define __MGA_DRM_H__ 36 #define __MGA_DRM_H__
37 37
38 #include <linux/types.h>
39
38 /* WARNING: If you change any of these defines, make sure to change the 40 /* WARNING: If you change any of these defines, make sure to change the
39 * defines in the Xserver file (mga_sarea.h) 41 * defines in the Xserver file (mga_sarea.h)
40 */ 42 */
41 43
42 #ifndef __MGA_SAREA_DEFINES__ 44 #ifndef __MGA_SAREA_DEFINES__
43 #define __MGA_SAREA_DEFINES__ 45 #define __MGA_SAREA_DEFINES__
44 46
45 /* WARP pipe flags 47 /* WARP pipe flags
46 */ 48 */
47 #define MGA_F 0x1 /* fog */ 49 #define MGA_F 0x1 /* fog */
48 #define MGA_A 0x2 /* alpha */ 50 #define MGA_A 0x2 /* alpha */
49 #define MGA_S 0x4 /* specular */ 51 #define MGA_S 0x4 /* specular */
50 #define MGA_T2 0x8 /* multitexture */ 52 #define MGA_T2 0x8 /* multitexture */
51 53
52 #define MGA_WARP_TGZ 0 54 #define MGA_WARP_TGZ 0
53 #define MGA_WARP_TGZF (MGA_F) 55 #define MGA_WARP_TGZF (MGA_F)
54 #define MGA_WARP_TGZA (MGA_A) 56 #define MGA_WARP_TGZA (MGA_A)
55 #define MGA_WARP_TGZAF (MGA_F|MGA_A) 57 #define MGA_WARP_TGZAF (MGA_F|MGA_A)
56 #define MGA_WARP_TGZS (MGA_S) 58 #define MGA_WARP_TGZS (MGA_S)
57 #define MGA_WARP_TGZSF (MGA_S|MGA_F) 59 #define MGA_WARP_TGZSF (MGA_S|MGA_F)
58 #define MGA_WARP_TGZSA (MGA_S|MGA_A) 60 #define MGA_WARP_TGZSA (MGA_S|MGA_A)
59 #define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) 61 #define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A)
60 #define MGA_WARP_T2GZ (MGA_T2) 62 #define MGA_WARP_T2GZ (MGA_T2)
61 #define MGA_WARP_T2GZF (MGA_T2|MGA_F) 63 #define MGA_WARP_T2GZF (MGA_T2|MGA_F)
62 #define MGA_WARP_T2GZA (MGA_T2|MGA_A) 64 #define MGA_WARP_T2GZA (MGA_T2|MGA_A)
63 #define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) 65 #define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F)
64 #define MGA_WARP_T2GZS (MGA_T2|MGA_S) 66 #define MGA_WARP_T2GZS (MGA_T2|MGA_S)
65 #define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) 67 #define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F)
66 #define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) 68 #define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A)
67 #define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) 69 #define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A)
68 70
69 #define MGA_MAX_G200_PIPES 8 /* no multitex */ 71 #define MGA_MAX_G200_PIPES 8 /* no multitex */
70 #define MGA_MAX_G400_PIPES 16 72 #define MGA_MAX_G400_PIPES 16
71 #define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES 73 #define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES
72 #define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ 74 #define MGA_WARP_UCODE_SIZE 32768 /* in bytes */
73 75
74 #define MGA_CARD_TYPE_G200 1 76 #define MGA_CARD_TYPE_G200 1
75 #define MGA_CARD_TYPE_G400 2 77 #define MGA_CARD_TYPE_G400 2
76 #define MGA_CARD_TYPE_G450 3 /* not currently used */ 78 #define MGA_CARD_TYPE_G450 3 /* not currently used */
77 #define MGA_CARD_TYPE_G550 4 79 #define MGA_CARD_TYPE_G550 4
78 80
79 #define MGA_FRONT 0x1 81 #define MGA_FRONT 0x1
80 #define MGA_BACK 0x2 82 #define MGA_BACK 0x2
81 #define MGA_DEPTH 0x4 83 #define MGA_DEPTH 0x4
82 84
83 /* What needs to be changed for the current vertex dma buffer? 85 /* What needs to be changed for the current vertex dma buffer?
84 */ 86 */
85 #define MGA_UPLOAD_CONTEXT 0x1 87 #define MGA_UPLOAD_CONTEXT 0x1
86 #define MGA_UPLOAD_TEX0 0x2 88 #define MGA_UPLOAD_TEX0 0x2
87 #define MGA_UPLOAD_TEX1 0x4 89 #define MGA_UPLOAD_TEX1 0x4
88 #define MGA_UPLOAD_PIPE 0x8 90 #define MGA_UPLOAD_PIPE 0x8
89 #define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ 91 #define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */
90 #define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ 92 #define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */
91 #define MGA_UPLOAD_2D 0x40 93 #define MGA_UPLOAD_2D 0x40
92 #define MGA_WAIT_AGE 0x80 /* handled client-side */ 94 #define MGA_WAIT_AGE 0x80 /* handled client-side */
93 #define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ 95 #define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */
94 #if 0 96 #if 0
95 #define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock 97 #define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock
96 quiescent */ 98 quiescent */
97 #endif 99 #endif
98 100
99 /* 32 buffers of 64k each, total 2 meg. 101 /* 32 buffers of 64k each, total 2 meg.
100 */ 102 */
101 #define MGA_BUFFER_SIZE (1 << 16) 103 #define MGA_BUFFER_SIZE (1 << 16)
102 #define MGA_NUM_BUFFERS 128 104 #define MGA_NUM_BUFFERS 128
103 105
104 /* Keep these small for testing. 106 /* Keep these small for testing.
105 */ 107 */
106 #define MGA_NR_SAREA_CLIPRECTS 8 108 #define MGA_NR_SAREA_CLIPRECTS 8
107 109
108 /* 2 heaps (1 for card, 1 for agp), each divided into upto 128 110 /* 2 heaps (1 for card, 1 for agp), each divided into upto 128
109 * regions, subject to a minimum region size of (1<<16) == 64k. 111 * regions, subject to a minimum region size of (1<<16) == 64k.
110 * 112 *
111 * Clients may subdivide regions internally, but when sharing between 113 * Clients may subdivide regions internally, but when sharing between
112 * clients, the region size is the minimum granularity. 114 * clients, the region size is the minimum granularity.
113 */ 115 */
114 116
115 #define MGA_CARD_HEAP 0 117 #define MGA_CARD_HEAP 0
116 #define MGA_AGP_HEAP 1 118 #define MGA_AGP_HEAP 1
117 #define MGA_NR_TEX_HEAPS 2 119 #define MGA_NR_TEX_HEAPS 2
118 #define MGA_NR_TEX_REGIONS 16 120 #define MGA_NR_TEX_REGIONS 16
119 #define MGA_LOG_MIN_TEX_REGION_SIZE 16 121 #define MGA_LOG_MIN_TEX_REGION_SIZE 16
120 122
121 #define DRM_MGA_IDLE_RETRY 2048 123 #define DRM_MGA_IDLE_RETRY 2048
122 124
123 #endif /* __MGA_SAREA_DEFINES__ */ 125 #endif /* __MGA_SAREA_DEFINES__ */
124 126
125 /* Setup registers for 3D context 127 /* Setup registers for 3D context
126 */ 128 */
127 typedef struct { 129 typedef struct {
128 unsigned int dstorg; 130 unsigned int dstorg;
129 unsigned int maccess; 131 unsigned int maccess;
130 unsigned int plnwt; 132 unsigned int plnwt;
131 unsigned int dwgctl; 133 unsigned int dwgctl;
132 unsigned int alphactrl; 134 unsigned int alphactrl;
133 unsigned int fogcolor; 135 unsigned int fogcolor;
134 unsigned int wflag; 136 unsigned int wflag;
135 unsigned int tdualstage0; 137 unsigned int tdualstage0;
136 unsigned int tdualstage1; 138 unsigned int tdualstage1;
137 unsigned int fcol; 139 unsigned int fcol;
138 unsigned int stencil; 140 unsigned int stencil;
139 unsigned int stencilctl; 141 unsigned int stencilctl;
140 } drm_mga_context_regs_t; 142 } drm_mga_context_regs_t;
141 143
142 /* Setup registers for 2D, X server 144 /* Setup registers for 2D, X server
143 */ 145 */
144 typedef struct { 146 typedef struct {
145 unsigned int pitch; 147 unsigned int pitch;
146 } drm_mga_server_regs_t; 148 } drm_mga_server_regs_t;
147 149
148 /* Setup registers for each texture unit 150 /* Setup registers for each texture unit
149 */ 151 */
150 typedef struct { 152 typedef struct {
151 unsigned int texctl; 153 unsigned int texctl;
152 unsigned int texctl2; 154 unsigned int texctl2;
153 unsigned int texfilter; 155 unsigned int texfilter;
154 unsigned int texbordercol; 156 unsigned int texbordercol;
155 unsigned int texorg; 157 unsigned int texorg;
156 unsigned int texwidth; 158 unsigned int texwidth;
157 unsigned int texheight; 159 unsigned int texheight;
158 unsigned int texorg1; 160 unsigned int texorg1;
159 unsigned int texorg2; 161 unsigned int texorg2;
160 unsigned int texorg3; 162 unsigned int texorg3;
161 unsigned int texorg4; 163 unsigned int texorg4;
162 } drm_mga_texture_regs_t; 164 } drm_mga_texture_regs_t;
163 165
164 /* General aging mechanism 166 /* General aging mechanism
165 */ 167 */
166 typedef struct { 168 typedef struct {
167 unsigned int head; /* Position of head pointer */ 169 unsigned int head; /* Position of head pointer */
168 unsigned int wrap; /* Primary DMA wrap count */ 170 unsigned int wrap; /* Primary DMA wrap count */
169 } drm_mga_age_t; 171 } drm_mga_age_t;
170 172
171 typedef struct _drm_mga_sarea { 173 typedef struct _drm_mga_sarea {
172 /* The channel for communication of state information to the kernel 174 /* The channel for communication of state information to the kernel
173 * on firing a vertex dma buffer. 175 * on firing a vertex dma buffer.
174 */ 176 */
175 drm_mga_context_regs_t context_state; 177 drm_mga_context_regs_t context_state;
176 drm_mga_server_regs_t server_state; 178 drm_mga_server_regs_t server_state;
177 drm_mga_texture_regs_t tex_state[2]; 179 drm_mga_texture_regs_t tex_state[2];
178 unsigned int warp_pipe; 180 unsigned int warp_pipe;
179 unsigned int dirty; 181 unsigned int dirty;
180 unsigned int vertsize; 182 unsigned int vertsize;
181 183
182 /* The current cliprects, or a subset thereof. 184 /* The current cliprects, or a subset thereof.
183 */ 185 */
184 struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS]; 186 struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS];
185 unsigned int nbox; 187 unsigned int nbox;
186 188
187 /* Information about the most recently used 3d drawable. The 189 /* Information about the most recently used 3d drawable. The
188 * client fills in the req_* fields, the server fills in the 190 * client fills in the req_* fields, the server fills in the
189 * exported_ fields and puts the cliprects into boxes, above. 191 * exported_ fields and puts the cliprects into boxes, above.
190 * 192 *
191 * The client clears the exported_drawable field before 193 * The client clears the exported_drawable field before
192 * clobbering the boxes data. 194 * clobbering the boxes data.
193 */ 195 */
194 unsigned int req_drawable; /* the X drawable id */ 196 unsigned int req_drawable; /* the X drawable id */
195 unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ 197 unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */
196 198
197 unsigned int exported_drawable; 199 unsigned int exported_drawable;
198 unsigned int exported_index; 200 unsigned int exported_index;
199 unsigned int exported_stamp; 201 unsigned int exported_stamp;
200 unsigned int exported_buffers; 202 unsigned int exported_buffers;
201 unsigned int exported_nfront; 203 unsigned int exported_nfront;
202 unsigned int exported_nback; 204 unsigned int exported_nback;
203 int exported_back_x, exported_front_x, exported_w; 205 int exported_back_x, exported_front_x, exported_w;
204 int exported_back_y, exported_front_y, exported_h; 206 int exported_back_y, exported_front_y, exported_h;
205 struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS]; 207 struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS];
206 208
207 /* Counters for aging textures and for client-side throttling. 209 /* Counters for aging textures and for client-side throttling.
208 */ 210 */
209 unsigned int status[4]; 211 unsigned int status[4];
210 unsigned int last_wrap; 212 unsigned int last_wrap;
211 213
212 drm_mga_age_t last_frame; 214 drm_mga_age_t last_frame;
213 unsigned int last_enqueue; /* last time a buffer was enqueued */ 215 unsigned int last_enqueue; /* last time a buffer was enqueued */
214 unsigned int last_dispatch; /* age of the most recently dispatched buffer */ 216 unsigned int last_dispatch; /* age of the most recently dispatched buffer */
215 unsigned int last_quiescent; /* */ 217 unsigned int last_quiescent; /* */
216 218
217 /* LRU lists for texture memory in agp space and on the card. 219 /* LRU lists for texture memory in agp space and on the card.
218 */ 220 */
219 struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; 221 struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1];
220 unsigned int texAge[MGA_NR_TEX_HEAPS]; 222 unsigned int texAge[MGA_NR_TEX_HEAPS];
221 223
222 /* Mechanism to validate card state. 224 /* Mechanism to validate card state.
223 */ 225 */
224 int ctxOwner; 226 int ctxOwner;
225 } drm_mga_sarea_t; 227 } drm_mga_sarea_t;
226 228
227 /* MGA specific ioctls 229 /* MGA specific ioctls
228 * The device specific ioctl range is 0x40 to 0x79. 230 * The device specific ioctl range is 0x40 to 0x79.
229 */ 231 */
230 #define DRM_MGA_INIT 0x00 232 #define DRM_MGA_INIT 0x00
231 #define DRM_MGA_FLUSH 0x01 233 #define DRM_MGA_FLUSH 0x01
232 #define DRM_MGA_RESET 0x02 234 #define DRM_MGA_RESET 0x02
233 #define DRM_MGA_SWAP 0x03 235 #define DRM_MGA_SWAP 0x03
234 #define DRM_MGA_CLEAR 0x04 236 #define DRM_MGA_CLEAR 0x04
235 #define DRM_MGA_VERTEX 0x05 237 #define DRM_MGA_VERTEX 0x05
236 #define DRM_MGA_INDICES 0x06 238 #define DRM_MGA_INDICES 0x06
237 #define DRM_MGA_ILOAD 0x07 239 #define DRM_MGA_ILOAD 0x07
238 #define DRM_MGA_BLIT 0x08 240 #define DRM_MGA_BLIT 0x08
239 #define DRM_MGA_GETPARAM 0x09 241 #define DRM_MGA_GETPARAM 0x09
240 242
241 /* 3.2: 243 /* 3.2:
242 * ioctls for operating on fences. 244 * ioctls for operating on fences.
243 */ 245 */
244 #define DRM_MGA_SET_FENCE 0x0a 246 #define DRM_MGA_SET_FENCE 0x0a
245 #define DRM_MGA_WAIT_FENCE 0x0b 247 #define DRM_MGA_WAIT_FENCE 0x0b
246 #define DRM_MGA_DMA_BOOTSTRAP 0x0c 248 #define DRM_MGA_DMA_BOOTSTRAP 0x0c
247 249
248 #define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) 250 #define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t)
249 #define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t) 251 #define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t)
250 #define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) 252 #define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET)
251 #define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) 253 #define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP)
252 #define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) 254 #define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t)
253 #define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t) 255 #define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t)
254 #define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t) 256 #define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t)
255 #define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) 257 #define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t)
256 #define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) 258 #define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t)
257 #define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) 259 #define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t)
258 #define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, uint32_t) 260 #define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32)
259 #define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, uint32_t) 261 #define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32)
260 #define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) 262 #define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t)
261 263
262 typedef struct _drm_mga_warp_index { 264 typedef struct _drm_mga_warp_index {
263 int installed; 265 int installed;
264 unsigned long phys_addr; 266 unsigned long phys_addr;
265 int size; 267 int size;
266 } drm_mga_warp_index_t; 268 } drm_mga_warp_index_t;
267 269
268 typedef struct drm_mga_init { 270 typedef struct drm_mga_init {
269 enum { 271 enum {
270 MGA_INIT_DMA = 0x01, 272 MGA_INIT_DMA = 0x01,
271 MGA_CLEANUP_DMA = 0x02 273 MGA_CLEANUP_DMA = 0x02
272 } func; 274 } func;
273 275
274 unsigned long sarea_priv_offset; 276 unsigned long sarea_priv_offset;
275 277
276 int chipset; 278 int chipset;
277 int sgram; 279 int sgram;
278 280
279 unsigned int maccess; 281 unsigned int maccess;
280 282
281 unsigned int fb_cpp; 283 unsigned int fb_cpp;
282 unsigned int front_offset, front_pitch; 284 unsigned int front_offset, front_pitch;
283 unsigned int back_offset, back_pitch; 285 unsigned int back_offset, back_pitch;
284 286
285 unsigned int depth_cpp; 287 unsigned int depth_cpp;
286 unsigned int depth_offset, depth_pitch; 288 unsigned int depth_offset, depth_pitch;
287 289
288 unsigned int texture_offset[MGA_NR_TEX_HEAPS]; 290 unsigned int texture_offset[MGA_NR_TEX_HEAPS];
289 unsigned int texture_size[MGA_NR_TEX_HEAPS]; 291 unsigned int texture_size[MGA_NR_TEX_HEAPS];
290 292
291 unsigned long fb_offset; 293 unsigned long fb_offset;
292 unsigned long mmio_offset; 294 unsigned long mmio_offset;
293 unsigned long status_offset; 295 unsigned long status_offset;
294 unsigned long warp_offset; 296 unsigned long warp_offset;
295 unsigned long primary_offset; 297 unsigned long primary_offset;
296 unsigned long buffers_offset; 298 unsigned long buffers_offset;
297 } drm_mga_init_t; 299 } drm_mga_init_t;
298 300
299 typedef struct drm_mga_dma_bootstrap { 301 typedef struct drm_mga_dma_bootstrap {
300 /** 302 /**
301 * \name AGP texture region 303 * \name AGP texture region
302 * 304 *
303 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will 305 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will
304 * be filled in with the actual AGP texture settings. 306 * be filled in with the actual AGP texture settings.
305 * 307 *
306 * \warning 308 * \warning
307 * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode 309 * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode
308 * is zero, it means that PCI memory (most likely through the use of 310 * is zero, it means that PCI memory (most likely through the use of
309 * an IOMMU) is being used for "AGP" textures. 311 * an IOMMU) is being used for "AGP" textures.
310 */ 312 */
311 /*@{ */ 313 /*@{ */
312 unsigned long texture_handle; /**< Handle used to map AGP textures. */ 314 unsigned long texture_handle; /**< Handle used to map AGP textures. */
313 uint32_t texture_size; /**< Size of the AGP texture region. */ 315 __u32 texture_size; /**< Size of the AGP texture region. */
314 /*@} */ 316 /*@} */
315 317
316 /** 318 /**
317 * Requested size of the primary DMA region. 319 * Requested size of the primary DMA region.
318 * 320 *
319 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 321 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be
320 * filled in with the actual AGP mode. If AGP was not available 322 * filled in with the actual AGP mode. If AGP was not available
321 */ 323 */
322 uint32_t primary_size; 324 __u32 primary_size;
323 325
324 /** 326 /**
325 * Requested number of secondary DMA buffers. 327 * Requested number of secondary DMA buffers.
326 * 328 *
327 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 329 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be
328 * filled in with the actual number of secondary DMA buffers 330 * filled in with the actual number of secondary DMA buffers
329 * allocated. Particularly when PCI DMA is used, this may be 331 * allocated. Particularly when PCI DMA is used, this may be
330 * (subtantially) less than the number requested. 332 * (subtantially) less than the number requested.
331 */ 333 */
332 uint32_t secondary_bin_count; 334 __u32 secondary_bin_count;
333 335
334 /** 336 /**
335 * Requested size of each secondary DMA buffer. 337 * Requested size of each secondary DMA buffer.
336 * 338 *
337 * While the kernel \b is free to reduce 339 * While the kernel \b is free to reduce
338 * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed 340 * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed
339 * to reduce dma_mga_dma_bootstrap::secondary_bin_size. 341 * to reduce dma_mga_dma_bootstrap::secondary_bin_size.
340 */ 342 */
341 uint32_t secondary_bin_size; 343 __u32 secondary_bin_size;
342 344
343 /** 345 /**
344 * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, 346 * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X,
345 * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is 347 * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is
346 * zero, it means that PCI DMA should be used, even if AGP is 348 * zero, it means that PCI DMA should be used, even if AGP is
347 * possible. 349 * possible.
348 * 350 *
349 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 351 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be
350 * filled in with the actual AGP mode. If AGP was not available 352 * filled in with the actual AGP mode. If AGP was not available
351 * (i.e., PCI DMA was used), this value will be zero. 353 * (i.e., PCI DMA was used), this value will be zero.
352 */ 354 */
353 uint32_t agp_mode; 355 __u32 agp_mode;
354 356
355 /** 357 /**
356 * Desired AGP GART size, measured in megabytes. 358 * Desired AGP GART size, measured in megabytes.
357 */ 359 */
358 uint8_t agp_size; 360 __u8 agp_size;
359 } drm_mga_dma_bootstrap_t; 361 } drm_mga_dma_bootstrap_t;
360 362
361 typedef struct drm_mga_clear { 363 typedef struct drm_mga_clear {
362 unsigned int flags; 364 unsigned int flags;
363 unsigned int clear_color; 365 unsigned int clear_color;
364 unsigned int clear_depth; 366 unsigned int clear_depth;
365 unsigned int color_mask; 367 unsigned int color_mask;
366 unsigned int depth_mask; 368 unsigned int depth_mask;
367 } drm_mga_clear_t; 369 } drm_mga_clear_t;
368 370
369 typedef struct drm_mga_vertex { 371 typedef struct drm_mga_vertex {
370 int idx; /* buffer to queue */ 372 int idx; /* buffer to queue */
371 int used; /* bytes in use */ 373 int used; /* bytes in use */
372 int discard; /* client finished with buffer? */ 374 int discard; /* client finished with buffer? */
373 } drm_mga_vertex_t; 375 } drm_mga_vertex_t;
374 376
375 typedef struct drm_mga_indices { 377 typedef struct drm_mga_indices {
376 int idx; /* buffer to queue */ 378 int idx; /* buffer to queue */
377 unsigned int start; 379 unsigned int start;
378 unsigned int end; 380 unsigned int end;
379 int discard; /* client finished with buffer? */ 381 int discard; /* client finished with buffer? */
380 } drm_mga_indices_t; 382 } drm_mga_indices_t;
381 383
382 typedef struct drm_mga_iload { 384 typedef struct drm_mga_iload {
383 int idx; 385 int idx;
384 unsigned int dstorg; 386 unsigned int dstorg;
385 unsigned int length; 387 unsigned int length;
386 } drm_mga_iload_t; 388 } drm_mga_iload_t;
387 389
388 typedef struct _drm_mga_blit { 390 typedef struct _drm_mga_blit {
389 unsigned int planemask; 391 unsigned int planemask;
390 unsigned int srcorg; 392 unsigned int srcorg;
391 unsigned int dstorg; 393 unsigned int dstorg;
392 int src_pitch, dst_pitch; 394 int src_pitch, dst_pitch;
393 int delta_sx, delta_sy; 395 int delta_sx, delta_sy;
394 int delta_dx, delta_dy; 396 int delta_dx, delta_dy;
395 int height, ydir; /* flip image vertically */ 397 int height, ydir; /* flip image vertically */
396 int source_pitch, dest_pitch; 398 int source_pitch, dest_pitch;
397 } drm_mga_blit_t; 399 } drm_mga_blit_t;
398 400
399 /* 3.1: An ioctl to get parameters that aren't available to the 3d 401 /* 3.1: An ioctl to get parameters that aren't available to the 3d
400 * client any other way. 402 * client any other way.
401 */ 403 */
402 #define MGA_PARAM_IRQ_NR 1 404 #define MGA_PARAM_IRQ_NR 1
403 405
404 /* 3.2: Query the actual card type. The DDX only distinguishes between 406 /* 3.2: Query the actual card type. The DDX only distinguishes between
405 * G200 chips and non-G200 chips, which it calls G400. It turns out that 407 * G200 chips and non-G200 chips, which it calls G400. It turns out that
406 * there are some very sublte differences between the G4x0 chips and the G550 408 * there are some very sublte differences between the G4x0 chips and the G550
407 * chips. Using this parameter query, a client-side driver can detect the 409 * chips. Using this parameter query, a client-side driver can detect the
408 * difference between a G4x0 and a G550. 410 * difference between a G4x0 and a G550.
409 */ 411 */
410 #define MGA_PARAM_CARD_TYPE 2 412 #define MGA_PARAM_CARD_TYPE 2
411 413
412 typedef struct drm_mga_getparam { 414 typedef struct drm_mga_getparam {
413 int param; 415 int param;
414 void __user *value; 416 void __user *value;
415 } drm_mga_getparam_t; 417 } drm_mga_getparam_t;
416 418
417 #endif 419 #endif
418 420
include/drm/radeon_drm.h
1 /* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- 1 /* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*-
2 * 2 *
3 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
4 * Copyright 2000 VA Linux Systems, Inc., Fremont, California. 4 * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
5 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"), 9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation 10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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 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: 13 * Software is furnished to do so, subject to the following conditions:
14 * 14 *
15 * The above copyright notice and this permission notice (including the next 15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the 16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software. 17 * Software.
18 * 18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 22 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE. 25 * DEALINGS IN THE SOFTWARE.
26 * 26 *
27 * Authors: 27 * Authors:
28 * Kevin E. Martin <martin@valinux.com> 28 * Kevin E. Martin <martin@valinux.com>
29 * Gareth Hughes <gareth@valinux.com> 29 * Gareth Hughes <gareth@valinux.com>
30 * Keith Whitwell <keith@tungstengraphics.com> 30 * Keith Whitwell <keith@tungstengraphics.com>
31 */ 31 */
32 32
33 #ifndef __RADEON_DRM_H__ 33 #ifndef __RADEON_DRM_H__
34 #define __RADEON_DRM_H__ 34 #define __RADEON_DRM_H__
35 35
36 #include <linux/types.h>
37
36 /* WARNING: If you change any of these defines, make sure to change the 38 /* WARNING: If you change any of these defines, make sure to change the
37 * defines in the X server file (radeon_sarea.h) 39 * defines in the X server file (radeon_sarea.h)
38 */ 40 */
39 #ifndef __RADEON_SAREA_DEFINES__ 41 #ifndef __RADEON_SAREA_DEFINES__
40 #define __RADEON_SAREA_DEFINES__ 42 #define __RADEON_SAREA_DEFINES__
41 43
42 /* Old style state flags, required for sarea interface (1.1 and 1.2 44 /* Old style state flags, required for sarea interface (1.1 and 1.2
43 * clears) and 1.2 drm_vertex2 ioctl. 45 * clears) and 1.2 drm_vertex2 ioctl.
44 */ 46 */
45 #define RADEON_UPLOAD_CONTEXT 0x00000001 47 #define RADEON_UPLOAD_CONTEXT 0x00000001
46 #define RADEON_UPLOAD_VERTFMT 0x00000002 48 #define RADEON_UPLOAD_VERTFMT 0x00000002
47 #define RADEON_UPLOAD_LINE 0x00000004 49 #define RADEON_UPLOAD_LINE 0x00000004
48 #define RADEON_UPLOAD_BUMPMAP 0x00000008 50 #define RADEON_UPLOAD_BUMPMAP 0x00000008
49 #define RADEON_UPLOAD_MASKS 0x00000010 51 #define RADEON_UPLOAD_MASKS 0x00000010
50 #define RADEON_UPLOAD_VIEWPORT 0x00000020 52 #define RADEON_UPLOAD_VIEWPORT 0x00000020
51 #define RADEON_UPLOAD_SETUP 0x00000040 53 #define RADEON_UPLOAD_SETUP 0x00000040
52 #define RADEON_UPLOAD_TCL 0x00000080 54 #define RADEON_UPLOAD_TCL 0x00000080
53 #define RADEON_UPLOAD_MISC 0x00000100 55 #define RADEON_UPLOAD_MISC 0x00000100
54 #define RADEON_UPLOAD_TEX0 0x00000200 56 #define RADEON_UPLOAD_TEX0 0x00000200
55 #define RADEON_UPLOAD_TEX1 0x00000400 57 #define RADEON_UPLOAD_TEX1 0x00000400
56 #define RADEON_UPLOAD_TEX2 0x00000800 58 #define RADEON_UPLOAD_TEX2 0x00000800
57 #define RADEON_UPLOAD_TEX0IMAGES 0x00001000 59 #define RADEON_UPLOAD_TEX0IMAGES 0x00001000
58 #define RADEON_UPLOAD_TEX1IMAGES 0x00002000 60 #define RADEON_UPLOAD_TEX1IMAGES 0x00002000
59 #define RADEON_UPLOAD_TEX2IMAGES 0x00004000 61 #define RADEON_UPLOAD_TEX2IMAGES 0x00004000
60 #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ 62 #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
61 #define RADEON_REQUIRE_QUIESCENCE 0x00010000 63 #define RADEON_REQUIRE_QUIESCENCE 0x00010000
62 #define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */ 64 #define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */
63 #define RADEON_UPLOAD_ALL 0x003effff 65 #define RADEON_UPLOAD_ALL 0x003effff
64 #define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff 66 #define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff
65 67
66 /* New style per-packet identifiers for use in cmd_buffer ioctl with 68 /* New style per-packet identifiers for use in cmd_buffer ioctl with
67 * the RADEON_EMIT_PACKET command. Comments relate new packets to old 69 * the RADEON_EMIT_PACKET command. Comments relate new packets to old
68 * state bits and the packet size: 70 * state bits and the packet size:
69 */ 71 */
70 #define RADEON_EMIT_PP_MISC 0 /* context/7 */ 72 #define RADEON_EMIT_PP_MISC 0 /* context/7 */
71 #define RADEON_EMIT_PP_CNTL 1 /* context/3 */ 73 #define RADEON_EMIT_PP_CNTL 1 /* context/3 */
72 #define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ 74 #define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */
73 #define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ 75 #define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */
74 #define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ 76 #define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */
75 #define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ 77 #define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */
76 #define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ 78 #define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */
77 #define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ 79 #define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */
78 #define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ 80 #define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */
79 #define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ 81 #define RADEON_EMIT_SE_CNTL 9 /* setup/2 */
80 #define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ 82 #define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */
81 #define RADEON_EMIT_RE_MISC 11 /* misc/1 */ 83 #define RADEON_EMIT_RE_MISC 11 /* misc/1 */
82 #define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ 84 #define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */
83 #define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ 85 #define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */
84 #define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ 86 #define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */
85 #define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ 87 #define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */
86 #define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ 88 #define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */
87 #define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ 89 #define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */
88 #define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ 90 #define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */
89 #define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ 91 #define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */
90 #define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ 92 #define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */
91 #define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ 93 #define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */
92 #define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ 94 #define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */
93 #define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ 95 #define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */
94 #define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ 96 #define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */
95 #define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ 97 #define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */
96 #define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ 98 #define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */
97 #define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ 99 #define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */
98 #define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ 100 #define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */
99 #define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */ 101 #define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */
100 #define R200_EMIT_TFACTOR_0 30 /* tf/7 */ 102 #define R200_EMIT_TFACTOR_0 30 /* tf/7 */
101 #define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */ 103 #define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */
102 #define R200_EMIT_VAP_CTL 32 /* vap/1 */ 104 #define R200_EMIT_VAP_CTL 32 /* vap/1 */
103 #define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ 105 #define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */
104 #define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ 106 #define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */
105 #define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ 107 #define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */
106 #define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ 108 #define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */
107 #define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ 109 #define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */
108 #define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ 110 #define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */
109 #define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ 111 #define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */
110 #define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ 112 #define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */
111 #define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ 113 #define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */
112 #define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ 114 #define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */
113 #define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ 115 #define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */
114 #define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ 116 #define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */
115 #define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ 117 #define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */
116 #define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ 118 #define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */
117 #define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ 119 #define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */
118 #define R200_EMIT_VTE_CNTL 48 /* vte/1 */ 120 #define R200_EMIT_VTE_CNTL 48 /* vte/1 */
119 #define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ 121 #define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */
120 #define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ 122 #define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */
121 #define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ 123 #define R200_EMIT_PP_CNTL_X 51 /* cst/1 */
122 #define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ 124 #define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */
123 #define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ 125 #define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */
124 #define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ 126 #define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */
125 #define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ 127 #define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */
126 #define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ 128 #define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */
127 #define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ 129 #define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */
128 #define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ 130 #define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */
129 #define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ 131 #define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */
130 #define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ 132 #define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */
131 #define R200_EMIT_PP_CUBIC_FACES_0 61 133 #define R200_EMIT_PP_CUBIC_FACES_0 61
132 #define R200_EMIT_PP_CUBIC_OFFSETS_0 62 134 #define R200_EMIT_PP_CUBIC_OFFSETS_0 62
133 #define R200_EMIT_PP_CUBIC_FACES_1 63 135 #define R200_EMIT_PP_CUBIC_FACES_1 63
134 #define R200_EMIT_PP_CUBIC_OFFSETS_1 64 136 #define R200_EMIT_PP_CUBIC_OFFSETS_1 64
135 #define R200_EMIT_PP_CUBIC_FACES_2 65 137 #define R200_EMIT_PP_CUBIC_FACES_2 65
136 #define R200_EMIT_PP_CUBIC_OFFSETS_2 66 138 #define R200_EMIT_PP_CUBIC_OFFSETS_2 66
137 #define R200_EMIT_PP_CUBIC_FACES_3 67 139 #define R200_EMIT_PP_CUBIC_FACES_3 67
138 #define R200_EMIT_PP_CUBIC_OFFSETS_3 68 140 #define R200_EMIT_PP_CUBIC_OFFSETS_3 68
139 #define R200_EMIT_PP_CUBIC_FACES_4 69 141 #define R200_EMIT_PP_CUBIC_FACES_4 69
140 #define R200_EMIT_PP_CUBIC_OFFSETS_4 70 142 #define R200_EMIT_PP_CUBIC_OFFSETS_4 70
141 #define R200_EMIT_PP_CUBIC_FACES_5 71 143 #define R200_EMIT_PP_CUBIC_FACES_5 71
142 #define R200_EMIT_PP_CUBIC_OFFSETS_5 72 144 #define R200_EMIT_PP_CUBIC_OFFSETS_5 72
143 #define RADEON_EMIT_PP_TEX_SIZE_0 73 145 #define RADEON_EMIT_PP_TEX_SIZE_0 73
144 #define RADEON_EMIT_PP_TEX_SIZE_1 74 146 #define RADEON_EMIT_PP_TEX_SIZE_1 74
145 #define RADEON_EMIT_PP_TEX_SIZE_2 75 147 #define RADEON_EMIT_PP_TEX_SIZE_2 75
146 #define R200_EMIT_RB3D_BLENDCOLOR 76 148 #define R200_EMIT_RB3D_BLENDCOLOR 76
147 #define R200_EMIT_TCL_POINT_SPRITE_CNTL 77 149 #define R200_EMIT_TCL_POINT_SPRITE_CNTL 77
148 #define RADEON_EMIT_PP_CUBIC_FACES_0 78 150 #define RADEON_EMIT_PP_CUBIC_FACES_0 78
149 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79 151 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79
150 #define RADEON_EMIT_PP_CUBIC_FACES_1 80 152 #define RADEON_EMIT_PP_CUBIC_FACES_1 80
151 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81 153 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81
152 #define RADEON_EMIT_PP_CUBIC_FACES_2 82 154 #define RADEON_EMIT_PP_CUBIC_FACES_2 82
153 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83 155 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83
154 #define R200_EMIT_PP_TRI_PERF_CNTL 84 156 #define R200_EMIT_PP_TRI_PERF_CNTL 84
155 #define R200_EMIT_PP_AFS_0 85 157 #define R200_EMIT_PP_AFS_0 85
156 #define R200_EMIT_PP_AFS_1 86 158 #define R200_EMIT_PP_AFS_1 86
157 #define R200_EMIT_ATF_TFACTOR 87 159 #define R200_EMIT_ATF_TFACTOR 87
158 #define R200_EMIT_PP_TXCTLALL_0 88 160 #define R200_EMIT_PP_TXCTLALL_0 88
159 #define R200_EMIT_PP_TXCTLALL_1 89 161 #define R200_EMIT_PP_TXCTLALL_1 89
160 #define R200_EMIT_PP_TXCTLALL_2 90 162 #define R200_EMIT_PP_TXCTLALL_2 90
161 #define R200_EMIT_PP_TXCTLALL_3 91 163 #define R200_EMIT_PP_TXCTLALL_3 91
162 #define R200_EMIT_PP_TXCTLALL_4 92 164 #define R200_EMIT_PP_TXCTLALL_4 92
163 #define R200_EMIT_PP_TXCTLALL_5 93 165 #define R200_EMIT_PP_TXCTLALL_5 93
164 #define R200_EMIT_VAP_PVS_CNTL 94 166 #define R200_EMIT_VAP_PVS_CNTL 94
165 #define RADEON_MAX_STATE_PACKETS 95 167 #define RADEON_MAX_STATE_PACKETS 95
166 168
167 /* Commands understood by cmd_buffer ioctl. More can be added but 169 /* Commands understood by cmd_buffer ioctl. More can be added but
168 * obviously these can't be removed or changed: 170 * obviously these can't be removed or changed:
169 */ 171 */
170 #define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ 172 #define RADEON_CMD_PACKET 1 /* emit one of the register packets above */
171 #define RADEON_CMD_SCALARS 2 /* emit scalar data */ 173 #define RADEON_CMD_SCALARS 2 /* emit scalar data */
172 #define RADEON_CMD_VECTORS 3 /* emit vector data */ 174 #define RADEON_CMD_VECTORS 3 /* emit vector data */
173 #define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ 175 #define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */
174 #define RADEON_CMD_PACKET3 5 /* emit hw packet */ 176 #define RADEON_CMD_PACKET3 5 /* emit hw packet */
175 #define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ 177 #define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */
176 #define RADEON_CMD_SCALARS2 7 /* r200 stopgap */ 178 #define RADEON_CMD_SCALARS2 7 /* r200 stopgap */
177 #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: 179 #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note:
178 * doesn't make the cpu wait, just 180 * doesn't make the cpu wait, just
179 * the graphics hardware */ 181 * the graphics hardware */
180 #define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */ 182 #define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */
181 183
182 typedef union { 184 typedef union {
183 int i; 185 int i;
184 struct { 186 struct {
185 unsigned char cmd_type, pad0, pad1, pad2; 187 unsigned char cmd_type, pad0, pad1, pad2;
186 } header; 188 } header;
187 struct { 189 struct {
188 unsigned char cmd_type, packet_id, pad0, pad1; 190 unsigned char cmd_type, packet_id, pad0, pad1;
189 } packet; 191 } packet;
190 struct { 192 struct {
191 unsigned char cmd_type, offset, stride, count; 193 unsigned char cmd_type, offset, stride, count;
192 } scalars; 194 } scalars;
193 struct { 195 struct {
194 unsigned char cmd_type, offset, stride, count; 196 unsigned char cmd_type, offset, stride, count;
195 } vectors; 197 } vectors;
196 struct { 198 struct {
197 unsigned char cmd_type, addr_lo, addr_hi, count; 199 unsigned char cmd_type, addr_lo, addr_hi, count;
198 } veclinear; 200 } veclinear;
199 struct { 201 struct {
200 unsigned char cmd_type, buf_idx, pad0, pad1; 202 unsigned char cmd_type, buf_idx, pad0, pad1;
201 } dma; 203 } dma;
202 struct { 204 struct {
203 unsigned char cmd_type, flags, pad0, pad1; 205 unsigned char cmd_type, flags, pad0, pad1;
204 } wait; 206 } wait;
205 } drm_radeon_cmd_header_t; 207 } drm_radeon_cmd_header_t;
206 208
207 #define RADEON_WAIT_2D 0x1 209 #define RADEON_WAIT_2D 0x1
208 #define RADEON_WAIT_3D 0x2 210 #define RADEON_WAIT_3D 0x2
209 211
210 /* Allowed parameters for R300_CMD_PACKET3 212 /* Allowed parameters for R300_CMD_PACKET3
211 */ 213 */
212 #define R300_CMD_PACKET3_CLEAR 0 214 #define R300_CMD_PACKET3_CLEAR 0
213 #define R300_CMD_PACKET3_RAW 1 215 #define R300_CMD_PACKET3_RAW 1
214 216
215 /* Commands understood by cmd_buffer ioctl for R300. 217 /* Commands understood by cmd_buffer ioctl for R300.
216 * The interface has not been stabilized, so some of these may be removed 218 * The interface has not been stabilized, so some of these may be removed
217 * and eventually reordered before stabilization. 219 * and eventually reordered before stabilization.
218 */ 220 */
219 #define R300_CMD_PACKET0 1 221 #define R300_CMD_PACKET0 1
220 #define R300_CMD_VPU 2 /* emit vertex program upload */ 222 #define R300_CMD_VPU 2 /* emit vertex program upload */
221 #define R300_CMD_PACKET3 3 /* emit a packet3 */ 223 #define R300_CMD_PACKET3 3 /* emit a packet3 */
222 #define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */ 224 #define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */
223 #define R300_CMD_CP_DELAY 5 225 #define R300_CMD_CP_DELAY 5
224 #define R300_CMD_DMA_DISCARD 6 226 #define R300_CMD_DMA_DISCARD 6
225 #define R300_CMD_WAIT 7 227 #define R300_CMD_WAIT 7
226 # define R300_WAIT_2D 0x1 228 # define R300_WAIT_2D 0x1
227 # define R300_WAIT_3D 0x2 229 # define R300_WAIT_3D 0x2
228 /* these two defines are DOING IT WRONG - however 230 /* these two defines are DOING IT WRONG - however
229 * we have userspace which relies on using these. 231 * we have userspace which relies on using these.
230 * The wait interface is backwards compat new 232 * The wait interface is backwards compat new
231 * code should use the NEW_WAIT defines below 233 * code should use the NEW_WAIT defines below
232 * THESE ARE NOT BIT FIELDS 234 * THESE ARE NOT BIT FIELDS
233 */ 235 */
234 # define R300_WAIT_2D_CLEAN 0x3 236 # define R300_WAIT_2D_CLEAN 0x3
235 # define R300_WAIT_3D_CLEAN 0x4 237 # define R300_WAIT_3D_CLEAN 0x4
236 238
237 # define R300_NEW_WAIT_2D_3D 0x3 239 # define R300_NEW_WAIT_2D_3D 0x3
238 # define R300_NEW_WAIT_2D_2D_CLEAN 0x4 240 # define R300_NEW_WAIT_2D_2D_CLEAN 0x4
239 # define R300_NEW_WAIT_3D_3D_CLEAN 0x6 241 # define R300_NEW_WAIT_3D_3D_CLEAN 0x6
240 # define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8 242 # define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8
241 243
242 #define R300_CMD_SCRATCH 8 244 #define R300_CMD_SCRATCH 8
243 #define R300_CMD_R500FP 9 245 #define R300_CMD_R500FP 9
244 246
245 typedef union { 247 typedef union {
246 unsigned int u; 248 unsigned int u;
247 struct { 249 struct {
248 unsigned char cmd_type, pad0, pad1, pad2; 250 unsigned char cmd_type, pad0, pad1, pad2;
249 } header; 251 } header;
250 struct { 252 struct {
251 unsigned char cmd_type, count, reglo, reghi; 253 unsigned char cmd_type, count, reglo, reghi;
252 } packet0; 254 } packet0;
253 struct { 255 struct {
254 unsigned char cmd_type, count, adrlo, adrhi; 256 unsigned char cmd_type, count, adrlo, adrhi;
255 } vpu; 257 } vpu;
256 struct { 258 struct {
257 unsigned char cmd_type, packet, pad0, pad1; 259 unsigned char cmd_type, packet, pad0, pad1;
258 } packet3; 260 } packet3;
259 struct { 261 struct {
260 unsigned char cmd_type, packet; 262 unsigned char cmd_type, packet;
261 unsigned short count; /* amount of packet2 to emit */ 263 unsigned short count; /* amount of packet2 to emit */
262 } delay; 264 } delay;
263 struct { 265 struct {
264 unsigned char cmd_type, buf_idx, pad0, pad1; 266 unsigned char cmd_type, buf_idx, pad0, pad1;
265 } dma; 267 } dma;
266 struct { 268 struct {
267 unsigned char cmd_type, flags, pad0, pad1; 269 unsigned char cmd_type, flags, pad0, pad1;
268 } wait; 270 } wait;
269 struct { 271 struct {
270 unsigned char cmd_type, reg, n_bufs, flags; 272 unsigned char cmd_type, reg, n_bufs, flags;
271 } scratch; 273 } scratch;
272 struct { 274 struct {
273 unsigned char cmd_type, count, adrlo, adrhi_flags; 275 unsigned char cmd_type, count, adrlo, adrhi_flags;
274 } r500fp; 276 } r500fp;
275 } drm_r300_cmd_header_t; 277 } drm_r300_cmd_header_t;
276 278
277 #define RADEON_FRONT 0x1 279 #define RADEON_FRONT 0x1
278 #define RADEON_BACK 0x2 280 #define RADEON_BACK 0x2
279 #define RADEON_DEPTH 0x4 281 #define RADEON_DEPTH 0x4
280 #define RADEON_STENCIL 0x8 282 #define RADEON_STENCIL 0x8
281 #define RADEON_CLEAR_FASTZ 0x80000000 283 #define RADEON_CLEAR_FASTZ 0x80000000
282 #define RADEON_USE_HIERZ 0x40000000 284 #define RADEON_USE_HIERZ 0x40000000
283 #define RADEON_USE_COMP_ZBUF 0x20000000 285 #define RADEON_USE_COMP_ZBUF 0x20000000
284 286
285 #define R500FP_CONSTANT_TYPE (1 << 1) 287 #define R500FP_CONSTANT_TYPE (1 << 1)
286 #define R500FP_CONSTANT_CLAMP (1 << 2) 288 #define R500FP_CONSTANT_CLAMP (1 << 2)
287 289
288 /* Primitive types 290 /* Primitive types
289 */ 291 */
290 #define RADEON_POINTS 0x1 292 #define RADEON_POINTS 0x1
291 #define RADEON_LINES 0x2 293 #define RADEON_LINES 0x2
292 #define RADEON_LINE_STRIP 0x3 294 #define RADEON_LINE_STRIP 0x3
293 #define RADEON_TRIANGLES 0x4 295 #define RADEON_TRIANGLES 0x4
294 #define RADEON_TRIANGLE_FAN 0x5 296 #define RADEON_TRIANGLE_FAN 0x5
295 #define RADEON_TRIANGLE_STRIP 0x6 297 #define RADEON_TRIANGLE_STRIP 0x6
296 298
297 /* Vertex/indirect buffer size 299 /* Vertex/indirect buffer size
298 */ 300 */
299 #define RADEON_BUFFER_SIZE 65536 301 #define RADEON_BUFFER_SIZE 65536
300 302
301 /* Byte offsets for indirect buffer data 303 /* Byte offsets for indirect buffer data
302 */ 304 */
303 #define RADEON_INDEX_PRIM_OFFSET 20 305 #define RADEON_INDEX_PRIM_OFFSET 20
304 306
305 #define RADEON_SCRATCH_REG_OFFSET 32 307 #define RADEON_SCRATCH_REG_OFFSET 32
306 308
307 #define RADEON_NR_SAREA_CLIPRECTS 12 309 #define RADEON_NR_SAREA_CLIPRECTS 12
308 310
309 /* There are 2 heaps (local/GART). Each region within a heap is a 311 /* There are 2 heaps (local/GART). Each region within a heap is a
310 * minimum of 64k, and there are at most 64 of them per heap. 312 * minimum of 64k, and there are at most 64 of them per heap.
311 */ 313 */
312 #define RADEON_LOCAL_TEX_HEAP 0 314 #define RADEON_LOCAL_TEX_HEAP 0
313 #define RADEON_GART_TEX_HEAP 1 315 #define RADEON_GART_TEX_HEAP 1
314 #define RADEON_NR_TEX_HEAPS 2 316 #define RADEON_NR_TEX_HEAPS 2
315 #define RADEON_NR_TEX_REGIONS 64 317 #define RADEON_NR_TEX_REGIONS 64
316 #define RADEON_LOG_TEX_GRANULARITY 16 318 #define RADEON_LOG_TEX_GRANULARITY 16
317 319
318 #define RADEON_MAX_TEXTURE_LEVELS 12 320 #define RADEON_MAX_TEXTURE_LEVELS 12
319 #define RADEON_MAX_TEXTURE_UNITS 3 321 #define RADEON_MAX_TEXTURE_UNITS 3
320 322
321 #define RADEON_MAX_SURFACES 8 323 #define RADEON_MAX_SURFACES 8
322 324
323 /* Blits have strict offset rules. All blit offset must be aligned on 325 /* Blits have strict offset rules. All blit offset must be aligned on
324 * a 1K-byte boundary. 326 * a 1K-byte boundary.
325 */ 327 */
326 #define RADEON_OFFSET_SHIFT 10 328 #define RADEON_OFFSET_SHIFT 10
327 #define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) 329 #define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT)
328 #define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) 330 #define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1)
329 331
330 #endif /* __RADEON_SAREA_DEFINES__ */ 332 #endif /* __RADEON_SAREA_DEFINES__ */
331 333
332 typedef struct { 334 typedef struct {
333 unsigned int red; 335 unsigned int red;
334 unsigned int green; 336 unsigned int green;
335 unsigned int blue; 337 unsigned int blue;
336 unsigned int alpha; 338 unsigned int alpha;
337 } radeon_color_regs_t; 339 } radeon_color_regs_t;
338 340
339 typedef struct { 341 typedef struct {
340 /* Context state */ 342 /* Context state */
341 unsigned int pp_misc; /* 0x1c14 */ 343 unsigned int pp_misc; /* 0x1c14 */
342 unsigned int pp_fog_color; 344 unsigned int pp_fog_color;
343 unsigned int re_solid_color; 345 unsigned int re_solid_color;
344 unsigned int rb3d_blendcntl; 346 unsigned int rb3d_blendcntl;
345 unsigned int rb3d_depthoffset; 347 unsigned int rb3d_depthoffset;
346 unsigned int rb3d_depthpitch; 348 unsigned int rb3d_depthpitch;
347 unsigned int rb3d_zstencilcntl; 349 unsigned int rb3d_zstencilcntl;
348 350
349 unsigned int pp_cntl; /* 0x1c38 */ 351 unsigned int pp_cntl; /* 0x1c38 */
350 unsigned int rb3d_cntl; 352 unsigned int rb3d_cntl;
351 unsigned int rb3d_coloroffset; 353 unsigned int rb3d_coloroffset;
352 unsigned int re_width_height; 354 unsigned int re_width_height;
353 unsigned int rb3d_colorpitch; 355 unsigned int rb3d_colorpitch;
354 unsigned int se_cntl; 356 unsigned int se_cntl;
355 357
356 /* Vertex format state */ 358 /* Vertex format state */
357 unsigned int se_coord_fmt; /* 0x1c50 */ 359 unsigned int se_coord_fmt; /* 0x1c50 */
358 360
359 /* Line state */ 361 /* Line state */
360 unsigned int re_line_pattern; /* 0x1cd0 */ 362 unsigned int re_line_pattern; /* 0x1cd0 */
361 unsigned int re_line_state; 363 unsigned int re_line_state;
362 364
363 unsigned int se_line_width; /* 0x1db8 */ 365 unsigned int se_line_width; /* 0x1db8 */
364 366
365 /* Bumpmap state */ 367 /* Bumpmap state */
366 unsigned int pp_lum_matrix; /* 0x1d00 */ 368 unsigned int pp_lum_matrix; /* 0x1d00 */
367 369
368 unsigned int pp_rot_matrix_0; /* 0x1d58 */ 370 unsigned int pp_rot_matrix_0; /* 0x1d58 */
369 unsigned int pp_rot_matrix_1; 371 unsigned int pp_rot_matrix_1;
370 372
371 /* Mask state */ 373 /* Mask state */
372 unsigned int rb3d_stencilrefmask; /* 0x1d7c */ 374 unsigned int rb3d_stencilrefmask; /* 0x1d7c */
373 unsigned int rb3d_ropcntl; 375 unsigned int rb3d_ropcntl;
374 unsigned int rb3d_planemask; 376 unsigned int rb3d_planemask;
375 377
376 /* Viewport state */ 378 /* Viewport state */
377 unsigned int se_vport_xscale; /* 0x1d98 */ 379 unsigned int se_vport_xscale; /* 0x1d98 */
378 unsigned int se_vport_xoffset; 380 unsigned int se_vport_xoffset;
379 unsigned int se_vport_yscale; 381 unsigned int se_vport_yscale;
380 unsigned int se_vport_yoffset; 382 unsigned int se_vport_yoffset;
381 unsigned int se_vport_zscale; 383 unsigned int se_vport_zscale;
382 unsigned int se_vport_zoffset; 384 unsigned int se_vport_zoffset;
383 385
384 /* Setup state */ 386 /* Setup state */
385 unsigned int se_cntl_status; /* 0x2140 */ 387 unsigned int se_cntl_status; /* 0x2140 */
386 388
387 /* Misc state */ 389 /* Misc state */
388 unsigned int re_top_left; /* 0x26c0 */ 390 unsigned int re_top_left; /* 0x26c0 */
389 unsigned int re_misc; 391 unsigned int re_misc;
390 } drm_radeon_context_regs_t; 392 } drm_radeon_context_regs_t;
391 393
392 typedef struct { 394 typedef struct {
393 /* Zbias state */ 395 /* Zbias state */
394 unsigned int se_zbias_factor; /* 0x1dac */ 396 unsigned int se_zbias_factor; /* 0x1dac */
395 unsigned int se_zbias_constant; 397 unsigned int se_zbias_constant;
396 } drm_radeon_context2_regs_t; 398 } drm_radeon_context2_regs_t;
397 399
398 /* Setup registers for each texture unit 400 /* Setup registers for each texture unit
399 */ 401 */
400 typedef struct { 402 typedef struct {
401 unsigned int pp_txfilter; 403 unsigned int pp_txfilter;
402 unsigned int pp_txformat; 404 unsigned int pp_txformat;
403 unsigned int pp_txoffset; 405 unsigned int pp_txoffset;
404 unsigned int pp_txcblend; 406 unsigned int pp_txcblend;
405 unsigned int pp_txablend; 407 unsigned int pp_txablend;
406 unsigned int pp_tfactor; 408 unsigned int pp_tfactor;
407 unsigned int pp_border_color; 409 unsigned int pp_border_color;
408 } drm_radeon_texture_regs_t; 410 } drm_radeon_texture_regs_t;
409 411
410 typedef struct { 412 typedef struct {
411 unsigned int start; 413 unsigned int start;
412 unsigned int finish; 414 unsigned int finish;
413 unsigned int prim:8; 415 unsigned int prim:8;
414 unsigned int stateidx:8; 416 unsigned int stateidx:8;
415 unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ 417 unsigned int numverts:16; /* overloaded as offset/64 for elt prims */
416 unsigned int vc_format; /* vertex format */ 418 unsigned int vc_format; /* vertex format */
417 } drm_radeon_prim_t; 419 } drm_radeon_prim_t;
418 420
419 typedef struct { 421 typedef struct {
420 drm_radeon_context_regs_t context; 422 drm_radeon_context_regs_t context;
421 drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS]; 423 drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS];
422 drm_radeon_context2_regs_t context2; 424 drm_radeon_context2_regs_t context2;
423 unsigned int dirty; 425 unsigned int dirty;
424 } drm_radeon_state_t; 426 } drm_radeon_state_t;
425 427
426 typedef struct { 428 typedef struct {
427 /* The channel for communication of state information to the 429 /* The channel for communication of state information to the
428 * kernel on firing a vertex buffer with either of the 430 * kernel on firing a vertex buffer with either of the
429 * obsoleted vertex/index ioctls. 431 * obsoleted vertex/index ioctls.
430 */ 432 */
431 drm_radeon_context_regs_t context_state; 433 drm_radeon_context_regs_t context_state;
432 drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; 434 drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS];
433 unsigned int dirty; 435 unsigned int dirty;
434 unsigned int vertsize; 436 unsigned int vertsize;
435 unsigned int vc_format; 437 unsigned int vc_format;
436 438
437 /* The current cliprects, or a subset thereof. 439 /* The current cliprects, or a subset thereof.
438 */ 440 */
439 struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS]; 441 struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS];
440 unsigned int nbox; 442 unsigned int nbox;
441 443
442 /* Counters for client-side throttling of rendering clients. 444 /* Counters for client-side throttling of rendering clients.
443 */ 445 */
444 unsigned int last_frame; 446 unsigned int last_frame;
445 unsigned int last_dispatch; 447 unsigned int last_dispatch;
446 unsigned int last_clear; 448 unsigned int last_clear;
447 449
448 struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS + 450 struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS +
449 1]; 451 1];
450 unsigned int tex_age[RADEON_NR_TEX_HEAPS]; 452 unsigned int tex_age[RADEON_NR_TEX_HEAPS];
451 int ctx_owner; 453 int ctx_owner;
452 int pfState; /* number of 3d windows (0,1,2ormore) */ 454 int pfState; /* number of 3d windows (0,1,2ormore) */
453 int pfCurrentPage; /* which buffer is being displayed? */ 455 int pfCurrentPage; /* which buffer is being displayed? */
454 int crtc2_base; /* CRTC2 frame offset */ 456 int crtc2_base; /* CRTC2 frame offset */
455 int tiling_enabled; /* set by drm, read by 2d + 3d clients */ 457 int tiling_enabled; /* set by drm, read by 2d + 3d clients */
456 } drm_radeon_sarea_t; 458 } drm_radeon_sarea_t;
457 459
458 /* WARNING: If you change any of these defines, make sure to change the 460 /* WARNING: If you change any of these defines, make sure to change the
459 * defines in the Xserver file (xf86drmRadeon.h) 461 * defines in the Xserver file (xf86drmRadeon.h)
460 * 462 *
461 * KW: actually it's illegal to change any of this (backwards compatibility). 463 * KW: actually it's illegal to change any of this (backwards compatibility).
462 */ 464 */
463 465
464 /* Radeon specific ioctls 466 /* Radeon specific ioctls
465 * The device specific ioctl range is 0x40 to 0x79. 467 * The device specific ioctl range is 0x40 to 0x79.
466 */ 468 */
467 #define DRM_RADEON_CP_INIT 0x00 469 #define DRM_RADEON_CP_INIT 0x00
468 #define DRM_RADEON_CP_START 0x01 470 #define DRM_RADEON_CP_START 0x01
469 #define DRM_RADEON_CP_STOP 0x02 471 #define DRM_RADEON_CP_STOP 0x02
470 #define DRM_RADEON_CP_RESET 0x03 472 #define DRM_RADEON_CP_RESET 0x03
471 #define DRM_RADEON_CP_IDLE 0x04 473 #define DRM_RADEON_CP_IDLE 0x04
472 #define DRM_RADEON_RESET 0x05 474 #define DRM_RADEON_RESET 0x05
473 #define DRM_RADEON_FULLSCREEN 0x06 475 #define DRM_RADEON_FULLSCREEN 0x06
474 #define DRM_RADEON_SWAP 0x07 476 #define DRM_RADEON_SWAP 0x07
475 #define DRM_RADEON_CLEAR 0x08 477 #define DRM_RADEON_CLEAR 0x08
476 #define DRM_RADEON_VERTEX 0x09 478 #define DRM_RADEON_VERTEX 0x09
477 #define DRM_RADEON_INDICES 0x0A 479 #define DRM_RADEON_INDICES 0x0A
478 #define DRM_RADEON_NOT_USED 480 #define DRM_RADEON_NOT_USED
479 #define DRM_RADEON_STIPPLE 0x0C 481 #define DRM_RADEON_STIPPLE 0x0C
480 #define DRM_RADEON_INDIRECT 0x0D 482 #define DRM_RADEON_INDIRECT 0x0D
481 #define DRM_RADEON_TEXTURE 0x0E 483 #define DRM_RADEON_TEXTURE 0x0E
482 #define DRM_RADEON_VERTEX2 0x0F 484 #define DRM_RADEON_VERTEX2 0x0F
483 #define DRM_RADEON_CMDBUF 0x10 485 #define DRM_RADEON_CMDBUF 0x10
484 #define DRM_RADEON_GETPARAM 0x11 486 #define DRM_RADEON_GETPARAM 0x11
485 #define DRM_RADEON_FLIP 0x12 487 #define DRM_RADEON_FLIP 0x12
486 #define DRM_RADEON_ALLOC 0x13 488 #define DRM_RADEON_ALLOC 0x13
487 #define DRM_RADEON_FREE 0x14 489 #define DRM_RADEON_FREE 0x14
488 #define DRM_RADEON_INIT_HEAP 0x15 490 #define DRM_RADEON_INIT_HEAP 0x15
489 #define DRM_RADEON_IRQ_EMIT 0x16 491 #define DRM_RADEON_IRQ_EMIT 0x16
490 #define DRM_RADEON_IRQ_WAIT 0x17 492 #define DRM_RADEON_IRQ_WAIT 0x17
491 #define DRM_RADEON_CP_RESUME 0x18 493 #define DRM_RADEON_CP_RESUME 0x18
492 #define DRM_RADEON_SETPARAM 0x19 494 #define DRM_RADEON_SETPARAM 0x19
493 #define DRM_RADEON_SURF_ALLOC 0x1a 495 #define DRM_RADEON_SURF_ALLOC 0x1a
494 #define DRM_RADEON_SURF_FREE 0x1b 496 #define DRM_RADEON_SURF_FREE 0x1b
495 497
496 #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 498 #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
497 #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 499 #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
498 #define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t) 500 #define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
499 #define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET) 501 #define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET)
500 #define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE) 502 #define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE)
501 #define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET) 503 #define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET)
502 #define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t) 504 #define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t)
503 #define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP) 505 #define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP)
504 #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t) 506 #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t)
505 #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t) 507 #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t)
506 #define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t) 508 #define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t)
507 #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t) 509 #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t)
508 #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t) 510 #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t)
509 #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t) 511 #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t)
510 #define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t) 512 #define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t)
511 #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t) 513 #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t)
512 #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t) 514 #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t)
513 #define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP) 515 #define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP)
514 #define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t) 516 #define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t)
515 #define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t) 517 #define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t)
516 #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t) 518 #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t)
517 #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t) 519 #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t)
518 #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t) 520 #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t)
519 #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME) 521 #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME)
520 #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) 522 #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
521 #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) 523 #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
522 #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) 524 #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
523 525
524 typedef struct drm_radeon_init { 526 typedef struct drm_radeon_init {
525 enum { 527 enum {
526 RADEON_INIT_CP = 0x01, 528 RADEON_INIT_CP = 0x01,
527 RADEON_CLEANUP_CP = 0x02, 529 RADEON_CLEANUP_CP = 0x02,
528 RADEON_INIT_R200_CP = 0x03, 530 RADEON_INIT_R200_CP = 0x03,
529 RADEON_INIT_R300_CP = 0x04 531 RADEON_INIT_R300_CP = 0x04
530 } func; 532 } func;
531 unsigned long sarea_priv_offset; 533 unsigned long sarea_priv_offset;
532 int is_pci; 534 int is_pci;
533 int cp_mode; 535 int cp_mode;
534 int gart_size; 536 int gart_size;
535 int ring_size; 537 int ring_size;
536 int usec_timeout; 538 int usec_timeout;
537 539
538 unsigned int fb_bpp; 540 unsigned int fb_bpp;
539 unsigned int front_offset, front_pitch; 541 unsigned int front_offset, front_pitch;
540 unsigned int back_offset, back_pitch; 542 unsigned int back_offset, back_pitch;
541 unsigned int depth_bpp; 543 unsigned int depth_bpp;
542 unsigned int depth_offset, depth_pitch; 544 unsigned int depth_offset, depth_pitch;
543 545
544 unsigned long fb_offset; 546 unsigned long fb_offset;
545 unsigned long mmio_offset; 547 unsigned long mmio_offset;
546 unsigned long ring_offset; 548 unsigned long ring_offset;
547 unsigned long ring_rptr_offset; 549 unsigned long ring_rptr_offset;
548 unsigned long buffers_offset; 550 unsigned long buffers_offset;
549 unsigned long gart_textures_offset; 551 unsigned long gart_textures_offset;
550 } drm_radeon_init_t; 552 } drm_radeon_init_t;
551 553
552 typedef struct drm_radeon_cp_stop { 554 typedef struct drm_radeon_cp_stop {
553 int flush; 555 int flush;
554 int idle; 556 int idle;
555 } drm_radeon_cp_stop_t; 557 } drm_radeon_cp_stop_t;
556 558
557 typedef struct drm_radeon_fullscreen { 559 typedef struct drm_radeon_fullscreen {
558 enum { 560 enum {
559 RADEON_INIT_FULLSCREEN = 0x01, 561 RADEON_INIT_FULLSCREEN = 0x01,
560 RADEON_CLEANUP_FULLSCREEN = 0x02 562 RADEON_CLEANUP_FULLSCREEN = 0x02
561 } func; 563 } func;
562 } drm_radeon_fullscreen_t; 564 } drm_radeon_fullscreen_t;
563 565
564 #define CLEAR_X1 0 566 #define CLEAR_X1 0
565 #define CLEAR_Y1 1 567 #define CLEAR_Y1 1
566 #define CLEAR_X2 2 568 #define CLEAR_X2 2
567 #define CLEAR_Y2 3 569 #define CLEAR_Y2 3
568 #define CLEAR_DEPTH 4 570 #define CLEAR_DEPTH 4
569 571
570 typedef union drm_radeon_clear_rect { 572 typedef union drm_radeon_clear_rect {
571 float f[5]; 573 float f[5];
572 unsigned int ui[5]; 574 unsigned int ui[5];
573 } drm_radeon_clear_rect_t; 575 } drm_radeon_clear_rect_t;
574 576
575 typedef struct drm_radeon_clear { 577 typedef struct drm_radeon_clear {
576 unsigned int flags; 578 unsigned int flags;
577 unsigned int clear_color; 579 unsigned int clear_color;
578 unsigned int clear_depth; 580 unsigned int clear_depth;
579 unsigned int color_mask; 581 unsigned int color_mask;
580 unsigned int depth_mask; /* misnamed field: should be stencil */ 582 unsigned int depth_mask; /* misnamed field: should be stencil */
581 drm_radeon_clear_rect_t __user *depth_boxes; 583 drm_radeon_clear_rect_t __user *depth_boxes;
582 } drm_radeon_clear_t; 584 } drm_radeon_clear_t;
583 585
584 typedef struct drm_radeon_vertex { 586 typedef struct drm_radeon_vertex {
585 int prim; 587 int prim;
586 int idx; /* Index of vertex buffer */ 588 int idx; /* Index of vertex buffer */
587 int count; /* Number of vertices in buffer */ 589 int count; /* Number of vertices in buffer */
588 int discard; /* Client finished with buffer? */ 590 int discard; /* Client finished with buffer? */
589 } drm_radeon_vertex_t; 591 } drm_radeon_vertex_t;
590 592
591 typedef struct drm_radeon_indices { 593 typedef struct drm_radeon_indices {
592 int prim; 594 int prim;
593 int idx; 595 int idx;
594 int start; 596 int start;
595 int end; 597 int end;
596 int discard; /* Client finished with buffer? */ 598 int discard; /* Client finished with buffer? */
597 } drm_radeon_indices_t; 599 } drm_radeon_indices_t;
598 600
599 /* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices 601 /* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices
600 * - allows multiple primitives and state changes in a single ioctl 602 * - allows multiple primitives and state changes in a single ioctl
601 * - supports driver change to emit native primitives 603 * - supports driver change to emit native primitives
602 */ 604 */
603 typedef struct drm_radeon_vertex2 { 605 typedef struct drm_radeon_vertex2 {
604 int idx; /* Index of vertex buffer */ 606 int idx; /* Index of vertex buffer */
605 int discard; /* Client finished with buffer? */ 607 int discard; /* Client finished with buffer? */
606 int nr_states; 608 int nr_states;
607 drm_radeon_state_t __user *state; 609 drm_radeon_state_t __user *state;
608 int nr_prims; 610 int nr_prims;
609 drm_radeon_prim_t __user *prim; 611 drm_radeon_prim_t __user *prim;
610 } drm_radeon_vertex2_t; 612 } drm_radeon_vertex2_t;
611 613
612 /* v1.3 - obsoletes drm_radeon_vertex2 614 /* v1.3 - obsoletes drm_radeon_vertex2
613 * - allows arbitarily large cliprect list 615 * - allows arbitarily large cliprect list
614 * - allows updating of tcl packet, vector and scalar state 616 * - allows updating of tcl packet, vector and scalar state
615 * - allows memory-efficient description of state updates 617 * - allows memory-efficient description of state updates
616 * - allows state to be emitted without a primitive 618 * - allows state to be emitted without a primitive
617 * (for clears, ctx switches) 619 * (for clears, ctx switches)
618 * - allows more than one dma buffer to be referenced per ioctl 620 * - allows more than one dma buffer to be referenced per ioctl
619 * - supports tcl driver 621 * - supports tcl driver
620 * - may be extended in future versions with new cmd types, packets 622 * - may be extended in future versions with new cmd types, packets
621 */ 623 */
622 typedef struct drm_radeon_cmd_buffer { 624 typedef struct drm_radeon_cmd_buffer {
623 int bufsz; 625 int bufsz;
624 char __user *buf; 626 char __user *buf;
625 int nbox; 627 int nbox;
626 struct drm_clip_rect __user *boxes; 628 struct drm_clip_rect __user *boxes;
627 } drm_radeon_cmd_buffer_t; 629 } drm_radeon_cmd_buffer_t;
628 630
629 typedef struct drm_radeon_tex_image { 631 typedef struct drm_radeon_tex_image {
630 unsigned int x, y; /* Blit coordinates */ 632 unsigned int x, y; /* Blit coordinates */
631 unsigned int width, height; 633 unsigned int width, height;
632 const void __user *data; 634 const void __user *data;
633 } drm_radeon_tex_image_t; 635 } drm_radeon_tex_image_t;
634 636
635 typedef struct drm_radeon_texture { 637 typedef struct drm_radeon_texture {
636 unsigned int offset; 638 unsigned int offset;
637 int pitch; 639 int pitch;
638 int format; 640 int format;
639 int width; /* Texture image coordinates */ 641 int width; /* Texture image coordinates */
640 int height; 642 int height;
641 drm_radeon_tex_image_t __user *image; 643 drm_radeon_tex_image_t __user *image;
642 } drm_radeon_texture_t; 644 } drm_radeon_texture_t;
643 645
644 typedef struct drm_radeon_stipple { 646 typedef struct drm_radeon_stipple {
645 unsigned int __user *mask; 647 unsigned int __user *mask;
646 } drm_radeon_stipple_t; 648 } drm_radeon_stipple_t;
647 649
648 typedef struct drm_radeon_indirect { 650 typedef struct drm_radeon_indirect {
649 int idx; 651 int idx;
650 int start; 652 int start;
651 int end; 653 int end;
652 int discard; 654 int discard;
653 } drm_radeon_indirect_t; 655 } drm_radeon_indirect_t;
654 656
655 /* enum for card type parameters */ 657 /* enum for card type parameters */
656 #define RADEON_CARD_PCI 0 658 #define RADEON_CARD_PCI 0
657 #define RADEON_CARD_AGP 1 659 #define RADEON_CARD_AGP 1
658 #define RADEON_CARD_PCIE 2 660 #define RADEON_CARD_PCIE 2
659 661
660 /* 1.3: An ioctl to get parameters that aren't available to the 3d 662 /* 1.3: An ioctl to get parameters that aren't available to the 3d
661 * client any other way. 663 * client any other way.
662 */ 664 */
663 #define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */ 665 #define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */
664 #define RADEON_PARAM_LAST_FRAME 2 666 #define RADEON_PARAM_LAST_FRAME 2
665 #define RADEON_PARAM_LAST_DISPATCH 3 667 #define RADEON_PARAM_LAST_DISPATCH 3
666 #define RADEON_PARAM_LAST_CLEAR 4 668 #define RADEON_PARAM_LAST_CLEAR 4
667 /* Added with DRM version 1.6. */ 669 /* Added with DRM version 1.6. */
668 #define RADEON_PARAM_IRQ_NR 5 670 #define RADEON_PARAM_IRQ_NR 5
669 #define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */ 671 #define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */
670 /* Added with DRM version 1.8. */ 672 /* Added with DRM version 1.8. */
671 #define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */ 673 #define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */
672 #define RADEON_PARAM_STATUS_HANDLE 8 674 #define RADEON_PARAM_STATUS_HANDLE 8
673 #define RADEON_PARAM_SAREA_HANDLE 9 675 #define RADEON_PARAM_SAREA_HANDLE 9
674 #define RADEON_PARAM_GART_TEX_HANDLE 10 676 #define RADEON_PARAM_GART_TEX_HANDLE 10
675 #define RADEON_PARAM_SCRATCH_OFFSET 11 677 #define RADEON_PARAM_SCRATCH_OFFSET 11
676 #define RADEON_PARAM_CARD_TYPE 12 678 #define RADEON_PARAM_CARD_TYPE 12
677 #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ 679 #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
678 #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ 680 #define RADEON_PARAM_FB_LOCATION 14 /* FB location */
679 #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ 681 #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
680 682
681 typedef struct drm_radeon_getparam { 683 typedef struct drm_radeon_getparam {
682 int param; 684 int param;
683 void __user *value; 685 void __user *value;
684 } drm_radeon_getparam_t; 686 } drm_radeon_getparam_t;
685 687
686 /* 1.6: Set up a memory manager for regions of shared memory: 688 /* 1.6: Set up a memory manager for regions of shared memory:
687 */ 689 */
688 #define RADEON_MEM_REGION_GART 1 690 #define RADEON_MEM_REGION_GART 1
689 #define RADEON_MEM_REGION_FB 2 691 #define RADEON_MEM_REGION_FB 2
690 692
691 typedef struct drm_radeon_mem_alloc { 693 typedef struct drm_radeon_mem_alloc {
692 int region; 694 int region;
693 int alignment; 695 int alignment;
694 int size; 696 int size;
695 int __user *region_offset; /* offset from start of fb or GART */ 697 int __user *region_offset; /* offset from start of fb or GART */
696 } drm_radeon_mem_alloc_t; 698 } drm_radeon_mem_alloc_t;
697 699
698 typedef struct drm_radeon_mem_free { 700 typedef struct drm_radeon_mem_free {
699 int region; 701 int region;
700 int region_offset; 702 int region_offset;
701 } drm_radeon_mem_free_t; 703 } drm_radeon_mem_free_t;
702 704
703 typedef struct drm_radeon_mem_init_heap { 705 typedef struct drm_radeon_mem_init_heap {
704 int region; 706 int region;
705 int size; 707 int size;
706 int start; 708 int start;
707 } drm_radeon_mem_init_heap_t; 709 } drm_radeon_mem_init_heap_t;
708 710
709 /* 1.6: Userspace can request & wait on irq's: 711 /* 1.6: Userspace can request & wait on irq's:
710 */ 712 */
711 typedef struct drm_radeon_irq_emit { 713 typedef struct drm_radeon_irq_emit {
712 int __user *irq_seq; 714 int __user *irq_seq;
713 } drm_radeon_irq_emit_t; 715 } drm_radeon_irq_emit_t;
714 716
715 typedef struct drm_radeon_irq_wait { 717 typedef struct drm_radeon_irq_wait {
716 int irq_seq; 718 int irq_seq;
717 } drm_radeon_irq_wait_t; 719 } drm_radeon_irq_wait_t;
718 720
719 /* 1.10: Clients tell the DRM where they think the framebuffer is located in 721 /* 1.10: Clients tell the DRM where they think the framebuffer is located in
720 * the card's address space, via a new generic ioctl to set parameters 722 * the card's address space, via a new generic ioctl to set parameters
721 */ 723 */
722 724
723 typedef struct drm_radeon_setparam { 725 typedef struct drm_radeon_setparam {
724 unsigned int param; 726 unsigned int param;
725 int64_t value; 727 __s64 value;
726 } drm_radeon_setparam_t; 728 } drm_radeon_setparam_t;
727 729
728 #define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ 730 #define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */
729 #define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */ 731 #define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */
730 #define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */ 732 #define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */
731 #define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */ 733 #define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */
732 #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */ 734 #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */
733 #define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */ 735 #define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */
734 /* 1.14: Clients can allocate/free a surface 736 /* 1.14: Clients can allocate/free a surface
735 */ 737 */
736 typedef struct drm_radeon_surface_alloc { 738 typedef struct drm_radeon_surface_alloc {
737 unsigned int address; 739 unsigned int address;
738 unsigned int size; 740 unsigned int size;
739 unsigned int flags; 741 unsigned int flags;
740 } drm_radeon_surface_alloc_t; 742 } drm_radeon_surface_alloc_t;
741 743
742 typedef struct drm_radeon_surface_free { 744 typedef struct drm_radeon_surface_free {
743 unsigned int address; 745 unsigned int address;
744 } drm_radeon_surface_free_t; 746 } drm_radeon_surface_free_t;
745 747
746 #define DRM_RADEON_VBLANK_CRTC1 1 748 #define DRM_RADEON_VBLANK_CRTC1 1
747 #define DRM_RADEON_VBLANK_CRTC2 2 749 #define DRM_RADEON_VBLANK_CRTC2 2
748 750
749 #endif 751 #endif
750 752
include/drm/via_drm.h
1 /* 1 /*
2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. 2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. 3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
4 * 4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a 5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"), 6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation 7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the 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: 10 * Software is furnished to do so, subject to the following conditions:
11 * 11 *
12 * The above copyright notice and this permission notice (including the 12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions 13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software. 14 * of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 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 OTHER 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE. 22 * DEALINGS IN THE SOFTWARE.
23 */ 23 */
24 #ifndef _VIA_DRM_H_ 24 #ifndef _VIA_DRM_H_
25 #define _VIA_DRM_H_ 25 #define _VIA_DRM_H_
26 26
27 #include <linux/types.h>
28
27 /* WARNING: These defines must be the same as what the Xserver uses. 29 /* WARNING: These defines must be the same as what the Xserver uses.
28 * if you change them, you must change the defines in the Xserver. 30 * if you change them, you must change the defines in the Xserver.
29 */ 31 */
30 32
31 #ifndef _VIA_DEFINES_ 33 #ifndef _VIA_DEFINES_
32 #define _VIA_DEFINES_ 34 #define _VIA_DEFINES_
33 35
34 #ifndef __KERNEL__ 36 #ifndef __KERNEL__
35 #include "via_drmclient.h" 37 #include "via_drmclient.h"
36 #endif 38 #endif
37 39
38 #define VIA_NR_SAREA_CLIPRECTS 8 40 #define VIA_NR_SAREA_CLIPRECTS 8
39 #define VIA_NR_XVMC_PORTS 10 41 #define VIA_NR_XVMC_PORTS 10
40 #define VIA_NR_XVMC_LOCKS 5 42 #define VIA_NR_XVMC_LOCKS 5
41 #define VIA_MAX_CACHELINE_SIZE 64 43 #define VIA_MAX_CACHELINE_SIZE 64
42 #define XVMCLOCKPTR(saPriv,lockNo) \ 44 #define XVMCLOCKPTR(saPriv,lockNo) \
43 ((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ 45 ((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
44 (VIA_MAX_CACHELINE_SIZE - 1)) & \ 46 (VIA_MAX_CACHELINE_SIZE - 1)) & \
45 ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ 47 ~(VIA_MAX_CACHELINE_SIZE - 1)) + \
46 VIA_MAX_CACHELINE_SIZE*(lockNo))) 48 VIA_MAX_CACHELINE_SIZE*(lockNo)))
47 49
48 /* Each region is a minimum of 64k, and there are at most 64 of them. 50 /* Each region is a minimum of 64k, and there are at most 64 of them.
49 */ 51 */
50 #define VIA_NR_TEX_REGIONS 64 52 #define VIA_NR_TEX_REGIONS 64
51 #define VIA_LOG_MIN_TEX_REGION_SIZE 16 53 #define VIA_LOG_MIN_TEX_REGION_SIZE 16
52 #endif 54 #endif
53 55
54 #define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ 56 #define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */
55 #define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ 57 #define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */
56 #define VIA_UPLOAD_CTX 0x4 58 #define VIA_UPLOAD_CTX 0x4
57 #define VIA_UPLOAD_BUFFERS 0x8 59 #define VIA_UPLOAD_BUFFERS 0x8
58 #define VIA_UPLOAD_TEX0 0x10 60 #define VIA_UPLOAD_TEX0 0x10
59 #define VIA_UPLOAD_TEX1 0x20 61 #define VIA_UPLOAD_TEX1 0x20
60 #define VIA_UPLOAD_CLIPRECTS 0x40 62 #define VIA_UPLOAD_CLIPRECTS 0x40
61 #define VIA_UPLOAD_ALL 0xff 63 #define VIA_UPLOAD_ALL 0xff
62 64
63 /* VIA specific ioctls */ 65 /* VIA specific ioctls */
64 #define DRM_VIA_ALLOCMEM 0x00 66 #define DRM_VIA_ALLOCMEM 0x00
65 #define DRM_VIA_FREEMEM 0x01 67 #define DRM_VIA_FREEMEM 0x01
66 #define DRM_VIA_AGP_INIT 0x02 68 #define DRM_VIA_AGP_INIT 0x02
67 #define DRM_VIA_FB_INIT 0x03 69 #define DRM_VIA_FB_INIT 0x03
68 #define DRM_VIA_MAP_INIT 0x04 70 #define DRM_VIA_MAP_INIT 0x04
69 #define DRM_VIA_DEC_FUTEX 0x05 71 #define DRM_VIA_DEC_FUTEX 0x05
70 #define NOT_USED 72 #define NOT_USED
71 #define DRM_VIA_DMA_INIT 0x07 73 #define DRM_VIA_DMA_INIT 0x07
72 #define DRM_VIA_CMDBUFFER 0x08 74 #define DRM_VIA_CMDBUFFER 0x08
73 #define DRM_VIA_FLUSH 0x09 75 #define DRM_VIA_FLUSH 0x09
74 #define DRM_VIA_PCICMD 0x0a 76 #define DRM_VIA_PCICMD 0x0a
75 #define DRM_VIA_CMDBUF_SIZE 0x0b 77 #define DRM_VIA_CMDBUF_SIZE 0x0b
76 #define NOT_USED 78 #define NOT_USED
77 #define DRM_VIA_WAIT_IRQ 0x0d 79 #define DRM_VIA_WAIT_IRQ 0x0d
78 #define DRM_VIA_DMA_BLIT 0x0e 80 #define DRM_VIA_DMA_BLIT 0x0e
79 #define DRM_VIA_BLIT_SYNC 0x0f 81 #define DRM_VIA_BLIT_SYNC 0x0f
80 82
81 #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) 83 #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
82 #define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) 84 #define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
83 #define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t) 85 #define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
84 #define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t) 86 #define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
85 #define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t) 87 #define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
86 #define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t) 88 #define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
87 #define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t) 89 #define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
88 #define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t) 90 #define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
89 #define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH) 91 #define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH)
90 #define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t) 92 #define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t)
91 #define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ 93 #define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \
92 drm_via_cmdbuf_size_t) 94 drm_via_cmdbuf_size_t)
93 #define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t) 95 #define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t)
94 #define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t) 96 #define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
95 #define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t) 97 #define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
96 98
97 /* Indices into buf.Setup where various bits of state are mirrored per 99 /* Indices into buf.Setup where various bits of state are mirrored per
98 * context and per buffer. These can be fired at the card as a unit, 100 * context and per buffer. These can be fired at the card as a unit,
99 * or in a piecewise fashion as required. 101 * or in a piecewise fashion as required.
100 */ 102 */
101 103
102 #define VIA_TEX_SETUP_SIZE 8 104 #define VIA_TEX_SETUP_SIZE 8
103 105
104 /* Flags for clear ioctl 106 /* Flags for clear ioctl
105 */ 107 */
106 #define VIA_FRONT 0x1 108 #define VIA_FRONT 0x1
107 #define VIA_BACK 0x2 109 #define VIA_BACK 0x2
108 #define VIA_DEPTH 0x4 110 #define VIA_DEPTH 0x4
109 #define VIA_STENCIL 0x8 111 #define VIA_STENCIL 0x8
110 #define VIA_MEM_VIDEO 0 /* matches drm constant */ 112 #define VIA_MEM_VIDEO 0 /* matches drm constant */
111 #define VIA_MEM_AGP 1 /* matches drm constant */ 113 #define VIA_MEM_AGP 1 /* matches drm constant */
112 #define VIA_MEM_SYSTEM 2 114 #define VIA_MEM_SYSTEM 2
113 #define VIA_MEM_MIXED 3 115 #define VIA_MEM_MIXED 3
114 #define VIA_MEM_UNKNOWN 4 116 #define VIA_MEM_UNKNOWN 4
115 117
116 typedef struct { 118 typedef struct {
117 uint32_t offset; 119 __u32 offset;
118 uint32_t size; 120 __u32 size;
119 } drm_via_agp_t; 121 } drm_via_agp_t;
120 122
121 typedef struct { 123 typedef struct {
122 uint32_t offset; 124 __u32 offset;
123 uint32_t size; 125 __u32 size;
124 } drm_via_fb_t; 126 } drm_via_fb_t;
125 127
126 typedef struct { 128 typedef struct {
127 uint32_t context; 129 __u32 context;
128 uint32_t type; 130 __u32 type;
129 uint32_t size; 131 __u32 size;
130 unsigned long index; 132 unsigned long index;
131 unsigned long offset; 133 unsigned long offset;
132 } drm_via_mem_t; 134 } drm_via_mem_t;
133 135
134 typedef struct _drm_via_init { 136 typedef struct _drm_via_init {
135 enum { 137 enum {
136 VIA_INIT_MAP = 0x01, 138 VIA_INIT_MAP = 0x01,
137 VIA_CLEANUP_MAP = 0x02 139 VIA_CLEANUP_MAP = 0x02
138 } func; 140 } func;
139 141
140 unsigned long sarea_priv_offset; 142 unsigned long sarea_priv_offset;
141 unsigned long fb_offset; 143 unsigned long fb_offset;
142 unsigned long mmio_offset; 144 unsigned long mmio_offset;
143 unsigned long agpAddr; 145 unsigned long agpAddr;
144 } drm_via_init_t; 146 } drm_via_init_t;
145 147
146 typedef struct _drm_via_futex { 148 typedef struct _drm_via_futex {
147 enum { 149 enum {
148 VIA_FUTEX_WAIT = 0x00, 150 VIA_FUTEX_WAIT = 0x00,
149 VIA_FUTEX_WAKE = 0X01 151 VIA_FUTEX_WAKE = 0X01
150 } func; 152 } func;
151 uint32_t ms; 153 __u32 ms;
152 uint32_t lock; 154 __u32 lock;
153 uint32_t val; 155 __u32 val;
154 } drm_via_futex_t; 156 } drm_via_futex_t;
155 157
156 typedef struct _drm_via_dma_init { 158 typedef struct _drm_via_dma_init {
157 enum { 159 enum {
158 VIA_INIT_DMA = 0x01, 160 VIA_INIT_DMA = 0x01,
159 VIA_CLEANUP_DMA = 0x02, 161 VIA_CLEANUP_DMA = 0x02,
160 VIA_DMA_INITIALIZED = 0x03 162 VIA_DMA_INITIALIZED = 0x03
161 } func; 163 } func;
162 164
163 unsigned long offset; 165 unsigned long offset;
164 unsigned long size; 166 unsigned long size;
165 unsigned long reg_pause_addr; 167 unsigned long reg_pause_addr;
166 } drm_via_dma_init_t; 168 } drm_via_dma_init_t;
167 169
168 typedef struct _drm_via_cmdbuffer { 170 typedef struct _drm_via_cmdbuffer {
169 char __user *buf; 171 char __user *buf;
170 unsigned long size; 172 unsigned long size;
171 } drm_via_cmdbuffer_t; 173 } drm_via_cmdbuffer_t;
172 174
173 /* Warning: If you change the SAREA structure you must change the Xserver 175 /* Warning: If you change the SAREA structure you must change the Xserver
174 * structure as well */ 176 * structure as well */
175 177
176 typedef struct _drm_via_tex_region { 178 typedef struct _drm_via_tex_region {
177 unsigned char next, prev; /* indices to form a circular LRU */ 179 unsigned char next, prev; /* indices to form a circular LRU */
178 unsigned char inUse; /* owned by a client, or free? */ 180 unsigned char inUse; /* owned by a client, or free? */
179 int age; /* tracked by clients to update local LRU's */ 181 int age; /* tracked by clients to update local LRU's */
180 } drm_via_tex_region_t; 182 } drm_via_tex_region_t;
181 183
182 typedef struct _drm_via_sarea { 184 typedef struct _drm_via_sarea {
183 unsigned int dirty; 185 unsigned int dirty;
184 unsigned int nbox; 186 unsigned int nbox;
185 struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS]; 187 struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS];
186 drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; 188 drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
187 int texAge; /* last time texture was uploaded */ 189 int texAge; /* last time texture was uploaded */
188 int ctxOwner; /* last context to upload state */ 190 int ctxOwner; /* last context to upload state */
189 int vertexPrim; 191 int vertexPrim;
190 192
191 /* 193 /*
192 * Below is for XvMC. 194 * Below is for XvMC.
193 * We want the lock integers alone on, and aligned to, a cache line. 195 * We want the lock integers alone on, and aligned to, a cache line.
194 * Therefore this somewhat strange construct. 196 * Therefore this somewhat strange construct.
195 */ 197 */
196 198
197 char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)]; 199 char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)];
198 200
199 unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS]; 201 unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS];
200 unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS]; 202 unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS];
201 unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */ 203 unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */
202 204
203 /* Used by the 3d driver only at this point, for pageflipping: 205 /* Used by the 3d driver only at this point, for pageflipping:
204 */ 206 */
205 unsigned int pfCurrentOffset; 207 unsigned int pfCurrentOffset;
206 } drm_via_sarea_t; 208 } drm_via_sarea_t;
207 209
208 typedef struct _drm_via_cmdbuf_size { 210 typedef struct _drm_via_cmdbuf_size {
209 enum { 211 enum {
210 VIA_CMDBUF_SPACE = 0x01, 212 VIA_CMDBUF_SPACE = 0x01,
211 VIA_CMDBUF_LAG = 0x02 213 VIA_CMDBUF_LAG = 0x02
212 } func; 214 } func;
213 int wait; 215 int wait;
214 uint32_t size; 216 __u32 size;
215 } drm_via_cmdbuf_size_t; 217 } drm_via_cmdbuf_size_t;
216 218
217 typedef enum { 219 typedef enum {
218 VIA_IRQ_ABSOLUTE = 0x0, 220 VIA_IRQ_ABSOLUTE = 0x0,
219 VIA_IRQ_RELATIVE = 0x1, 221 VIA_IRQ_RELATIVE = 0x1,
220 VIA_IRQ_SIGNAL = 0x10000000, 222 VIA_IRQ_SIGNAL = 0x10000000,
221 VIA_IRQ_FORCE_SEQUENCE = 0x20000000 223 VIA_IRQ_FORCE_SEQUENCE = 0x20000000
222 } via_irq_seq_type_t; 224 } via_irq_seq_type_t;
223 225
224 #define VIA_IRQ_FLAGS_MASK 0xF0000000 226 #define VIA_IRQ_FLAGS_MASK 0xF0000000
225 227
226 enum drm_via_irqs { 228 enum drm_via_irqs {
227 drm_via_irq_hqv0 = 0, 229 drm_via_irq_hqv0 = 0,
228 drm_via_irq_hqv1, 230 drm_via_irq_hqv1,
229 drm_via_irq_dma0_dd, 231 drm_via_irq_dma0_dd,
230 drm_via_irq_dma0_td, 232 drm_via_irq_dma0_td,
231 drm_via_irq_dma1_dd, 233 drm_via_irq_dma1_dd,
232 drm_via_irq_dma1_td, 234 drm_via_irq_dma1_td,
233 drm_via_irq_num 235 drm_via_irq_num
234 }; 236 };
235 237
236 struct drm_via_wait_irq_request { 238 struct drm_via_wait_irq_request {
237 unsigned irq; 239 unsigned irq;
238 via_irq_seq_type_t type; 240 via_irq_seq_type_t type;
239 uint32_t sequence; 241 __u32 sequence;
240 uint32_t signal; 242 __u32 signal;
241 }; 243 };
242 244
243 typedef union drm_via_irqwait { 245 typedef union drm_via_irqwait {
244 struct drm_via_wait_irq_request request; 246 struct drm_via_wait_irq_request request;
245 struct drm_wait_vblank_reply reply; 247 struct drm_wait_vblank_reply reply;
246 } drm_via_irqwait_t; 248 } drm_via_irqwait_t;
247 249
248 typedef struct drm_via_blitsync { 250 typedef struct drm_via_blitsync {
249 uint32_t sync_handle; 251 __u32 sync_handle;
250 unsigned engine; 252 unsigned engine;
251 } drm_via_blitsync_t; 253 } drm_via_blitsync_t;
252 254
253 /* - * Below,"flags" is currently unused but will be used for possible future 255 /* - * Below,"flags" is currently unused but will be used for possible future
254 * extensions like kernel space bounce buffers for bad alignments and 256 * extensions like kernel space bounce buffers for bad alignments and
255 * blit engine busy-wait polling for better latency in the absence of 257 * blit engine busy-wait polling for better latency in the absence of
256 * interrupts. 258 * interrupts.
257 */ 259 */
258 260
259 typedef struct drm_via_dmablit { 261 typedef struct drm_via_dmablit {
260 uint32_t num_lines; 262 __u32 num_lines;
261 uint32_t line_length; 263 __u32 line_length;
262 264
263 uint32_t fb_addr; 265 __u32 fb_addr;
264 uint32_t fb_stride; 266 __u32 fb_stride;
265 267
266 unsigned char *mem_addr; 268 unsigned char *mem_addr;
267 uint32_t mem_stride; 269 __u32 mem_stride;
268 270
269 uint32_t flags; 271 __u32 flags;
270 int to_fb; 272 int to_fb;
271 273
272 drm_via_blitsync_t sync; 274 drm_via_blitsync_t sync;
273 } drm_via_dmablit_t; 275 } drm_via_dmablit_t;
274 276
275 #endif /* _VIA_DRM_H_ */ 277 #endif /* _VIA_DRM_H_ */
276 278