diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /include/drm | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/Kbuild | 13 | ||||
-rw-r--r-- | include/drm/drm.h | 806 | ||||
-rw-r--r-- | include/drm/drm_mode.h | 378 | ||||
-rw-r--r-- | include/drm/drm_sarea.h | 84 | ||||
-rw-r--r-- | include/drm/drm_sman.h | 176 | ||||
-rw-r--r-- | include/drm/i810_drm.h | 281 | ||||
-rw-r--r-- | include/drm/mga_drm.h | 419 | ||||
-rw-r--r-- | include/drm/nouveau_drm.h | 218 | ||||
-rw-r--r-- | include/drm/r128_drm.h | 326 | ||||
-rw-r--r-- | include/drm/radeon_drm.h | 922 | ||||
-rw-r--r-- | include/drm/savage_drm.h | 210 | ||||
-rw-r--r-- | include/drm/sis_drm.h | 67 | ||||
-rw-r--r-- | include/drm/via_drm.h | 277 | ||||
-rw-r--r-- | include/drm/vmwgfx_drm.h | 615 |
14 files changed, 4792 insertions, 0 deletions
diff --git a/include/drm/Kbuild b/include/drm/Kbuild new file mode 100644 index 00000000000..3a60ac88952 --- /dev/null +++ b/include/drm/Kbuild | |||
@@ -0,0 +1,13 @@ | |||
1 | header-y += drm.h | ||
2 | header-y += drm_mode.h | ||
3 | header-y += drm_sarea.h | ||
4 | header-y += i810_drm.h | ||
5 | header-y += i915_drm.h | ||
6 | header-y += mga_drm.h | ||
7 | header-y += nouveau_drm.h | ||
8 | header-y += r128_drm.h | ||
9 | header-y += radeon_drm.h | ||
10 | header-y += savage_drm.h | ||
11 | header-y += sis_drm.h | ||
12 | header-y += via_drm.h | ||
13 | header-y += vmwgfx_drm.h | ||
diff --git a/include/drm/drm.h b/include/drm/drm.h new file mode 100644 index 00000000000..4be33b4ca2f --- /dev/null +++ b/include/drm/drm.h | |||
@@ -0,0 +1,806 @@ | |||
1 | /** | ||
2 | * \file drm.h | ||
3 | * Header for the Direct Rendering Manager | ||
4 | * | ||
5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> | ||
6 | * | ||
7 | * \par Acknowledgments: | ||
8 | * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | ||
13 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | ||
14 | * All rights reserved. | ||
15 | * | ||
16 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
17 | * copy of this software and associated documentation files (the "Software"), | ||
18 | * to deal in the Software without restriction, including without limitation | ||
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 | ||
21 | * Software is furnished to do so, subject to the following conditions: | ||
22 | * | ||
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 | ||
25 | * Software. | ||
26 | * | ||
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, | ||
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 | ||
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 | ||
33 | * OTHER DEALINGS IN THE SOFTWARE. | ||
34 | */ | ||
35 | |||
36 | #ifndef _DRM_H_ | ||
37 | #define _DRM_H_ | ||
38 | |||
39 | #if defined(__linux__) | ||
40 | |||
41 | #include <linux/types.h> | ||
42 | #include <asm/ioctl.h> | ||
43 | typedef unsigned int drm_handle_t; | ||
44 | |||
45 | #else /* One of the BSDs */ | ||
46 | |||
47 | #include <sys/ioccom.h> | ||
48 | #include <sys/types.h> | ||
49 | typedef int8_t __s8; | ||
50 | typedef uint8_t __u8; | ||
51 | typedef int16_t __s16; | ||
52 | typedef uint16_t __u16; | ||
53 | typedef int32_t __s32; | ||
54 | typedef uint32_t __u32; | ||
55 | typedef int64_t __s64; | ||
56 | typedef uint64_t __u64; | ||
57 | typedef unsigned long drm_handle_t; | ||
58 | |||
59 | #endif | ||
60 | |||
61 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ | ||
62 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ | ||
63 | #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ | ||
64 | #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ | ||
65 | |||
66 | #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ | ||
67 | #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ | ||
68 | #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) | ||
69 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) | ||
70 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) | ||
71 | |||
72 | typedef unsigned int drm_context_t; | ||
73 | typedef unsigned int drm_drawable_t; | ||
74 | typedef unsigned int drm_magic_t; | ||
75 | |||
76 | /** | ||
77 | * Cliprect. | ||
78 | * | ||
79 | * \warning: If you change this structure, make sure you change | ||
80 | * XF86DRIClipRectRec in the server as well | ||
81 | * | ||
82 | * \note KW: Actually it's illegal to change either for | ||
83 | * backwards-compatibility reasons. | ||
84 | */ | ||
85 | struct drm_clip_rect { | ||
86 | unsigned short x1; | ||
87 | unsigned short y1; | ||
88 | unsigned short x2; | ||
89 | unsigned short y2; | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * Drawable information. | ||
94 | */ | ||
95 | struct drm_drawable_info { | ||
96 | unsigned int num_rects; | ||
97 | struct drm_clip_rect *rects; | ||
98 | }; | ||
99 | |||
100 | /** | ||
101 | * Texture region, | ||
102 | */ | ||
103 | struct drm_tex_region { | ||
104 | unsigned char next; | ||
105 | unsigned char prev; | ||
106 | unsigned char in_use; | ||
107 | unsigned char padding; | ||
108 | unsigned int age; | ||
109 | }; | ||
110 | |||
111 | /** | ||
112 | * Hardware lock. | ||
113 | * | ||
114 | * The lock structure is a simple cache-line aligned integer. To avoid | ||
115 | * processor bus contention on a multiprocessor system, there should not be any | ||
116 | * other data stored in the same cache line. | ||
117 | */ | ||
118 | struct drm_hw_lock { | ||
119 | __volatile__ unsigned int lock; /**< lock variable */ | ||
120 | char padding[60]; /**< Pad to cache line */ | ||
121 | }; | ||
122 | |||
123 | /** | ||
124 | * DRM_IOCTL_VERSION ioctl argument type. | ||
125 | * | ||
126 | * \sa drmGetVersion(). | ||
127 | */ | ||
128 | struct drm_version { | ||
129 | int version_major; /**< Major version */ | ||
130 | int version_minor; /**< Minor version */ | ||
131 | int version_patchlevel; /**< Patch level */ | ||
132 | size_t name_len; /**< Length of name buffer */ | ||
133 | char __user *name; /**< Name of driver */ | ||
134 | size_t date_len; /**< Length of date buffer */ | ||
135 | char __user *date; /**< User-space buffer to hold date */ | ||
136 | size_t desc_len; /**< Length of desc buffer */ | ||
137 | char __user *desc; /**< User-space buffer to hold desc */ | ||
138 | }; | ||
139 | |||
140 | /** | ||
141 | * DRM_IOCTL_GET_UNIQUE ioctl argument type. | ||
142 | * | ||
143 | * \sa drmGetBusid() and drmSetBusId(). | ||
144 | */ | ||
145 | struct drm_unique { | ||
146 | size_t unique_len; /**< Length of unique */ | ||
147 | char __user *unique; /**< Unique name for driver instantiation */ | ||
148 | }; | ||
149 | |||
150 | struct drm_list { | ||
151 | int count; /**< Length of user-space structures */ | ||
152 | struct drm_version __user *version; | ||
153 | }; | ||
154 | |||
155 | struct drm_block { | ||
156 | int unused; | ||
157 | }; | ||
158 | |||
159 | /** | ||
160 | * DRM_IOCTL_CONTROL ioctl argument type. | ||
161 | * | ||
162 | * \sa drmCtlInstHandler() and drmCtlUninstHandler(). | ||
163 | */ | ||
164 | struct drm_control { | ||
165 | enum { | ||
166 | DRM_ADD_COMMAND, | ||
167 | DRM_RM_COMMAND, | ||
168 | DRM_INST_HANDLER, | ||
169 | DRM_UNINST_HANDLER | ||
170 | } func; | ||
171 | int irq; | ||
172 | }; | ||
173 | |||
174 | /** | ||
175 | * Type of memory to map. | ||
176 | */ | ||
177 | enum drm_map_type { | ||
178 | _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ | ||
179 | _DRM_REGISTERS = 1, /**< no caching, no core dump */ | ||
180 | _DRM_SHM = 2, /**< shared, cached */ | ||
181 | _DRM_AGP = 3, /**< AGP/GART */ | ||
182 | _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ | ||
183 | _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ | ||
184 | _DRM_GEM = 6, /**< GEM object */ | ||
185 | }; | ||
186 | |||
187 | /** | ||
188 | * Memory mapping flags. | ||
189 | */ | ||
190 | enum drm_map_flags { | ||
191 | _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ | ||
192 | _DRM_READ_ONLY = 0x02, | ||
193 | _DRM_LOCKED = 0x04, /**< shared, cached, locked */ | ||
194 | _DRM_KERNEL = 0x08, /**< kernel requires access */ | ||
195 | _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ | ||
196 | _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ | ||
197 | _DRM_REMOVABLE = 0x40, /**< Removable mapping */ | ||
198 | _DRM_DRIVER = 0x80 /**< Managed by driver */ | ||
199 | }; | ||
200 | |||
201 | struct drm_ctx_priv_map { | ||
202 | unsigned int ctx_id; /**< Context requesting private mapping */ | ||
203 | void *handle; /**< Handle of map */ | ||
204 | }; | ||
205 | |||
206 | /** | ||
207 | * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls | ||
208 | * argument type. | ||
209 | * | ||
210 | * \sa drmAddMap(). | ||
211 | */ | ||
212 | struct drm_map { | ||
213 | unsigned long offset; /**< Requested physical address (0 for SAREA)*/ | ||
214 | unsigned long size; /**< Requested physical size (bytes) */ | ||
215 | enum drm_map_type type; /**< Type of memory to map */ | ||
216 | enum drm_map_flags flags; /**< Flags */ | ||
217 | void *handle; /**< User-space: "Handle" to pass to mmap() */ | ||
218 | /**< Kernel-space: kernel-virtual address */ | ||
219 | int mtrr; /**< MTRR slot used */ | ||
220 | /* Private data */ | ||
221 | }; | ||
222 | |||
223 | /** | ||
224 | * DRM_IOCTL_GET_CLIENT ioctl argument type. | ||
225 | */ | ||
226 | struct drm_client { | ||
227 | int idx; /**< Which client desired? */ | ||
228 | int auth; /**< Is client authenticated? */ | ||
229 | unsigned long pid; /**< Process ID */ | ||
230 | unsigned long uid; /**< User ID */ | ||
231 | unsigned long magic; /**< Magic */ | ||
232 | unsigned long iocs; /**< Ioctl count */ | ||
233 | }; | ||
234 | |||
235 | enum drm_stat_type { | ||
236 | _DRM_STAT_LOCK, | ||
237 | _DRM_STAT_OPENS, | ||
238 | _DRM_STAT_CLOSES, | ||
239 | _DRM_STAT_IOCTLS, | ||
240 | _DRM_STAT_LOCKS, | ||
241 | _DRM_STAT_UNLOCKS, | ||
242 | _DRM_STAT_VALUE, /**< Generic value */ | ||
243 | _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ | ||
244 | _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ | ||
245 | |||
246 | _DRM_STAT_IRQ, /**< IRQ */ | ||
247 | _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ | ||
248 | _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ | ||
249 | _DRM_STAT_DMA, /**< DMA */ | ||
250 | _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ | ||
251 | _DRM_STAT_MISSED /**< Missed DMA opportunity */ | ||
252 | /* Add to the *END* of the list */ | ||
253 | }; | ||
254 | |||
255 | /** | ||
256 | * DRM_IOCTL_GET_STATS ioctl argument type. | ||
257 | */ | ||
258 | struct drm_stats { | ||
259 | unsigned long count; | ||
260 | struct { | ||
261 | unsigned long value; | ||
262 | enum drm_stat_type type; | ||
263 | } data[15]; | ||
264 | }; | ||
265 | |||
266 | /** | ||
267 | * Hardware locking flags. | ||
268 | */ | ||
269 | enum drm_lock_flags { | ||
270 | _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ | ||
271 | _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ | ||
272 | _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ | ||
273 | _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ | ||
274 | /* These *HALT* flags aren't supported yet | ||
275 | -- they will be used to support the | ||
276 | full-screen DGA-like mode. */ | ||
277 | _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ | ||
278 | _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ | ||
279 | }; | ||
280 | |||
281 | /** | ||
282 | * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. | ||
283 | * | ||
284 | * \sa drmGetLock() and drmUnlock(). | ||
285 | */ | ||
286 | struct drm_lock { | ||
287 | int context; | ||
288 | enum drm_lock_flags flags; | ||
289 | }; | ||
290 | |||
291 | /** | ||
292 | * DMA flags | ||
293 | * | ||
294 | * \warning | ||
295 | * These values \e must match xf86drm.h. | ||
296 | * | ||
297 | * \sa drm_dma. | ||
298 | */ | ||
299 | enum drm_dma_flags { | ||
300 | /* Flags for DMA buffer dispatch */ | ||
301 | _DRM_DMA_BLOCK = 0x01, /**< | ||
302 | * Block until buffer dispatched. | ||
303 | * | ||
304 | * \note The buffer may not yet have | ||
305 | * been processed by the hardware -- | ||
306 | * getting a hardware lock with the | ||
307 | * hardware quiescent will ensure | ||
308 | * that the buffer has been | ||
309 | * processed. | ||
310 | */ | ||
311 | _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ | ||
312 | _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ | ||
313 | |||
314 | /* Flags for DMA buffer request */ | ||
315 | _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ | ||
316 | _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ | ||
317 | _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ | ||
318 | }; | ||
319 | |||
320 | /** | ||
321 | * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. | ||
322 | * | ||
323 | * \sa drmAddBufs(). | ||
324 | */ | ||
325 | struct drm_buf_desc { | ||
326 | int count; /**< Number of buffers of this size */ | ||
327 | int size; /**< Size in bytes */ | ||
328 | int low_mark; /**< Low water mark */ | ||
329 | int high_mark; /**< High water mark */ | ||
330 | enum { | ||
331 | _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ | ||
332 | _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ | ||
333 | _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ | ||
334 | _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ | ||
335 | _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ | ||
336 | } flags; | ||
337 | unsigned long agp_start; /**< | ||
338 | * Start address of where the AGP buffers are | ||
339 | * in the AGP aperture | ||
340 | */ | ||
341 | }; | ||
342 | |||
343 | /** | ||
344 | * DRM_IOCTL_INFO_BUFS ioctl argument type. | ||
345 | */ | ||
346 | struct drm_buf_info { | ||
347 | int count; /**< Entries in list */ | ||
348 | struct drm_buf_desc __user *list; | ||
349 | }; | ||
350 | |||
351 | /** | ||
352 | * DRM_IOCTL_FREE_BUFS ioctl argument type. | ||
353 | */ | ||
354 | struct drm_buf_free { | ||
355 | int count; | ||
356 | int __user *list; | ||
357 | }; | ||
358 | |||
359 | /** | ||
360 | * Buffer information | ||
361 | * | ||
362 | * \sa drm_buf_map. | ||
363 | */ | ||
364 | struct drm_buf_pub { | ||
365 | int idx; /**< Index into the master buffer list */ | ||
366 | int total; /**< Buffer size */ | ||
367 | int used; /**< Amount of buffer in use (for DMA) */ | ||
368 | void __user *address; /**< Address of buffer */ | ||
369 | }; | ||
370 | |||
371 | /** | ||
372 | * DRM_IOCTL_MAP_BUFS ioctl argument type. | ||
373 | */ | ||
374 | struct drm_buf_map { | ||
375 | int count; /**< Length of the buffer list */ | ||
376 | void __user *virtual; /**< Mmap'd area in user-virtual */ | ||
377 | struct drm_buf_pub __user *list; /**< Buffer information */ | ||
378 | }; | ||
379 | |||
380 | /** | ||
381 | * DRM_IOCTL_DMA ioctl argument type. | ||
382 | * | ||
383 | * Indices here refer to the offset into the buffer list in drm_buf_get. | ||
384 | * | ||
385 | * \sa drmDMA(). | ||
386 | */ | ||
387 | struct drm_dma { | ||
388 | int context; /**< Context handle */ | ||
389 | int send_count; /**< Number of buffers to send */ | ||
390 | int __user *send_indices; /**< List of handles to buffers */ | ||
391 | int __user *send_sizes; /**< Lengths of data to send */ | ||
392 | enum drm_dma_flags flags; /**< Flags */ | ||
393 | int request_count; /**< Number of buffers requested */ | ||
394 | int request_size; /**< Desired size for buffers */ | ||
395 | int __user *request_indices; /**< Buffer information */ | ||
396 | int __user *request_sizes; | ||
397 | int granted_count; /**< Number of buffers granted */ | ||
398 | }; | ||
399 | |||
400 | enum drm_ctx_flags { | ||
401 | _DRM_CONTEXT_PRESERVED = 0x01, | ||
402 | _DRM_CONTEXT_2DONLY = 0x02 | ||
403 | }; | ||
404 | |||
405 | /** | ||
406 | * DRM_IOCTL_ADD_CTX ioctl argument type. | ||
407 | * | ||
408 | * \sa drmCreateContext() and drmDestroyContext(). | ||
409 | */ | ||
410 | struct drm_ctx { | ||
411 | drm_context_t handle; | ||
412 | enum drm_ctx_flags flags; | ||
413 | }; | ||
414 | |||
415 | /** | ||
416 | * DRM_IOCTL_RES_CTX ioctl argument type. | ||
417 | */ | ||
418 | struct drm_ctx_res { | ||
419 | int count; | ||
420 | struct drm_ctx __user *contexts; | ||
421 | }; | ||
422 | |||
423 | /** | ||
424 | * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. | ||
425 | */ | ||
426 | struct drm_draw { | ||
427 | drm_drawable_t handle; | ||
428 | }; | ||
429 | |||
430 | /** | ||
431 | * DRM_IOCTL_UPDATE_DRAW ioctl argument type. | ||
432 | */ | ||
433 | typedef enum { | ||
434 | DRM_DRAWABLE_CLIPRECTS, | ||
435 | } drm_drawable_info_type_t; | ||
436 | |||
437 | struct drm_update_draw { | ||
438 | drm_drawable_t handle; | ||
439 | unsigned int type; | ||
440 | unsigned int num; | ||
441 | unsigned long long data; | ||
442 | }; | ||
443 | |||
444 | /** | ||
445 | * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. | ||
446 | */ | ||
447 | struct drm_auth { | ||
448 | drm_magic_t magic; | ||
449 | }; | ||
450 | |||
451 | /** | ||
452 | * DRM_IOCTL_IRQ_BUSID ioctl argument type. | ||
453 | * | ||
454 | * \sa drmGetInterruptFromBusID(). | ||
455 | */ | ||
456 | struct drm_irq_busid { | ||
457 | int irq; /**< IRQ number */ | ||
458 | int busnum; /**< bus number */ | ||
459 | int devnum; /**< device number */ | ||
460 | int funcnum; /**< function number */ | ||
461 | }; | ||
462 | |||
463 | enum drm_vblank_seq_type { | ||
464 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ | ||
465 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ | ||
466 | /* bits 1-6 are reserved for high crtcs */ | ||
467 | _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, | ||
468 | _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ | ||
469 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ | ||
470 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ | ||
471 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ | ||
472 | _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ | ||
473 | }; | ||
474 | #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 | ||
475 | |||
476 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) | ||
477 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ | ||
478 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) | ||
479 | |||
480 | struct drm_wait_vblank_request { | ||
481 | enum drm_vblank_seq_type type; | ||
482 | unsigned int sequence; | ||
483 | unsigned long signal; | ||
484 | }; | ||
485 | |||
486 | struct drm_wait_vblank_reply { | ||
487 | enum drm_vblank_seq_type type; | ||
488 | unsigned int sequence; | ||
489 | long tval_sec; | ||
490 | long tval_usec; | ||
491 | }; | ||
492 | |||
493 | /** | ||
494 | * DRM_IOCTL_WAIT_VBLANK ioctl argument type. | ||
495 | * | ||
496 | * \sa drmWaitVBlank(). | ||
497 | */ | ||
498 | union drm_wait_vblank { | ||
499 | struct drm_wait_vblank_request request; | ||
500 | struct drm_wait_vblank_reply reply; | ||
501 | }; | ||
502 | |||
503 | #define _DRM_PRE_MODESET 1 | ||
504 | #define _DRM_POST_MODESET 2 | ||
505 | |||
506 | /** | ||
507 | * DRM_IOCTL_MODESET_CTL ioctl argument type | ||
508 | * | ||
509 | * \sa drmModesetCtl(). | ||
510 | */ | ||
511 | struct drm_modeset_ctl { | ||
512 | __u32 crtc; | ||
513 | __u32 cmd; | ||
514 | }; | ||
515 | |||
516 | /** | ||
517 | * DRM_IOCTL_AGP_ENABLE ioctl argument type. | ||
518 | * | ||
519 | * \sa drmAgpEnable(). | ||
520 | */ | ||
521 | struct drm_agp_mode { | ||
522 | unsigned long mode; /**< AGP mode */ | ||
523 | }; | ||
524 | |||
525 | /** | ||
526 | * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. | ||
527 | * | ||
528 | * \sa drmAgpAlloc() and drmAgpFree(). | ||
529 | */ | ||
530 | struct drm_agp_buffer { | ||
531 | unsigned long size; /**< In bytes -- will round to page boundary */ | ||
532 | unsigned long handle; /**< Used for binding / unbinding */ | ||
533 | unsigned long type; /**< Type of memory to allocate */ | ||
534 | unsigned long physical; /**< Physical used by i810 */ | ||
535 | }; | ||
536 | |||
537 | /** | ||
538 | * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. | ||
539 | * | ||
540 | * \sa drmAgpBind() and drmAgpUnbind(). | ||
541 | */ | ||
542 | struct drm_agp_binding { | ||
543 | unsigned long handle; /**< From drm_agp_buffer */ | ||
544 | unsigned long offset; /**< In bytes -- will round to page boundary */ | ||
545 | }; | ||
546 | |||
547 | /** | ||
548 | * DRM_IOCTL_AGP_INFO ioctl argument type. | ||
549 | * | ||
550 | * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), | ||
551 | * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), | ||
552 | * drmAgpVendorId() and drmAgpDeviceId(). | ||
553 | */ | ||
554 | struct drm_agp_info { | ||
555 | int agp_version_major; | ||
556 | int agp_version_minor; | ||
557 | unsigned long mode; | ||
558 | unsigned long aperture_base; /* physical address */ | ||
559 | unsigned long aperture_size; /* bytes */ | ||
560 | unsigned long memory_allowed; /* bytes */ | ||
561 | unsigned long memory_used; | ||
562 | |||
563 | /* PCI information */ | ||
564 | unsigned short id_vendor; | ||
565 | unsigned short id_device; | ||
566 | }; | ||
567 | |||
568 | /** | ||
569 | * DRM_IOCTL_SG_ALLOC ioctl argument type. | ||
570 | */ | ||
571 | struct drm_scatter_gather { | ||
572 | unsigned long size; /**< In bytes -- will round to page boundary */ | ||
573 | unsigned long handle; /**< Used for mapping / unmapping */ | ||
574 | }; | ||
575 | |||
576 | /** | ||
577 | * DRM_IOCTL_SET_VERSION ioctl argument type. | ||
578 | */ | ||
579 | struct drm_set_version { | ||
580 | int drm_di_major; | ||
581 | int drm_di_minor; | ||
582 | int drm_dd_major; | ||
583 | int drm_dd_minor; | ||
584 | }; | ||
585 | |||
586 | /** DRM_IOCTL_GEM_CLOSE ioctl argument type */ | ||
587 | struct drm_gem_close { | ||
588 | /** Handle of the object to be closed. */ | ||
589 | __u32 handle; | ||
590 | __u32 pad; | ||
591 | }; | ||
592 | |||
593 | /** DRM_IOCTL_GEM_FLINK ioctl argument type */ | ||
594 | struct drm_gem_flink { | ||
595 | /** Handle for the object being named */ | ||
596 | __u32 handle; | ||
597 | |||
598 | /** Returned global name */ | ||
599 | __u32 name; | ||
600 | }; | ||
601 | |||
602 | /** DRM_IOCTL_GEM_OPEN ioctl argument type */ | ||
603 | struct drm_gem_open { | ||
604 | /** Name of object being opened */ | ||
605 | __u32 name; | ||
606 | |||
607 | /** Returned handle for the object */ | ||
608 | __u32 handle; | ||
609 | |||
610 | /** Returned size of the object */ | ||
611 | __u64 size; | ||
612 | }; | ||
613 | |||
614 | /** DRM_IOCTL_GET_CAP ioctl argument type */ | ||
615 | struct drm_get_cap { | ||
616 | __u64 capability; | ||
617 | __u64 value; | ||
618 | }; | ||
619 | |||
620 | #include "drm_mode.h" | ||
621 | |||
622 | #define DRM_IOCTL_BASE 'd' | ||
623 | #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) | ||
624 | #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) | ||
625 | #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) | ||
626 | #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) | ||
627 | |||
628 | #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) | ||
629 | #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) | ||
630 | #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) | ||
631 | #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) | ||
632 | #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) | ||
633 | #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) | ||
634 | #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) | ||
635 | #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) | ||
636 | #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) | ||
637 | #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) | ||
638 | #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) | ||
639 | #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) | ||
640 | #define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) | ||
641 | |||
642 | #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) | ||
643 | #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) | ||
644 | #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) | ||
645 | #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) | ||
646 | #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) | ||
647 | #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) | ||
648 | #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) | ||
649 | #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) | ||
650 | #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) | ||
651 | #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) | ||
652 | #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) | ||
653 | |||
654 | #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) | ||
655 | |||
656 | #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) | ||
657 | #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) | ||
658 | |||
659 | #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) | ||
660 | #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) | ||
661 | |||
662 | #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) | ||
663 | #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) | ||
664 | #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) | ||
665 | #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) | ||
666 | #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) | ||
667 | #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) | ||
668 | #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) | ||
669 | #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) | ||
670 | #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) | ||
671 | #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) | ||
672 | #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) | ||
673 | #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) | ||
674 | #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) | ||
675 | |||
676 | #define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open) | ||
677 | |||
678 | #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) | ||
679 | #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) | ||
680 | #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) | ||
681 | #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) | ||
682 | #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) | ||
683 | #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) | ||
684 | #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) | ||
685 | #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) | ||
686 | |||
687 | #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) | ||
688 | #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) | ||
689 | |||
690 | #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) | ||
691 | |||
692 | #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) | ||
693 | |||
694 | #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) | ||
695 | #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) | ||
696 | #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) | ||
697 | #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) | ||
698 | #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) | ||
699 | #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) | ||
700 | #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) | ||
701 | #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) | ||
702 | #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) | ||
703 | #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) | ||
704 | |||
705 | #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) | ||
706 | #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) | ||
707 | #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) | ||
708 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) | ||
709 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) | ||
710 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) | ||
711 | #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) | ||
712 | #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) | ||
713 | |||
714 | #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) | ||
715 | #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) | ||
716 | #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) | ||
717 | |||
718 | /** | ||
719 | * Device specific ioctls should only be in their respective headers | ||
720 | * The device specific ioctl range is from 0x40 to 0x99. | ||
721 | * Generic IOCTLS restart at 0xA0. | ||
722 | * | ||
723 | * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and | ||
724 | * drmCommandReadWrite(). | ||
725 | */ | ||
726 | #define DRM_COMMAND_BASE 0x40 | ||
727 | #define DRM_COMMAND_END 0xA0 | ||
728 | |||
729 | /** | ||
730 | * Header for events written back to userspace on the drm fd. The | ||
731 | * type defines the type of event, the length specifies the total | ||
732 | * length of the event (including the header), and user_data is | ||
733 | * typically a 64 bit value passed with the ioctl that triggered the | ||
734 | * event. A read on the drm fd will always only return complete | ||
735 | * events, that is, if for example the read buffer is 100 bytes, and | ||
736 | * there are two 64 byte events pending, only one will be returned. | ||
737 | * | ||
738 | * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and | ||
739 | * up are chipset specific. | ||
740 | */ | ||
741 | struct drm_event { | ||
742 | __u32 type; | ||
743 | __u32 length; | ||
744 | }; | ||
745 | |||
746 | #define DRM_EVENT_VBLANK 0x01 | ||
747 | #define DRM_EVENT_FLIP_COMPLETE 0x02 | ||
748 | |||
749 | struct drm_event_vblank { | ||
750 | struct drm_event base; | ||
751 | __u64 user_data; | ||
752 | __u32 tv_sec; | ||
753 | __u32 tv_usec; | ||
754 | __u32 sequence; | ||
755 | __u32 reserved; | ||
756 | }; | ||
757 | |||
758 | #define DRM_CAP_DUMB_BUFFER 0x1 | ||
759 | #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 | ||
760 | |||
761 | /* typedef area */ | ||
762 | #ifndef __KERNEL__ | ||
763 | typedef struct drm_clip_rect drm_clip_rect_t; | ||
764 | typedef struct drm_drawable_info drm_drawable_info_t; | ||
765 | typedef struct drm_tex_region drm_tex_region_t; | ||
766 | typedef struct drm_hw_lock drm_hw_lock_t; | ||
767 | typedef struct drm_version drm_version_t; | ||
768 | typedef struct drm_unique drm_unique_t; | ||
769 | typedef struct drm_list drm_list_t; | ||
770 | typedef struct drm_block drm_block_t; | ||
771 | typedef struct drm_control drm_control_t; | ||
772 | typedef enum drm_map_type drm_map_type_t; | ||
773 | typedef enum drm_map_flags drm_map_flags_t; | ||
774 | typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; | ||
775 | typedef struct drm_map drm_map_t; | ||
776 | typedef struct drm_client drm_client_t; | ||
777 | typedef enum drm_stat_type drm_stat_type_t; | ||
778 | typedef struct drm_stats drm_stats_t; | ||
779 | typedef enum drm_lock_flags drm_lock_flags_t; | ||
780 | typedef struct drm_lock drm_lock_t; | ||
781 | typedef enum drm_dma_flags drm_dma_flags_t; | ||
782 | typedef struct drm_buf_desc drm_buf_desc_t; | ||
783 | typedef struct drm_buf_info drm_buf_info_t; | ||
784 | typedef struct drm_buf_free drm_buf_free_t; | ||
785 | typedef struct drm_buf_pub drm_buf_pub_t; | ||
786 | typedef struct drm_buf_map drm_buf_map_t; | ||
787 | typedef struct drm_dma drm_dma_t; | ||
788 | typedef union drm_wait_vblank drm_wait_vblank_t; | ||
789 | typedef struct drm_agp_mode drm_agp_mode_t; | ||
790 | typedef enum drm_ctx_flags drm_ctx_flags_t; | ||
791 | typedef struct drm_ctx drm_ctx_t; | ||
792 | typedef struct drm_ctx_res drm_ctx_res_t; | ||
793 | typedef struct drm_draw drm_draw_t; | ||
794 | typedef struct drm_update_draw drm_update_draw_t; | ||
795 | typedef struct drm_auth drm_auth_t; | ||
796 | typedef struct drm_irq_busid drm_irq_busid_t; | ||
797 | typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; | ||
798 | |||
799 | typedef struct drm_agp_buffer drm_agp_buffer_t; | ||
800 | typedef struct drm_agp_binding drm_agp_binding_t; | ||
801 | typedef struct drm_agp_info drm_agp_info_t; | ||
802 | typedef struct drm_scatter_gather drm_scatter_gather_t; | ||
803 | typedef struct drm_set_version drm_set_version_t; | ||
804 | #endif | ||
805 | |||
806 | #endif | ||
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h new file mode 100644 index 00000000000..53dfa1098b9 --- /dev/null +++ b/include/drm/drm_mode.h | |||
@@ -0,0 +1,378 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> | ||
3 | * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com> | ||
4 | * Copyright (c) 2008 Red Hat Inc. | ||
5 | * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA | ||
6 | * Copyright (c) 2007-2008 Intel Corporation | ||
7 | * | ||
8 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | * copy of this software and associated documentation files (the "Software"), | ||
10 | * to deal in the Software without restriction, including without limitation | ||
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 | ||
13 | * Software is furnished to do so, subject to the following conditions: | ||
14 | * | ||
15 | * The above copyright notice and this permission notice shall be included in | ||
16 | * all copies or substantial portions of the Software. | ||
17 | * | ||
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, | ||
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 | ||
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 | ||
24 | * IN THE SOFTWARE. | ||
25 | */ | ||
26 | |||
27 | #ifndef _DRM_MODE_H | ||
28 | #define _DRM_MODE_H | ||
29 | |||
30 | #define DRM_DISPLAY_INFO_LEN 32 | ||
31 | #define DRM_CONNECTOR_NAME_LEN 32 | ||
32 | #define DRM_DISPLAY_MODE_LEN 32 | ||
33 | #define DRM_PROP_NAME_LEN 32 | ||
34 | |||
35 | #define DRM_MODE_TYPE_BUILTIN (1<<0) | ||
36 | #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) | ||
37 | #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) | ||
38 | #define DRM_MODE_TYPE_PREFERRED (1<<3) | ||
39 | #define DRM_MODE_TYPE_DEFAULT (1<<4) | ||
40 | #define DRM_MODE_TYPE_USERDEF (1<<5) | ||
41 | #define DRM_MODE_TYPE_DRIVER (1<<6) | ||
42 | |||
43 | /* Video mode flags */ | ||
44 | /* bit compatible with the xorg definitions. */ | ||
45 | #define DRM_MODE_FLAG_PHSYNC (1<<0) | ||
46 | #define DRM_MODE_FLAG_NHSYNC (1<<1) | ||
47 | #define DRM_MODE_FLAG_PVSYNC (1<<2) | ||
48 | #define DRM_MODE_FLAG_NVSYNC (1<<3) | ||
49 | #define DRM_MODE_FLAG_INTERLACE (1<<4) | ||
50 | #define DRM_MODE_FLAG_DBLSCAN (1<<5) | ||
51 | #define DRM_MODE_FLAG_CSYNC (1<<6) | ||
52 | #define DRM_MODE_FLAG_PCSYNC (1<<7) | ||
53 | #define DRM_MODE_FLAG_NCSYNC (1<<8) | ||
54 | #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ | ||
55 | #define DRM_MODE_FLAG_BCAST (1<<10) | ||
56 | #define DRM_MODE_FLAG_PIXMUX (1<<11) | ||
57 | #define DRM_MODE_FLAG_DBLCLK (1<<12) | ||
58 | #define DRM_MODE_FLAG_CLKDIV2 (1<<13) | ||
59 | |||
60 | /* DPMS flags */ | ||
61 | /* bit compatible with the xorg definitions. */ | ||
62 | #define DRM_MODE_DPMS_ON 0 | ||
63 | #define DRM_MODE_DPMS_STANDBY 1 | ||
64 | #define DRM_MODE_DPMS_SUSPEND 2 | ||
65 | #define DRM_MODE_DPMS_OFF 3 | ||
66 | |||
67 | /* Scaling mode options */ | ||
68 | #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or | ||
69 | software can still scale) */ | ||
70 | #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */ | ||
71 | #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ | ||
72 | #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ | ||
73 | |||
74 | /* Dithering mode options */ | ||
75 | #define DRM_MODE_DITHERING_OFF 0 | ||
76 | #define DRM_MODE_DITHERING_ON 1 | ||
77 | #define DRM_MODE_DITHERING_AUTO 2 | ||
78 | |||
79 | /* Dirty info options */ | ||
80 | #define DRM_MODE_DIRTY_OFF 0 | ||
81 | #define DRM_MODE_DIRTY_ON 1 | ||
82 | #define DRM_MODE_DIRTY_ANNOTATE 2 | ||
83 | |||
84 | struct drm_mode_modeinfo { | ||
85 | __u32 clock; | ||
86 | __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; | ||
87 | __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; | ||
88 | |||
89 | __u32 vrefresh; | ||
90 | |||
91 | __u32 flags; | ||
92 | __u32 type; | ||
93 | char name[DRM_DISPLAY_MODE_LEN]; | ||
94 | }; | ||
95 | |||
96 | struct drm_mode_card_res { | ||
97 | __u64 fb_id_ptr; | ||
98 | __u64 crtc_id_ptr; | ||
99 | __u64 connector_id_ptr; | ||
100 | __u64 encoder_id_ptr; | ||
101 | __u32 count_fbs; | ||
102 | __u32 count_crtcs; | ||
103 | __u32 count_connectors; | ||
104 | __u32 count_encoders; | ||
105 | __u32 min_width, max_width; | ||
106 | __u32 min_height, max_height; | ||
107 | }; | ||
108 | |||
109 | struct drm_mode_crtc { | ||
110 | __u64 set_connectors_ptr; | ||
111 | __u32 count_connectors; | ||
112 | |||
113 | __u32 crtc_id; /**< Id */ | ||
114 | __u32 fb_id; /**< Id of framebuffer */ | ||
115 | |||
116 | __u32 x, y; /**< Position on the frameuffer */ | ||
117 | |||
118 | __u32 gamma_size; | ||
119 | __u32 mode_valid; | ||
120 | struct drm_mode_modeinfo mode; | ||
121 | }; | ||
122 | |||
123 | #define DRM_MODE_ENCODER_NONE 0 | ||
124 | #define DRM_MODE_ENCODER_DAC 1 | ||
125 | #define DRM_MODE_ENCODER_TMDS 2 | ||
126 | #define DRM_MODE_ENCODER_LVDS 3 | ||
127 | #define DRM_MODE_ENCODER_TVDAC 4 | ||
128 | |||
129 | struct drm_mode_get_encoder { | ||
130 | __u32 encoder_id; | ||
131 | __u32 encoder_type; | ||
132 | |||
133 | __u32 crtc_id; /**< Id of crtc */ | ||
134 | |||
135 | __u32 possible_crtcs; | ||
136 | __u32 possible_clones; | ||
137 | }; | ||
138 | |||
139 | /* This is for connectors with multiple signal types. */ | ||
140 | /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ | ||
141 | #define DRM_MODE_SUBCONNECTOR_Automatic 0 | ||
142 | #define DRM_MODE_SUBCONNECTOR_Unknown 0 | ||
143 | #define DRM_MODE_SUBCONNECTOR_DVID 3 | ||
144 | #define DRM_MODE_SUBCONNECTOR_DVIA 4 | ||
145 | #define DRM_MODE_SUBCONNECTOR_Composite 5 | ||
146 | #define DRM_MODE_SUBCONNECTOR_SVIDEO 6 | ||
147 | #define DRM_MODE_SUBCONNECTOR_Component 8 | ||
148 | #define DRM_MODE_SUBCONNECTOR_SCART 9 | ||
149 | |||
150 | #define DRM_MODE_CONNECTOR_Unknown 0 | ||
151 | #define DRM_MODE_CONNECTOR_VGA 1 | ||
152 | #define DRM_MODE_CONNECTOR_DVII 2 | ||
153 | #define DRM_MODE_CONNECTOR_DVID 3 | ||
154 | #define DRM_MODE_CONNECTOR_DVIA 4 | ||
155 | #define DRM_MODE_CONNECTOR_Composite 5 | ||
156 | #define DRM_MODE_CONNECTOR_SVIDEO 6 | ||
157 | #define DRM_MODE_CONNECTOR_LVDS 7 | ||
158 | #define DRM_MODE_CONNECTOR_Component 8 | ||
159 | #define DRM_MODE_CONNECTOR_9PinDIN 9 | ||
160 | #define DRM_MODE_CONNECTOR_DisplayPort 10 | ||
161 | #define DRM_MODE_CONNECTOR_HDMIA 11 | ||
162 | #define DRM_MODE_CONNECTOR_HDMIB 12 | ||
163 | #define DRM_MODE_CONNECTOR_TV 13 | ||
164 | #define DRM_MODE_CONNECTOR_eDP 14 | ||
165 | |||
166 | struct drm_mode_get_connector { | ||
167 | |||
168 | __u64 encoders_ptr; | ||
169 | __u64 modes_ptr; | ||
170 | __u64 props_ptr; | ||
171 | __u64 prop_values_ptr; | ||
172 | |||
173 | __u32 count_modes; | ||
174 | __u32 count_props; | ||
175 | __u32 count_encoders; | ||
176 | |||
177 | __u32 encoder_id; /**< Current Encoder */ | ||
178 | __u32 connector_id; /**< Id */ | ||
179 | __u32 connector_type; | ||
180 | __u32 connector_type_id; | ||
181 | |||
182 | __u32 connection; | ||
183 | __u32 mm_width, mm_height; /**< HxW in millimeters */ | ||
184 | __u32 subpixel; | ||
185 | }; | ||
186 | |||
187 | #define DRM_MODE_PROP_PENDING (1<<0) | ||
188 | #define DRM_MODE_PROP_RANGE (1<<1) | ||
189 | #define DRM_MODE_PROP_IMMUTABLE (1<<2) | ||
190 | #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ | ||
191 | #define DRM_MODE_PROP_BLOB (1<<4) | ||
192 | |||
193 | struct drm_mode_property_enum { | ||
194 | __u64 value; | ||
195 | char name[DRM_PROP_NAME_LEN]; | ||
196 | }; | ||
197 | |||
198 | struct drm_mode_get_property { | ||
199 | __u64 values_ptr; /* values and blob lengths */ | ||
200 | __u64 enum_blob_ptr; /* enum and blob id ptrs */ | ||
201 | |||
202 | __u32 prop_id; | ||
203 | __u32 flags; | ||
204 | char name[DRM_PROP_NAME_LEN]; | ||
205 | |||
206 | __u32 count_values; | ||
207 | __u32 count_enum_blobs; | ||
208 | }; | ||
209 | |||
210 | struct drm_mode_connector_set_property { | ||
211 | __u64 value; | ||
212 | __u32 prop_id; | ||
213 | __u32 connector_id; | ||
214 | }; | ||
215 | |||
216 | struct drm_mode_get_blob { | ||
217 | __u32 blob_id; | ||
218 | __u32 length; | ||
219 | __u64 data; | ||
220 | }; | ||
221 | |||
222 | struct drm_mode_fb_cmd { | ||
223 | __u32 fb_id; | ||
224 | __u32 width, height; | ||
225 | __u32 pitch; | ||
226 | __u32 bpp; | ||
227 | __u32 depth; | ||
228 | /* driver specific handle */ | ||
229 | __u32 handle; | ||
230 | }; | ||
231 | |||
232 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 | ||
233 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 | ||
234 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 | ||
235 | |||
236 | #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256 | ||
237 | |||
238 | /* | ||
239 | * Mark a region of a framebuffer as dirty. | ||
240 | * | ||
241 | * Some hardware does not automatically update display contents | ||
242 | * as a hardware or software draw to a framebuffer. This ioctl | ||
243 | * allows userspace to tell the kernel and the hardware what | ||
244 | * regions of the framebuffer have changed. | ||
245 | * | ||
246 | * The kernel or hardware is free to update more then just the | ||
247 | * region specified by the clip rects. The kernel or hardware | ||
248 | * may also delay and/or coalesce several calls to dirty into a | ||
249 | * single update. | ||
250 | * | ||
251 | * Userspace may annotate the updates, the annotates are a | ||
252 | * promise made by the caller that the change is either a copy | ||
253 | * of pixels or a fill of a single color in the region specified. | ||
254 | * | ||
255 | * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then | ||
256 | * the number of updated regions are half of num_clips given, | ||
257 | * where the clip rects are paired in src and dst. The width and | ||
258 | * height of each one of the pairs must match. | ||
259 | * | ||
260 | * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller | ||
261 | * promises that the region specified of the clip rects is filled | ||
262 | * completely with a single color as given in the color argument. | ||
263 | */ | ||
264 | |||
265 | struct drm_mode_fb_dirty_cmd { | ||
266 | __u32 fb_id; | ||
267 | __u32 flags; | ||
268 | __u32 color; | ||
269 | __u32 num_clips; | ||
270 | __u64 clips_ptr; | ||
271 | }; | ||
272 | |||
273 | struct drm_mode_mode_cmd { | ||
274 | __u32 connector_id; | ||
275 | struct drm_mode_modeinfo mode; | ||
276 | }; | ||
277 | |||
278 | #define DRM_MODE_CURSOR_BO (1<<0) | ||
279 | #define DRM_MODE_CURSOR_MOVE (1<<1) | ||
280 | |||
281 | /* | ||
282 | * depending on the value in flags different members are used. | ||
283 | * | ||
284 | * CURSOR_BO uses | ||
285 | * crtc | ||
286 | * width | ||
287 | * height | ||
288 | * handle - if 0 turns the cursor of | ||
289 | * | ||
290 | * CURSOR_MOVE uses | ||
291 | * crtc | ||
292 | * x | ||
293 | * y | ||
294 | */ | ||
295 | struct drm_mode_cursor { | ||
296 | __u32 flags; | ||
297 | __u32 crtc_id; | ||
298 | __s32 x; | ||
299 | __s32 y; | ||
300 | __u32 width; | ||
301 | __u32 height; | ||
302 | /* driver specific handle */ | ||
303 | __u32 handle; | ||
304 | }; | ||
305 | |||
306 | struct drm_mode_crtc_lut { | ||
307 | __u32 crtc_id; | ||
308 | __u32 gamma_size; | ||
309 | |||
310 | /* pointers to arrays */ | ||
311 | __u64 red; | ||
312 | __u64 green; | ||
313 | __u64 blue; | ||
314 | }; | ||
315 | |||
316 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | ||
317 | #define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT | ||
318 | |||
319 | /* | ||
320 | * Request a page flip on the specified crtc. | ||
321 | * | ||
322 | * This ioctl will ask KMS to schedule a page flip for the specified | ||
323 | * crtc. Once any pending rendering targeting the specified fb (as of | ||
324 | * ioctl time) has completed, the crtc will be reprogrammed to display | ||
325 | * that fb after the next vertical refresh. The ioctl returns | ||
326 | * immediately, but subsequent rendering to the current fb will block | ||
327 | * in the execbuffer ioctl until the page flip happens. If a page | ||
328 | * flip is already pending as the ioctl is called, EBUSY will be | ||
329 | * returned. | ||
330 | * | ||
331 | * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will | ||
332 | * request that drm sends back a vblank event (see drm.h: struct | ||
333 | * drm_event_vblank) when the page flip is done. The user_data field | ||
334 | * passed in with this ioctl will be returned as the user_data field | ||
335 | * in the vblank event struct. | ||
336 | * | ||
337 | * The reserved field must be zero until we figure out something | ||
338 | * clever to use it for. | ||
339 | */ | ||
340 | |||
341 | struct drm_mode_crtc_page_flip { | ||
342 | __u32 crtc_id; | ||
343 | __u32 fb_id; | ||
344 | __u32 flags; | ||
345 | __u32 reserved; | ||
346 | __u64 user_data; | ||
347 | }; | ||
348 | |||
349 | /* create a dumb scanout buffer */ | ||
350 | struct drm_mode_create_dumb { | ||
351 | uint32_t height; | ||
352 | uint32_t width; | ||
353 | uint32_t bpp; | ||
354 | uint32_t flags; | ||
355 | /* handle, pitch, size will be returned */ | ||
356 | uint32_t handle; | ||
357 | uint32_t pitch; | ||
358 | uint64_t size; | ||
359 | }; | ||
360 | |||
361 | /* set up for mmap of a dumb scanout buffer */ | ||
362 | struct drm_mode_map_dumb { | ||
363 | /** Handle for the object being mapped. */ | ||
364 | __u32 handle; | ||
365 | __u32 pad; | ||
366 | /** | ||
367 | * Fake offset to use for subsequent mmap call | ||
368 | * | ||
369 | * This is a fixed-size type for 32/64 compatibility. | ||
370 | */ | ||
371 | __u64 offset; | ||
372 | }; | ||
373 | |||
374 | struct drm_mode_destroy_dumb { | ||
375 | uint32_t handle; | ||
376 | }; | ||
377 | |||
378 | #endif | ||
diff --git a/include/drm/drm_sarea.h b/include/drm/drm_sarea.h new file mode 100644 index 00000000000..ee5389d22c6 --- /dev/null +++ b/include/drm/drm_sarea.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /** | ||
2 | * \file drm_sarea.h | ||
3 | * \brief SAREA definitions | ||
4 | * | ||
5 | * \author Michel Dänzer <michel@daenzer.net> | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. | ||
10 | * All Rights Reserved. | ||
11 | * | ||
12 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
13 | * copy of this software and associated documentation files (the "Software"), | ||
14 | * to deal in the Software without restriction, including without limitation | ||
15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
16 | * and/or sell copies of the Software, and to permit persons to whom the | ||
17 | * Software is furnished to do so, subject to the following conditions: | ||
18 | * | ||
19 | * The above copyright notice and this permission notice (including the next | ||
20 | * paragraph) shall be included in all copies or substantial portions of the | ||
21 | * Software. | ||
22 | * | ||
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
26 | * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
27 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
28 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
29 | * OTHER DEALINGS IN THE SOFTWARE. | ||
30 | */ | ||
31 | |||
32 | #ifndef _DRM_SAREA_H_ | ||
33 | #define _DRM_SAREA_H_ | ||
34 | |||
35 | #include "drm.h" | ||
36 | |||
37 | /* SAREA area needs to be at least a page */ | ||
38 | #if defined(__alpha__) | ||
39 | #define SAREA_MAX 0x2000U | ||
40 | #elif defined(__ia64__) | ||
41 | #define SAREA_MAX 0x10000U /* 64kB */ | ||
42 | #else | ||
43 | /* Intel 830M driver needs at least 8k SAREA */ | ||
44 | #define SAREA_MAX 0x2000U | ||
45 | #endif | ||
46 | |||
47 | /** Maximum number of drawables in the SAREA */ | ||
48 | #define SAREA_MAX_DRAWABLES 256 | ||
49 | |||
50 | #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 | ||
51 | |||
52 | /** SAREA drawable */ | ||
53 | struct drm_sarea_drawable { | ||
54 | unsigned int stamp; | ||
55 | unsigned int flags; | ||
56 | }; | ||
57 | |||
58 | /** SAREA frame */ | ||
59 | struct drm_sarea_frame { | ||
60 | unsigned int x; | ||
61 | unsigned int y; | ||
62 | unsigned int width; | ||
63 | unsigned int height; | ||
64 | unsigned int fullscreen; | ||
65 | }; | ||
66 | |||
67 | /** SAREA */ | ||
68 | struct drm_sarea { | ||
69 | /** first thing is always the DRM locking structure */ | ||
70 | struct drm_hw_lock lock; | ||
71 | /** \todo Use readers/writer lock for drm_sarea::drawable_lock */ | ||
72 | struct drm_hw_lock drawable_lock; | ||
73 | struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ | ||
74 | struct drm_sarea_frame frame; /**< frame */ | ||
75 | drm_context_t dummy_context; | ||
76 | }; | ||
77 | |||
78 | #ifndef __KERNEL__ | ||
79 | typedef struct drm_sarea_drawable drm_sarea_drawable_t; | ||
80 | typedef struct drm_sarea_frame drm_sarea_frame_t; | ||
81 | typedef struct drm_sarea drm_sarea_t; | ||
82 | #endif | ||
83 | |||
84 | #endif /* _DRM_SAREA_H_ */ | ||
diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h new file mode 100644 index 00000000000..08ecf83ad5d --- /dev/null +++ b/include/drm/drm_sman.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA. | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
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, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | * | ||
27 | **************************************************************************/ | ||
28 | /* | ||
29 | * Simple memory MANager interface that keeps track on allocate regions on a | ||
30 | * per "owner" basis. All regions associated with an "owner" can be released | ||
31 | * with a simple call. Typically if the "owner" exists. The owner is any | ||
32 | * "unsigned long" identifier. Can typically be a pointer to a file private | ||
33 | * struct or a context identifier. | ||
34 | * | ||
35 | * Authors: | ||
36 | * Thomas Hellström <thomas-at-tungstengraphics-dot-com> | ||
37 | */ | ||
38 | |||
39 | #ifndef DRM_SMAN_H | ||
40 | #define DRM_SMAN_H | ||
41 | |||
42 | #include "drmP.h" | ||
43 | #include "drm_hashtab.h" | ||
44 | |||
45 | /* | ||
46 | * A class that is an abstration of a simple memory allocator. | ||
47 | * The sman implementation provides a default such allocator | ||
48 | * using the drm_mm.c implementation. But the user can replace it. | ||
49 | * See the SiS implementation, which may use the SiS FB kernel module | ||
50 | * for memory management. | ||
51 | */ | ||
52 | |||
53 | struct drm_sman_mm { | ||
54 | /* private info. If allocated, needs to be destroyed by the destroy | ||
55 | function */ | ||
56 | void *private; | ||
57 | |||
58 | /* Allocate a memory block with given size and alignment. | ||
59 | Return an opaque reference to the memory block */ | ||
60 | |||
61 | void *(*allocate) (void *private, unsigned long size, | ||
62 | unsigned alignment); | ||
63 | |||
64 | /* Free a memory block. "ref" is the opaque reference that we got from | ||
65 | the "alloc" function */ | ||
66 | |||
67 | void (*free) (void *private, void *ref); | ||
68 | |||
69 | /* Free all resources associated with this allocator */ | ||
70 | |||
71 | void (*destroy) (void *private); | ||
72 | |||
73 | /* Return a memory offset from the opaque reference returned from the | ||
74 | "alloc" function */ | ||
75 | |||
76 | unsigned long (*offset) (void *private, void *ref); | ||
77 | }; | ||
78 | |||
79 | struct drm_memblock_item { | ||
80 | struct list_head owner_list; | ||
81 | struct drm_hash_item user_hash; | ||
82 | void *mm_info; | ||
83 | struct drm_sman_mm *mm; | ||
84 | struct drm_sman *sman; | ||
85 | }; | ||
86 | |||
87 | struct drm_sman { | ||
88 | struct drm_sman_mm *mm; | ||
89 | int num_managers; | ||
90 | struct drm_open_hash owner_hash_tab; | ||
91 | struct drm_open_hash user_hash_tab; | ||
92 | struct list_head owner_items; | ||
93 | }; | ||
94 | |||
95 | /* | ||
96 | * Take down a memory manager. This function should only be called after a | ||
97 | * successful init and after a call to drm_sman_cleanup. | ||
98 | */ | ||
99 | |||
100 | extern void drm_sman_takedown(struct drm_sman * sman); | ||
101 | |||
102 | /* | ||
103 | * Allocate structures for a manager. | ||
104 | * num_managers are the number of memory pools to manage. (VRAM, AGP, ....) | ||
105 | * user_order is the log2 of the number of buckets in the user hash table. | ||
106 | * set this to approximately log2 of the max number of memory regions | ||
107 | * that will be allocated for _all_ pools together. | ||
108 | * owner_order is the log2 of the number of buckets in the owner hash table. | ||
109 | * set this to approximately log2 of | ||
110 | * the number of client file connections that will | ||
111 | * be using the manager. | ||
112 | * | ||
113 | */ | ||
114 | |||
115 | extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers, | ||
116 | unsigned int user_order, unsigned int owner_order); | ||
117 | |||
118 | /* | ||
119 | * Initialize a drm_mm.c allocator. Should be called only once for each | ||
120 | * manager unless a customized allogator is used. | ||
121 | */ | ||
122 | |||
123 | extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager, | ||
124 | unsigned long start, unsigned long size); | ||
125 | |||
126 | /* | ||
127 | * Initialize a customized allocator for one of the managers. | ||
128 | * (See the SiS module). The object pointed to by "allocator" is copied, | ||
129 | * so it can be destroyed after this call. | ||
130 | */ | ||
131 | |||
132 | extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger, | ||
133 | struct drm_sman_mm * allocator); | ||
134 | |||
135 | /* | ||
136 | * Allocate a memory block. Aligment is not implemented yet. | ||
137 | */ | ||
138 | |||
139 | extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman, | ||
140 | unsigned int manager, | ||
141 | unsigned long size, | ||
142 | unsigned alignment, | ||
143 | unsigned long owner); | ||
144 | /* | ||
145 | * Free a memory block identified by its user hash key. | ||
146 | */ | ||
147 | |||
148 | extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key); | ||
149 | |||
150 | /* | ||
151 | * returns 1 iff there are no stale memory blocks associated with this owner. | ||
152 | * Typically called to determine if we need to idle the hardware and call | ||
153 | * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes all | ||
154 | * resources associated with owner. | ||
155 | */ | ||
156 | |||
157 | extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner); | ||
158 | |||
159 | /* | ||
160 | * Frees all stale memory blocks associated with this owner. Note that this | ||
161 | * requires that the hardware is finished with all blocks, so the graphics engine | ||
162 | * should be idled before this call is made. This function also frees | ||
163 | * any resources associated with "owner" and should be called when owner | ||
164 | * is not going to be referenced anymore. | ||
165 | */ | ||
166 | |||
167 | extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner); | ||
168 | |||
169 | /* | ||
170 | * Frees all stale memory blocks associated with the memory manager. | ||
171 | * See idling above. | ||
172 | */ | ||
173 | |||
174 | extern void drm_sman_cleanup(struct drm_sman * sman); | ||
175 | |||
176 | #endif | ||
diff --git a/include/drm/i810_drm.h b/include/drm/i810_drm.h new file mode 100644 index 00000000000..7a10bb6f2c0 --- /dev/null +++ b/include/drm/i810_drm.h | |||
@@ -0,0 +1,281 @@ | |||
1 | #ifndef _I810_DRM_H_ | ||
2 | #define _I810_DRM_H_ | ||
3 | |||
4 | /* WARNING: These defines must be the same as what the Xserver uses. | ||
5 | * if you change them, you must change the defines in the Xserver. | ||
6 | */ | ||
7 | |||
8 | #ifndef _I810_DEFINES_ | ||
9 | #define _I810_DEFINES_ | ||
10 | |||
11 | #define I810_DMA_BUF_ORDER 12 | ||
12 | #define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) | ||
13 | #define I810_DMA_BUF_NR 256 | ||
14 | #define I810_NR_SAREA_CLIPRECTS 8 | ||
15 | |||
16 | /* Each region is a minimum of 64k, and there are at most 64 of them. | ||
17 | */ | ||
18 | #define I810_NR_TEX_REGIONS 64 | ||
19 | #define I810_LOG_MIN_TEX_REGION_SIZE 16 | ||
20 | #endif | ||
21 | |||
22 | #define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ | ||
23 | #define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ | ||
24 | #define I810_UPLOAD_CTX 0x4 | ||
25 | #define I810_UPLOAD_BUFFERS 0x8 | ||
26 | #define I810_UPLOAD_TEX0 0x10 | ||
27 | #define I810_UPLOAD_TEX1 0x20 | ||
28 | #define I810_UPLOAD_CLIPRECTS 0x40 | ||
29 | |||
30 | /* Indices into buf.Setup where various bits of state are mirrored per | ||
31 | * context and per buffer. These can be fired at the card as a unit, | ||
32 | * or in a piecewise fashion as required. | ||
33 | */ | ||
34 | |||
35 | /* Destbuffer state | ||
36 | * - backbuffer linear offset and pitch -- invarient in the current dri | ||
37 | * - zbuffer linear offset and pitch -- also invarient | ||
38 | * - drawing origin in back and depth buffers. | ||
39 | * | ||
40 | * Keep the depth/back buffer state here to accommodate private buffers | ||
41 | * in the future. | ||
42 | */ | ||
43 | #define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ | ||
44 | #define I810_DESTREG_DI1 1 | ||
45 | #define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ | ||
46 | #define I810_DESTREG_DV1 3 | ||
47 | #define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ | ||
48 | #define I810_DESTREG_DR1 5 | ||
49 | #define I810_DESTREG_DR2 6 | ||
50 | #define I810_DESTREG_DR3 7 | ||
51 | #define I810_DESTREG_DR4 8 | ||
52 | #define I810_DEST_SETUP_SIZE 10 | ||
53 | |||
54 | /* Context state | ||
55 | */ | ||
56 | #define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ | ||
57 | #define I810_CTXREG_CF1 1 | ||
58 | #define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ | ||
59 | #define I810_CTXREG_ST1 3 | ||
60 | #define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ | ||
61 | #define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ | ||
62 | #define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ | ||
63 | #define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ | ||
64 | #define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ | ||
65 | #define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ | ||
66 | #define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ | ||
67 | #define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ | ||
68 | #define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ | ||
69 | #define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ | ||
70 | #define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ | ||
71 | #define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ | ||
72 | #define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ | ||
73 | #define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ | ||
74 | #define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ | ||
75 | #define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ | ||
76 | #define I810_CTX_SETUP_SIZE 20 | ||
77 | |||
78 | /* Texture state (per tex unit) | ||
79 | */ | ||
80 | #define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ | ||
81 | #define I810_TEXREG_MI1 1 | ||
82 | #define I810_TEXREG_MI2 2 | ||
83 | #define I810_TEXREG_MI3 3 | ||
84 | #define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ | ||
85 | #define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ | ||
86 | #define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ | ||
87 | #define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ | ||
88 | #define I810_TEX_SETUP_SIZE 8 | ||
89 | |||
90 | /* Flags for clear ioctl | ||
91 | */ | ||
92 | #define I810_FRONT 0x1 | ||
93 | #define I810_BACK 0x2 | ||
94 | #define I810_DEPTH 0x4 | ||
95 | |||
96 | typedef enum _drm_i810_init_func { | ||
97 | I810_INIT_DMA = 0x01, | ||
98 | I810_CLEANUP_DMA = 0x02, | ||
99 | I810_INIT_DMA_1_4 = 0x03 | ||
100 | } drm_i810_init_func_t; | ||
101 | |||
102 | /* This is the init structure after v1.2 */ | ||
103 | typedef struct _drm_i810_init { | ||
104 | drm_i810_init_func_t func; | ||
105 | unsigned int mmio_offset; | ||
106 | unsigned int buffers_offset; | ||
107 | int sarea_priv_offset; | ||
108 | unsigned int ring_start; | ||
109 | unsigned int ring_end; | ||
110 | unsigned int ring_size; | ||
111 | unsigned int front_offset; | ||
112 | unsigned int back_offset; | ||
113 | unsigned int depth_offset; | ||
114 | unsigned int overlay_offset; | ||
115 | unsigned int overlay_physical; | ||
116 | unsigned int w; | ||
117 | unsigned int h; | ||
118 | unsigned int pitch; | ||
119 | unsigned int pitch_bits; | ||
120 | } drm_i810_init_t; | ||
121 | |||
122 | /* This is the init structure prior to v1.2 */ | ||
123 | typedef struct _drm_i810_pre12_init { | ||
124 | drm_i810_init_func_t func; | ||
125 | unsigned int mmio_offset; | ||
126 | unsigned int buffers_offset; | ||
127 | int sarea_priv_offset; | ||
128 | unsigned int ring_start; | ||
129 | unsigned int ring_end; | ||
130 | unsigned int ring_size; | ||
131 | unsigned int front_offset; | ||
132 | unsigned int back_offset; | ||
133 | unsigned int depth_offset; | ||
134 | unsigned int w; | ||
135 | unsigned int h; | ||
136 | unsigned int pitch; | ||
137 | unsigned int pitch_bits; | ||
138 | } drm_i810_pre12_init_t; | ||
139 | |||
140 | /* Warning: If you change the SAREA structure you must change the Xserver | ||
141 | * structure as well */ | ||
142 | |||
143 | typedef struct _drm_i810_tex_region { | ||
144 | unsigned char next, prev; /* indices to form a circular LRU */ | ||
145 | unsigned char in_use; /* owned by a client, or free? */ | ||
146 | int age; /* tracked by clients to update local LRU's */ | ||
147 | } drm_i810_tex_region_t; | ||
148 | |||
149 | typedef struct _drm_i810_sarea { | ||
150 | unsigned int ContextState[I810_CTX_SETUP_SIZE]; | ||
151 | unsigned int BufferState[I810_DEST_SETUP_SIZE]; | ||
152 | unsigned int TexState[2][I810_TEX_SETUP_SIZE]; | ||
153 | unsigned int dirty; | ||
154 | |||
155 | unsigned int nbox; | ||
156 | struct drm_clip_rect boxes[I810_NR_SAREA_CLIPRECTS]; | ||
157 | |||
158 | /* Maintain an LRU of contiguous regions of texture space. If | ||
159 | * you think you own a region of texture memory, and it has an | ||
160 | * age different to the one you set, then you are mistaken and | ||
161 | * it has been stolen by another client. If global texAge | ||
162 | * hasn't changed, there is no need to walk the list. | ||
163 | * | ||
164 | * These regions can be used as a proxy for the fine-grained | ||
165 | * texture information of other clients - by maintaining them | ||
166 | * in the same lru which is used to age their own textures, | ||
167 | * clients have an approximate lru for the whole of global | ||
168 | * texture space, and can make informed decisions as to which | ||
169 | * areas to kick out. There is no need to choose whether to | ||
170 | * kick out your own texture or someone else's - simply eject | ||
171 | * them all in LRU order. | ||
172 | */ | ||
173 | |||
174 | drm_i810_tex_region_t texList[I810_NR_TEX_REGIONS + 1]; | ||
175 | /* Last elt is sentinal */ | ||
176 | int texAge; /* last time texture was uploaded */ | ||
177 | int last_enqueue; /* last time a buffer was enqueued */ | ||
178 | int last_dispatch; /* age of the most recently dispatched buffer */ | ||
179 | int last_quiescent; /* */ | ||
180 | int ctxOwner; /* last context to upload state */ | ||
181 | |||
182 | int vertex_prim; | ||
183 | |||
184 | int pf_enabled; /* is pageflipping allowed? */ | ||
185 | int pf_active; | ||
186 | int pf_current_page; /* which buffer is being displayed? */ | ||
187 | } drm_i810_sarea_t; | ||
188 | |||
189 | /* WARNING: If you change any of these defines, make sure to change the | ||
190 | * defines in the Xserver file (xf86drmMga.h) | ||
191 | */ | ||
192 | |||
193 | /* i810 specific ioctls | ||
194 | * The device specific ioctl range is 0x40 to 0x79. | ||
195 | */ | ||
196 | #define DRM_I810_INIT 0x00 | ||
197 | #define DRM_I810_VERTEX 0x01 | ||
198 | #define DRM_I810_CLEAR 0x02 | ||
199 | #define DRM_I810_FLUSH 0x03 | ||
200 | #define DRM_I810_GETAGE 0x04 | ||
201 | #define DRM_I810_GETBUF 0x05 | ||
202 | #define DRM_I810_SWAP 0x06 | ||
203 | #define DRM_I810_COPY 0x07 | ||
204 | #define DRM_I810_DOCOPY 0x08 | ||
205 | #define DRM_I810_OV0INFO 0x09 | ||
206 | #define DRM_I810_FSTATUS 0x0a | ||
207 | #define DRM_I810_OV0FLIP 0x0b | ||
208 | #define DRM_I810_MC 0x0c | ||
209 | #define DRM_I810_RSTATUS 0x0d | ||
210 | #define DRM_I810_FLIP 0x0e | ||
211 | |||
212 | #define DRM_IOCTL_I810_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I810_INIT, drm_i810_init_t) | ||
213 | #define DRM_IOCTL_I810_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I810_VERTEX, drm_i810_vertex_t) | ||
214 | #define DRM_IOCTL_I810_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I810_CLEAR, drm_i810_clear_t) | ||
215 | #define DRM_IOCTL_I810_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_I810_FLUSH) | ||
216 | #define DRM_IOCTL_I810_GETAGE DRM_IO( DRM_COMMAND_BASE + DRM_I810_GETAGE) | ||
217 | #define DRM_IOCTL_I810_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I810_GETBUF, drm_i810_dma_t) | ||
218 | #define DRM_IOCTL_I810_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_I810_SWAP) | ||
219 | #define DRM_IOCTL_I810_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I810_COPY, drm_i810_copy_t) | ||
220 | #define DRM_IOCTL_I810_DOCOPY DRM_IO( DRM_COMMAND_BASE + DRM_I810_DOCOPY) | ||
221 | #define DRM_IOCTL_I810_OV0INFO DRM_IOR( DRM_COMMAND_BASE + DRM_I810_OV0INFO, drm_i810_overlay_t) | ||
222 | #define DRM_IOCTL_I810_FSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FSTATUS) | ||
223 | #define DRM_IOCTL_I810_OV0FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_OV0FLIP) | ||
224 | #define DRM_IOCTL_I810_MC DRM_IOW( DRM_COMMAND_BASE + DRM_I810_MC, drm_i810_mc_t) | ||
225 | #define DRM_IOCTL_I810_RSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_RSTATUS) | ||
226 | #define DRM_IOCTL_I810_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FLIP) | ||
227 | |||
228 | typedef struct _drm_i810_clear { | ||
229 | int clear_color; | ||
230 | int clear_depth; | ||
231 | int flags; | ||
232 | } drm_i810_clear_t; | ||
233 | |||
234 | /* These may be placeholders if we have more cliprects than | ||
235 | * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to | ||
236 | * false, indicating that the buffer will be dispatched again with a | ||
237 | * new set of cliprects. | ||
238 | */ | ||
239 | typedef struct _drm_i810_vertex { | ||
240 | int idx; /* buffer index */ | ||
241 | int used; /* nr bytes in use */ | ||
242 | int discard; /* client is finished with the buffer? */ | ||
243 | } drm_i810_vertex_t; | ||
244 | |||
245 | typedef struct _drm_i810_copy_t { | ||
246 | int idx; /* buffer index */ | ||
247 | int used; /* nr bytes in use */ | ||
248 | void *address; /* Address to copy from */ | ||
249 | } drm_i810_copy_t; | ||
250 | |||
251 | #define PR_TRIANGLES (0x0<<18) | ||
252 | #define PR_TRISTRIP_0 (0x1<<18) | ||
253 | #define PR_TRISTRIP_1 (0x2<<18) | ||
254 | #define PR_TRIFAN (0x3<<18) | ||
255 | #define PR_POLYGON (0x4<<18) | ||
256 | #define PR_LINES (0x5<<18) | ||
257 | #define PR_LINESTRIP (0x6<<18) | ||
258 | #define PR_RECTS (0x7<<18) | ||
259 | #define PR_MASK (0x7<<18) | ||
260 | |||
261 | typedef struct drm_i810_dma { | ||
262 | void *virtual; | ||
263 | int request_idx; | ||
264 | int request_size; | ||
265 | int granted; | ||
266 | } drm_i810_dma_t; | ||
267 | |||
268 | typedef struct _drm_i810_overlay_t { | ||
269 | unsigned int offset; /* Address of the Overlay Regs */ | ||
270 | unsigned int physical; | ||
271 | } drm_i810_overlay_t; | ||
272 | |||
273 | typedef struct _drm_i810_mc { | ||
274 | int idx; /* buffer index */ | ||
275 | int used; /* nr bytes in use */ | ||
276 | int num_blocks; /* number of GFXBlocks */ | ||
277 | int *length; /* List of lengths for GFXBlocks (FUTURE) */ | ||
278 | unsigned int last_render; /* Last Render Request */ | ||
279 | } drm_i810_mc_t; | ||
280 | |||
281 | #endif /* _I810_DRM_H_ */ | ||
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h new file mode 100644 index 00000000000..fca817009e1 --- /dev/null +++ b/include/drm/mga_drm.h | |||
@@ -0,0 +1,419 @@ | |||
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 | ||
3 | * | ||
4 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | ||
5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | * copy of this software and associated documentation files (the "Software"), | ||
10 | * to deal in the Software without restriction, including without limitation | ||
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 | ||
13 | * Software is furnished to do so, subject to the following conditions: | ||
14 | * | ||
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 | ||
17 | * Software. | ||
18 | * | ||
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, | ||
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 | ||
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 | ||
25 | * OTHER DEALINGS IN THE SOFTWARE. | ||
26 | * | ||
27 | * Authors: | ||
28 | * Jeff Hartmann <jhartmann@valinux.com> | ||
29 | * Keith Whitwell <keith@tungstengraphics.com> | ||
30 | * | ||
31 | * Rewritten by: | ||
32 | * Gareth Hughes <gareth@valinux.com> | ||
33 | */ | ||
34 | |||
35 | #ifndef __MGA_DRM_H__ | ||
36 | #define __MGA_DRM_H__ | ||
37 | |||
38 | #include "drm.h" | ||
39 | |||
40 | /* WARNING: If you change any of these defines, make sure to change the | ||
41 | * defines in the Xserver file (mga_sarea.h) | ||
42 | */ | ||
43 | |||
44 | #ifndef __MGA_SAREA_DEFINES__ | ||
45 | #define __MGA_SAREA_DEFINES__ | ||
46 | |||
47 | /* WARP pipe flags | ||
48 | */ | ||
49 | #define MGA_F 0x1 /* fog */ | ||
50 | #define MGA_A 0x2 /* alpha */ | ||
51 | #define MGA_S 0x4 /* specular */ | ||
52 | #define MGA_T2 0x8 /* multitexture */ | ||
53 | |||
54 | #define MGA_WARP_TGZ 0 | ||
55 | #define MGA_WARP_TGZF (MGA_F) | ||
56 | #define MGA_WARP_TGZA (MGA_A) | ||
57 | #define MGA_WARP_TGZAF (MGA_F|MGA_A) | ||
58 | #define MGA_WARP_TGZS (MGA_S) | ||
59 | #define MGA_WARP_TGZSF (MGA_S|MGA_F) | ||
60 | #define MGA_WARP_TGZSA (MGA_S|MGA_A) | ||
61 | #define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) | ||
62 | #define MGA_WARP_T2GZ (MGA_T2) | ||
63 | #define MGA_WARP_T2GZF (MGA_T2|MGA_F) | ||
64 | #define MGA_WARP_T2GZA (MGA_T2|MGA_A) | ||
65 | #define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) | ||
66 | #define MGA_WARP_T2GZS (MGA_T2|MGA_S) | ||
67 | #define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) | ||
68 | #define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) | ||
69 | #define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) | ||
70 | |||
71 | #define MGA_MAX_G200_PIPES 8 /* no multitex */ | ||
72 | #define MGA_MAX_G400_PIPES 16 | ||
73 | #define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES | ||
74 | #define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ | ||
75 | |||
76 | #define MGA_CARD_TYPE_G200 1 | ||
77 | #define MGA_CARD_TYPE_G400 2 | ||
78 | #define MGA_CARD_TYPE_G450 3 /* not currently used */ | ||
79 | #define MGA_CARD_TYPE_G550 4 | ||
80 | |||
81 | #define MGA_FRONT 0x1 | ||
82 | #define MGA_BACK 0x2 | ||
83 | #define MGA_DEPTH 0x4 | ||
84 | |||
85 | /* What needs to be changed for the current vertex dma buffer? | ||
86 | */ | ||
87 | #define MGA_UPLOAD_CONTEXT 0x1 | ||
88 | #define MGA_UPLOAD_TEX0 0x2 | ||
89 | #define MGA_UPLOAD_TEX1 0x4 | ||
90 | #define MGA_UPLOAD_PIPE 0x8 | ||
91 | #define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ | ||
92 | #define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ | ||
93 | #define MGA_UPLOAD_2D 0x40 | ||
94 | #define MGA_WAIT_AGE 0x80 /* handled client-side */ | ||
95 | #define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ | ||
96 | #if 0 | ||
97 | #define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock | ||
98 | quiescent */ | ||
99 | #endif | ||
100 | |||
101 | /* 32 buffers of 64k each, total 2 meg. | ||
102 | */ | ||
103 | #define MGA_BUFFER_SIZE (1 << 16) | ||
104 | #define MGA_NUM_BUFFERS 128 | ||
105 | |||
106 | /* Keep these small for testing. | ||
107 | */ | ||
108 | #define MGA_NR_SAREA_CLIPRECTS 8 | ||
109 | |||
110 | /* 2 heaps (1 for card, 1 for agp), each divided into up to 128 | ||
111 | * regions, subject to a minimum region size of (1<<16) == 64k. | ||
112 | * | ||
113 | * Clients may subdivide regions internally, but when sharing between | ||
114 | * clients, the region size is the minimum granularity. | ||
115 | */ | ||
116 | |||
117 | #define MGA_CARD_HEAP 0 | ||
118 | #define MGA_AGP_HEAP 1 | ||
119 | #define MGA_NR_TEX_HEAPS 2 | ||
120 | #define MGA_NR_TEX_REGIONS 16 | ||
121 | #define MGA_LOG_MIN_TEX_REGION_SIZE 16 | ||
122 | |||
123 | #define DRM_MGA_IDLE_RETRY 2048 | ||
124 | |||
125 | #endif /* __MGA_SAREA_DEFINES__ */ | ||
126 | |||
127 | /* Setup registers for 3D context | ||
128 | */ | ||
129 | typedef struct { | ||
130 | unsigned int dstorg; | ||
131 | unsigned int maccess; | ||
132 | unsigned int plnwt; | ||
133 | unsigned int dwgctl; | ||
134 | unsigned int alphactrl; | ||
135 | unsigned int fogcolor; | ||
136 | unsigned int wflag; | ||
137 | unsigned int tdualstage0; | ||
138 | unsigned int tdualstage1; | ||
139 | unsigned int fcol; | ||
140 | unsigned int stencil; | ||
141 | unsigned int stencilctl; | ||
142 | } drm_mga_context_regs_t; | ||
143 | |||
144 | /* Setup registers for 2D, X server | ||
145 | */ | ||
146 | typedef struct { | ||
147 | unsigned int pitch; | ||
148 | } drm_mga_server_regs_t; | ||
149 | |||
150 | /* Setup registers for each texture unit | ||
151 | */ | ||
152 | typedef struct { | ||
153 | unsigned int texctl; | ||
154 | unsigned int texctl2; | ||
155 | unsigned int texfilter; | ||
156 | unsigned int texbordercol; | ||
157 | unsigned int texorg; | ||
158 | unsigned int texwidth; | ||
159 | unsigned int texheight; | ||
160 | unsigned int texorg1; | ||
161 | unsigned int texorg2; | ||
162 | unsigned int texorg3; | ||
163 | unsigned int texorg4; | ||
164 | } drm_mga_texture_regs_t; | ||
165 | |||
166 | /* General aging mechanism | ||
167 | */ | ||
168 | typedef struct { | ||
169 | unsigned int head; /* Position of head pointer */ | ||
170 | unsigned int wrap; /* Primary DMA wrap count */ | ||
171 | } drm_mga_age_t; | ||
172 | |||
173 | typedef struct _drm_mga_sarea { | ||
174 | /* The channel for communication of state information to the kernel | ||
175 | * on firing a vertex dma buffer. | ||
176 | */ | ||
177 | drm_mga_context_regs_t context_state; | ||
178 | drm_mga_server_regs_t server_state; | ||
179 | drm_mga_texture_regs_t tex_state[2]; | ||
180 | unsigned int warp_pipe; | ||
181 | unsigned int dirty; | ||
182 | unsigned int vertsize; | ||
183 | |||
184 | /* The current cliprects, or a subset thereof. | ||
185 | */ | ||
186 | struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS]; | ||
187 | unsigned int nbox; | ||
188 | |||
189 | /* Information about the most recently used 3d drawable. The | ||
190 | * client fills in the req_* fields, the server fills in the | ||
191 | * exported_ fields and puts the cliprects into boxes, above. | ||
192 | * | ||
193 | * The client clears the exported_drawable field before | ||
194 | * clobbering the boxes data. | ||
195 | */ | ||
196 | unsigned int req_drawable; /* the X drawable id */ | ||
197 | unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ | ||
198 | |||
199 | unsigned int exported_drawable; | ||
200 | unsigned int exported_index; | ||
201 | unsigned int exported_stamp; | ||
202 | unsigned int exported_buffers; | ||
203 | unsigned int exported_nfront; | ||
204 | unsigned int exported_nback; | ||
205 | int exported_back_x, exported_front_x, exported_w; | ||
206 | int exported_back_y, exported_front_y, exported_h; | ||
207 | struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS]; | ||
208 | |||
209 | /* Counters for aging textures and for client-side throttling. | ||
210 | */ | ||
211 | unsigned int status[4]; | ||
212 | unsigned int last_wrap; | ||
213 | |||
214 | drm_mga_age_t last_frame; | ||
215 | unsigned int last_enqueue; /* last time a buffer was enqueued */ | ||
216 | unsigned int last_dispatch; /* age of the most recently dispatched buffer */ | ||
217 | unsigned int last_quiescent; /* */ | ||
218 | |||
219 | /* LRU lists for texture memory in agp space and on the card. | ||
220 | */ | ||
221 | struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; | ||
222 | unsigned int texAge[MGA_NR_TEX_HEAPS]; | ||
223 | |||
224 | /* Mechanism to validate card state. | ||
225 | */ | ||
226 | int ctxOwner; | ||
227 | } drm_mga_sarea_t; | ||
228 | |||
229 | /* MGA specific ioctls | ||
230 | * The device specific ioctl range is 0x40 to 0x79. | ||
231 | */ | ||
232 | #define DRM_MGA_INIT 0x00 | ||
233 | #define DRM_MGA_FLUSH 0x01 | ||
234 | #define DRM_MGA_RESET 0x02 | ||
235 | #define DRM_MGA_SWAP 0x03 | ||
236 | #define DRM_MGA_CLEAR 0x04 | ||
237 | #define DRM_MGA_VERTEX 0x05 | ||
238 | #define DRM_MGA_INDICES 0x06 | ||
239 | #define DRM_MGA_ILOAD 0x07 | ||
240 | #define DRM_MGA_BLIT 0x08 | ||
241 | #define DRM_MGA_GETPARAM 0x09 | ||
242 | |||
243 | /* 3.2: | ||
244 | * ioctls for operating on fences. | ||
245 | */ | ||
246 | #define DRM_MGA_SET_FENCE 0x0a | ||
247 | #define DRM_MGA_WAIT_FENCE 0x0b | ||
248 | #define DRM_MGA_DMA_BOOTSTRAP 0x0c | ||
249 | |||
250 | #define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) | ||
251 | #define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, struct drm_lock) | ||
252 | #define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) | ||
253 | #define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) | ||
254 | #define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) | ||
255 | #define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t) | ||
256 | #define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t) | ||
257 | #define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) | ||
258 | #define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) | ||
259 | #define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) | ||
260 | #define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32) | ||
261 | #define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32) | ||
262 | #define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) | ||
263 | |||
264 | typedef struct _drm_mga_warp_index { | ||
265 | int installed; | ||
266 | unsigned long phys_addr; | ||
267 | int size; | ||
268 | } drm_mga_warp_index_t; | ||
269 | |||
270 | typedef struct drm_mga_init { | ||
271 | enum { | ||
272 | MGA_INIT_DMA = 0x01, | ||
273 | MGA_CLEANUP_DMA = 0x02 | ||
274 | } func; | ||
275 | |||
276 | unsigned long sarea_priv_offset; | ||
277 | |||
278 | int chipset; | ||
279 | int sgram; | ||
280 | |||
281 | unsigned int maccess; | ||
282 | |||
283 | unsigned int fb_cpp; | ||
284 | unsigned int front_offset, front_pitch; | ||
285 | unsigned int back_offset, back_pitch; | ||
286 | |||
287 | unsigned int depth_cpp; | ||
288 | unsigned int depth_offset, depth_pitch; | ||
289 | |||
290 | unsigned int texture_offset[MGA_NR_TEX_HEAPS]; | ||
291 | unsigned int texture_size[MGA_NR_TEX_HEAPS]; | ||
292 | |||
293 | unsigned long fb_offset; | ||
294 | unsigned long mmio_offset; | ||
295 | unsigned long status_offset; | ||
296 | unsigned long warp_offset; | ||
297 | unsigned long primary_offset; | ||
298 | unsigned long buffers_offset; | ||
299 | } drm_mga_init_t; | ||
300 | |||
301 | typedef struct drm_mga_dma_bootstrap { | ||
302 | /** | ||
303 | * \name AGP texture region | ||
304 | * | ||
305 | * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will | ||
306 | * be filled in with the actual AGP texture settings. | ||
307 | * | ||
308 | * \warning | ||
309 | * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode | ||
310 | * is zero, it means that PCI memory (most likely through the use of | ||
311 | * an IOMMU) is being used for "AGP" textures. | ||
312 | */ | ||
313 | /*@{ */ | ||
314 | unsigned long texture_handle; /**< Handle used to map AGP textures. */ | ||
315 | __u32 texture_size; /**< Size of the AGP texture region. */ | ||
316 | /*@} */ | ||
317 | |||
318 | /** | ||
319 | * Requested size of the primary DMA region. | ||
320 | * | ||
321 | * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be | ||
322 | * filled in with the actual AGP mode. If AGP was not available | ||
323 | */ | ||
324 | __u32 primary_size; | ||
325 | |||
326 | /** | ||
327 | * Requested number of secondary DMA buffers. | ||
328 | * | ||
329 | * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be | ||
330 | * filled in with the actual number of secondary DMA buffers | ||
331 | * allocated. Particularly when PCI DMA is used, this may be | ||
332 | * (subtantially) less than the number requested. | ||
333 | */ | ||
334 | __u32 secondary_bin_count; | ||
335 | |||
336 | /** | ||
337 | * Requested size of each secondary DMA buffer. | ||
338 | * | ||
339 | * While the kernel \b is free to reduce | ||
340 | * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed | ||
341 | * to reduce dma_mga_dma_bootstrap::secondary_bin_size. | ||
342 | */ | ||
343 | __u32 secondary_bin_size; | ||
344 | |||
345 | /** | ||
346 | * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, | ||
347 | * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is | ||
348 | * zero, it means that PCI DMA should be used, even if AGP is | ||
349 | * possible. | ||
350 | * | ||
351 | * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be | ||
352 | * filled in with the actual AGP mode. If AGP was not available | ||
353 | * (i.e., PCI DMA was used), this value will be zero. | ||
354 | */ | ||
355 | __u32 agp_mode; | ||
356 | |||
357 | /** | ||
358 | * Desired AGP GART size, measured in megabytes. | ||
359 | */ | ||
360 | __u8 agp_size; | ||
361 | } drm_mga_dma_bootstrap_t; | ||
362 | |||
363 | typedef struct drm_mga_clear { | ||
364 | unsigned int flags; | ||
365 | unsigned int clear_color; | ||
366 | unsigned int clear_depth; | ||
367 | unsigned int color_mask; | ||
368 | unsigned int depth_mask; | ||
369 | } drm_mga_clear_t; | ||
370 | |||
371 | typedef struct drm_mga_vertex { | ||
372 | int idx; /* buffer to queue */ | ||
373 | int used; /* bytes in use */ | ||
374 | int discard; /* client finished with buffer? */ | ||
375 | } drm_mga_vertex_t; | ||
376 | |||
377 | typedef struct drm_mga_indices { | ||
378 | int idx; /* buffer to queue */ | ||
379 | unsigned int start; | ||
380 | unsigned int end; | ||
381 | int discard; /* client finished with buffer? */ | ||
382 | } drm_mga_indices_t; | ||
383 | |||
384 | typedef struct drm_mga_iload { | ||
385 | int idx; | ||
386 | unsigned int dstorg; | ||
387 | unsigned int length; | ||
388 | } drm_mga_iload_t; | ||
389 | |||
390 | typedef struct _drm_mga_blit { | ||
391 | unsigned int planemask; | ||
392 | unsigned int srcorg; | ||
393 | unsigned int dstorg; | ||
394 | int src_pitch, dst_pitch; | ||
395 | int delta_sx, delta_sy; | ||
396 | int delta_dx, delta_dy; | ||
397 | int height, ydir; /* flip image vertically */ | ||
398 | int source_pitch, dest_pitch; | ||
399 | } drm_mga_blit_t; | ||
400 | |||
401 | /* 3.1: An ioctl to get parameters that aren't available to the 3d | ||
402 | * client any other way. | ||
403 | */ | ||
404 | #define MGA_PARAM_IRQ_NR 1 | ||
405 | |||
406 | /* 3.2: Query the actual card type. The DDX only distinguishes between | ||
407 | * G200 chips and non-G200 chips, which it calls G400. It turns out that | ||
408 | * there are some very sublte differences between the G4x0 chips and the G550 | ||
409 | * chips. Using this parameter query, a client-side driver can detect the | ||
410 | * difference between a G4x0 and a G550. | ||
411 | */ | ||
412 | #define MGA_PARAM_CARD_TYPE 2 | ||
413 | |||
414 | typedef struct drm_mga_getparam { | ||
415 | int param; | ||
416 | void __user *value; | ||
417 | } drm_mga_getparam_t; | ||
418 | |||
419 | #endif | ||
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h new file mode 100644 index 00000000000..5edd3a76fff --- /dev/null +++ b/include/drm/nouveau_drm.h | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | * Copyright 2005 Stephane Marchesin. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * copy of this software and associated documentation files (the "Software"), | ||
7 | * to deal in the Software without restriction, including without limitation | ||
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
10 | * Software is furnished to do so, subject to the following conditions: | ||
11 | * | ||
12 | * The above copyright notice and this permission notice (including the next | ||
13 | * paragraph) shall be included in all copies or substantial portions of the | ||
14 | * Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
22 | * OTHER DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #ifndef __NOUVEAU_DRM_H__ | ||
26 | #define __NOUVEAU_DRM_H__ | ||
27 | |||
28 | #define NOUVEAU_DRM_HEADER_PATCHLEVEL 16 | ||
29 | |||
30 | struct drm_nouveau_channel_alloc { | ||
31 | uint32_t fb_ctxdma_handle; | ||
32 | uint32_t tt_ctxdma_handle; | ||
33 | |||
34 | int channel; | ||
35 | uint32_t pushbuf_domains; | ||
36 | |||
37 | /* Notifier memory */ | ||
38 | uint32_t notifier_handle; | ||
39 | |||
40 | /* DRM-enforced subchannel assignments */ | ||
41 | struct { | ||
42 | uint32_t handle; | ||
43 | uint32_t grclass; | ||
44 | } subchan[8]; | ||
45 | uint32_t nr_subchan; | ||
46 | }; | ||
47 | |||
48 | struct drm_nouveau_channel_free { | ||
49 | int channel; | ||
50 | }; | ||
51 | |||
52 | struct drm_nouveau_grobj_alloc { | ||
53 | int channel; | ||
54 | uint32_t handle; | ||
55 | int class; | ||
56 | }; | ||
57 | |||
58 | struct drm_nouveau_notifierobj_alloc { | ||
59 | uint32_t channel; | ||
60 | uint32_t handle; | ||
61 | uint32_t size; | ||
62 | uint32_t offset; | ||
63 | }; | ||
64 | |||
65 | struct drm_nouveau_gpuobj_free { | ||
66 | int channel; | ||
67 | uint32_t handle; | ||
68 | }; | ||
69 | |||
70 | /* FIXME : maybe unify {GET,SET}PARAMs */ | ||
71 | #define NOUVEAU_GETPARAM_PCI_VENDOR 3 | ||
72 | #define NOUVEAU_GETPARAM_PCI_DEVICE 4 | ||
73 | #define NOUVEAU_GETPARAM_BUS_TYPE 5 | ||
74 | #define NOUVEAU_GETPARAM_FB_SIZE 8 | ||
75 | #define NOUVEAU_GETPARAM_AGP_SIZE 9 | ||
76 | #define NOUVEAU_GETPARAM_CHIPSET_ID 11 | ||
77 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 | ||
78 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 | ||
79 | #define NOUVEAU_GETPARAM_PTIMER_TIME 14 | ||
80 | #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 | ||
81 | #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16 | ||
82 | struct drm_nouveau_getparam { | ||
83 | uint64_t param; | ||
84 | uint64_t value; | ||
85 | }; | ||
86 | |||
87 | struct drm_nouveau_setparam { | ||
88 | uint64_t param; | ||
89 | uint64_t value; | ||
90 | }; | ||
91 | |||
92 | #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) | ||
93 | #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) | ||
94 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) | ||
95 | #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) | ||
96 | |||
97 | #define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */ | ||
98 | #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 | ||
99 | #define NOUVEAU_GEM_TILE_16BPP 0x00000001 | ||
100 | #define NOUVEAU_GEM_TILE_32BPP 0x00000002 | ||
101 | #define NOUVEAU_GEM_TILE_ZETA 0x00000004 | ||
102 | #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008 | ||
103 | |||
104 | struct drm_nouveau_gem_info { | ||
105 | uint32_t handle; | ||
106 | uint32_t domain; | ||
107 | uint64_t size; | ||
108 | uint64_t offset; | ||
109 | uint64_t map_handle; | ||
110 | uint32_t tile_mode; | ||
111 | uint32_t tile_flags; | ||
112 | }; | ||
113 | |||
114 | struct drm_nouveau_gem_new { | ||
115 | struct drm_nouveau_gem_info info; | ||
116 | uint32_t channel_hint; | ||
117 | uint32_t align; | ||
118 | }; | ||
119 | |||
120 | #define NOUVEAU_GEM_MAX_BUFFERS 1024 | ||
121 | struct drm_nouveau_gem_pushbuf_bo_presumed { | ||
122 | uint32_t valid; | ||
123 | uint32_t domain; | ||
124 | uint64_t offset; | ||
125 | }; | ||
126 | |||
127 | struct drm_nouveau_gem_pushbuf_bo { | ||
128 | uint64_t user_priv; | ||
129 | uint32_t handle; | ||
130 | uint32_t read_domains; | ||
131 | uint32_t write_domains; | ||
132 | uint32_t valid_domains; | ||
133 | struct drm_nouveau_gem_pushbuf_bo_presumed presumed; | ||
134 | }; | ||
135 | |||
136 | #define NOUVEAU_GEM_RELOC_LOW (1 << 0) | ||
137 | #define NOUVEAU_GEM_RELOC_HIGH (1 << 1) | ||
138 | #define NOUVEAU_GEM_RELOC_OR (1 << 2) | ||
139 | #define NOUVEAU_GEM_MAX_RELOCS 1024 | ||
140 | struct drm_nouveau_gem_pushbuf_reloc { | ||
141 | uint32_t reloc_bo_index; | ||
142 | uint32_t reloc_bo_offset; | ||
143 | uint32_t bo_index; | ||
144 | uint32_t flags; | ||
145 | uint32_t data; | ||
146 | uint32_t vor; | ||
147 | uint32_t tor; | ||
148 | }; | ||
149 | |||
150 | #define NOUVEAU_GEM_MAX_PUSH 512 | ||
151 | struct drm_nouveau_gem_pushbuf_push { | ||
152 | uint32_t bo_index; | ||
153 | uint32_t pad; | ||
154 | uint64_t offset; | ||
155 | uint64_t length; | ||
156 | }; | ||
157 | |||
158 | struct drm_nouveau_gem_pushbuf { | ||
159 | uint32_t channel; | ||
160 | uint32_t nr_buffers; | ||
161 | uint64_t buffers; | ||
162 | uint32_t nr_relocs; | ||
163 | uint32_t nr_push; | ||
164 | uint64_t relocs; | ||
165 | uint64_t push; | ||
166 | uint32_t suffix0; | ||
167 | uint32_t suffix1; | ||
168 | uint64_t vram_available; | ||
169 | uint64_t gart_available; | ||
170 | }; | ||
171 | |||
172 | #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 | ||
173 | #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 | ||
174 | struct drm_nouveau_gem_cpu_prep { | ||
175 | uint32_t handle; | ||
176 | uint32_t flags; | ||
177 | }; | ||
178 | |||
179 | struct drm_nouveau_gem_cpu_fini { | ||
180 | uint32_t handle; | ||
181 | }; | ||
182 | |||
183 | enum nouveau_bus_type { | ||
184 | NV_AGP = 0, | ||
185 | NV_PCI = 1, | ||
186 | NV_PCIE = 2, | ||
187 | }; | ||
188 | |||
189 | struct drm_nouveau_sarea { | ||
190 | }; | ||
191 | |||
192 | #define DRM_NOUVEAU_GETPARAM 0x00 | ||
193 | #define DRM_NOUVEAU_SETPARAM 0x01 | ||
194 | #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 | ||
195 | #define DRM_NOUVEAU_CHANNEL_FREE 0x03 | ||
196 | #define DRM_NOUVEAU_GROBJ_ALLOC 0x04 | ||
197 | #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 | ||
198 | #define DRM_NOUVEAU_GPUOBJ_FREE 0x06 | ||
199 | #define DRM_NOUVEAU_GEM_NEW 0x40 | ||
200 | #define DRM_NOUVEAU_GEM_PUSHBUF 0x41 | ||
201 | #define DRM_NOUVEAU_GEM_CPU_PREP 0x42 | ||
202 | #define DRM_NOUVEAU_GEM_CPU_FINI 0x43 | ||
203 | #define DRM_NOUVEAU_GEM_INFO 0x44 | ||
204 | |||
205 | #define DRM_IOCTL_NOUVEAU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam) | ||
206 | #define DRM_IOCTL_NOUVEAU_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam) | ||
207 | #define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc) | ||
208 | #define DRM_IOCTL_NOUVEAU_CHANNEL_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free) | ||
209 | #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc) | ||
210 | #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc) | ||
211 | #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free) | ||
212 | #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new) | ||
213 | #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf) | ||
214 | #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep) | ||
215 | #define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini) | ||
216 | #define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info) | ||
217 | |||
218 | #endif /* __NOUVEAU_DRM_H__ */ | ||
diff --git a/include/drm/r128_drm.h b/include/drm/r128_drm.h new file mode 100644 index 00000000000..8d8878b55f5 --- /dev/null +++ b/include/drm/r128_drm.h | |||
@@ -0,0 +1,326 @@ | |||
1 | /* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- | ||
2 | * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com | ||
3 | */ | ||
4 | /* | ||
5 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | ||
6 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
10 | * copy of this software and associated documentation files (the "Software"), | ||
11 | * to deal in the Software without restriction, including without limitation | ||
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
13 | * and/or sell copies of the Software, and to permit persons to whom the | ||
14 | * Software is furnished to do so, subject to the following conditions: | ||
15 | * | ||
16 | * The above copyright notice and this permission notice (including the next | ||
17 | * paragraph) shall be included in all copies or substantial portions of the | ||
18 | * Software. | ||
19 | * | ||
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
23 | * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
26 | * DEALINGS IN THE SOFTWARE. | ||
27 | * | ||
28 | * Authors: | ||
29 | * Gareth Hughes <gareth@valinux.com> | ||
30 | * Kevin E. Martin <martin@valinux.com> | ||
31 | */ | ||
32 | |||
33 | #ifndef __R128_DRM_H__ | ||
34 | #define __R128_DRM_H__ | ||
35 | |||
36 | /* WARNING: If you change any of these defines, make sure to change the | ||
37 | * defines in the X server file (r128_sarea.h) | ||
38 | */ | ||
39 | #ifndef __R128_SAREA_DEFINES__ | ||
40 | #define __R128_SAREA_DEFINES__ | ||
41 | |||
42 | /* What needs to be changed for the current vertex buffer? | ||
43 | */ | ||
44 | #define R128_UPLOAD_CONTEXT 0x001 | ||
45 | #define R128_UPLOAD_SETUP 0x002 | ||
46 | #define R128_UPLOAD_TEX0 0x004 | ||
47 | #define R128_UPLOAD_TEX1 0x008 | ||
48 | #define R128_UPLOAD_TEX0IMAGES 0x010 | ||
49 | #define R128_UPLOAD_TEX1IMAGES 0x020 | ||
50 | #define R128_UPLOAD_CORE 0x040 | ||
51 | #define R128_UPLOAD_MASKS 0x080 | ||
52 | #define R128_UPLOAD_WINDOW 0x100 | ||
53 | #define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ | ||
54 | #define R128_REQUIRE_QUIESCENCE 0x400 | ||
55 | #define R128_UPLOAD_ALL 0x7ff | ||
56 | |||
57 | #define R128_FRONT 0x1 | ||
58 | #define R128_BACK 0x2 | ||
59 | #define R128_DEPTH 0x4 | ||
60 | |||
61 | /* Primitive types | ||
62 | */ | ||
63 | #define R128_POINTS 0x1 | ||
64 | #define R128_LINES 0x2 | ||
65 | #define R128_LINE_STRIP 0x3 | ||
66 | #define R128_TRIANGLES 0x4 | ||
67 | #define R128_TRIANGLE_FAN 0x5 | ||
68 | #define R128_TRIANGLE_STRIP 0x6 | ||
69 | |||
70 | /* Vertex/indirect buffer size | ||
71 | */ | ||
72 | #define R128_BUFFER_SIZE 16384 | ||
73 | |||
74 | /* Byte offsets for indirect buffer data | ||
75 | */ | ||
76 | #define R128_INDEX_PRIM_OFFSET 20 | ||
77 | #define R128_HOSTDATA_BLIT_OFFSET 32 | ||
78 | |||
79 | /* Keep these small for testing. | ||
80 | */ | ||
81 | #define R128_NR_SAREA_CLIPRECTS 12 | ||
82 | |||
83 | /* There are 2 heaps (local/AGP). Each region within a heap is a | ||
84 | * minimum of 64k, and there are at most 64 of them per heap. | ||
85 | */ | ||
86 | #define R128_LOCAL_TEX_HEAP 0 | ||
87 | #define R128_AGP_TEX_HEAP 1 | ||
88 | #define R128_NR_TEX_HEAPS 2 | ||
89 | #define R128_NR_TEX_REGIONS 64 | ||
90 | #define R128_LOG_TEX_GRANULARITY 16 | ||
91 | |||
92 | #define R128_NR_CONTEXT_REGS 12 | ||
93 | |||
94 | #define R128_MAX_TEXTURE_LEVELS 11 | ||
95 | #define R128_MAX_TEXTURE_UNITS 2 | ||
96 | |||
97 | #endif /* __R128_SAREA_DEFINES__ */ | ||
98 | |||
99 | typedef struct { | ||
100 | /* Context state - can be written in one large chunk */ | ||
101 | unsigned int dst_pitch_offset_c; | ||
102 | unsigned int dp_gui_master_cntl_c; | ||
103 | unsigned int sc_top_left_c; | ||
104 | unsigned int sc_bottom_right_c; | ||
105 | unsigned int z_offset_c; | ||
106 | unsigned int z_pitch_c; | ||
107 | unsigned int z_sten_cntl_c; | ||
108 | unsigned int tex_cntl_c; | ||
109 | unsigned int misc_3d_state_cntl_reg; | ||
110 | unsigned int texture_clr_cmp_clr_c; | ||
111 | unsigned int texture_clr_cmp_msk_c; | ||
112 | unsigned int fog_color_c; | ||
113 | |||
114 | /* Texture state */ | ||
115 | unsigned int tex_size_pitch_c; | ||
116 | unsigned int constant_color_c; | ||
117 | |||
118 | /* Setup state */ | ||
119 | unsigned int pm4_vc_fpu_setup; | ||
120 | unsigned int setup_cntl; | ||
121 | |||
122 | /* Mask state */ | ||
123 | unsigned int dp_write_mask; | ||
124 | unsigned int sten_ref_mask_c; | ||
125 | unsigned int plane_3d_mask_c; | ||
126 | |||
127 | /* Window state */ | ||
128 | unsigned int window_xy_offset; | ||
129 | |||
130 | /* Core state */ | ||
131 | unsigned int scale_3d_cntl; | ||
132 | } drm_r128_context_regs_t; | ||
133 | |||
134 | /* Setup registers for each texture unit | ||
135 | */ | ||
136 | typedef struct { | ||
137 | unsigned int tex_cntl; | ||
138 | unsigned int tex_combine_cntl; | ||
139 | unsigned int tex_size_pitch; | ||
140 | unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; | ||
141 | unsigned int tex_border_color; | ||
142 | } drm_r128_texture_regs_t; | ||
143 | |||
144 | typedef struct drm_r128_sarea { | ||
145 | /* The channel for communication of state information to the kernel | ||
146 | * on firing a vertex buffer. | ||
147 | */ | ||
148 | drm_r128_context_regs_t context_state; | ||
149 | drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; | ||
150 | unsigned int dirty; | ||
151 | unsigned int vertsize; | ||
152 | unsigned int vc_format; | ||
153 | |||
154 | /* The current cliprects, or a subset thereof. | ||
155 | */ | ||
156 | struct drm_clip_rect boxes[R128_NR_SAREA_CLIPRECTS]; | ||
157 | unsigned int nbox; | ||
158 | |||
159 | /* Counters for client-side throttling of rendering clients. | ||
160 | */ | ||
161 | unsigned int last_frame; | ||
162 | unsigned int last_dispatch; | ||
163 | |||
164 | struct drm_tex_region tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS + 1]; | ||
165 | unsigned int tex_age[R128_NR_TEX_HEAPS]; | ||
166 | int ctx_owner; | ||
167 | int pfAllowPageFlip; /* number of 3d windows (0,1,2 or more) */ | ||
168 | int pfCurrentPage; /* which buffer is being displayed? */ | ||
169 | } drm_r128_sarea_t; | ||
170 | |||
171 | /* WARNING: If you change any of these defines, make sure to change the | ||
172 | * defines in the Xserver file (xf86drmR128.h) | ||
173 | */ | ||
174 | |||
175 | /* Rage 128 specific ioctls | ||
176 | * The device specific ioctl range is 0x40 to 0x79. | ||
177 | */ | ||
178 | #define DRM_R128_INIT 0x00 | ||
179 | #define DRM_R128_CCE_START 0x01 | ||
180 | #define DRM_R128_CCE_STOP 0x02 | ||
181 | #define DRM_R128_CCE_RESET 0x03 | ||
182 | #define DRM_R128_CCE_IDLE 0x04 | ||
183 | /* 0x05 not used */ | ||
184 | #define DRM_R128_RESET 0x06 | ||
185 | #define DRM_R128_SWAP 0x07 | ||
186 | #define DRM_R128_CLEAR 0x08 | ||
187 | #define DRM_R128_VERTEX 0x09 | ||
188 | #define DRM_R128_INDICES 0x0a | ||
189 | #define DRM_R128_BLIT 0x0b | ||
190 | #define DRM_R128_DEPTH 0x0c | ||
191 | #define DRM_R128_STIPPLE 0x0d | ||
192 | /* 0x0e not used */ | ||
193 | #define DRM_R128_INDIRECT 0x0f | ||
194 | #define DRM_R128_FULLSCREEN 0x10 | ||
195 | #define DRM_R128_CLEAR2 0x11 | ||
196 | #define DRM_R128_GETPARAM 0x12 | ||
197 | #define DRM_R128_FLIP 0x13 | ||
198 | |||
199 | #define DRM_IOCTL_R128_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INIT, drm_r128_init_t) | ||
200 | #define DRM_IOCTL_R128_CCE_START DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_START) | ||
201 | #define DRM_IOCTL_R128_CCE_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CCE_STOP, drm_r128_cce_stop_t) | ||
202 | #define DRM_IOCTL_R128_CCE_RESET DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_RESET) | ||
203 | #define DRM_IOCTL_R128_CCE_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_IDLE) | ||
204 | /* 0x05 not used */ | ||
205 | #define DRM_IOCTL_R128_RESET DRM_IO( DRM_COMMAND_BASE + DRM_R128_RESET) | ||
206 | #define DRM_IOCTL_R128_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_R128_SWAP) | ||
207 | #define DRM_IOCTL_R128_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR, drm_r128_clear_t) | ||
208 | #define DRM_IOCTL_R128_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_R128_VERTEX, drm_r128_vertex_t) | ||
209 | #define DRM_IOCTL_R128_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INDICES, drm_r128_indices_t) | ||
210 | #define DRM_IOCTL_R128_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_R128_BLIT, drm_r128_blit_t) | ||
211 | #define DRM_IOCTL_R128_DEPTH DRM_IOW( DRM_COMMAND_BASE + DRM_R128_DEPTH, drm_r128_depth_t) | ||
212 | #define DRM_IOCTL_R128_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_R128_STIPPLE, drm_r128_stipple_t) | ||
213 | /* 0x0e not used */ | ||
214 | #define DRM_IOCTL_R128_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_R128_INDIRECT, drm_r128_indirect_t) | ||
215 | #define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_R128_FULLSCREEN, drm_r128_fullscreen_t) | ||
216 | #define DRM_IOCTL_R128_CLEAR2 DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR2, drm_r128_clear2_t) | ||
217 | #define DRM_IOCTL_R128_GETPARAM DRM_IOWR( DRM_COMMAND_BASE + DRM_R128_GETPARAM, drm_r128_getparam_t) | ||
218 | #define DRM_IOCTL_R128_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_R128_FLIP) | ||
219 | |||
220 | typedef struct drm_r128_init { | ||
221 | enum { | ||
222 | R128_INIT_CCE = 0x01, | ||
223 | R128_CLEANUP_CCE = 0x02 | ||
224 | } func; | ||
225 | unsigned long sarea_priv_offset; | ||
226 | int is_pci; | ||
227 | int cce_mode; | ||
228 | int cce_secure; | ||
229 | int ring_size; | ||
230 | int usec_timeout; | ||
231 | |||
232 | unsigned int fb_bpp; | ||
233 | unsigned int front_offset, front_pitch; | ||
234 | unsigned int back_offset, back_pitch; | ||
235 | unsigned int depth_bpp; | ||
236 | unsigned int depth_offset, depth_pitch; | ||
237 | unsigned int span_offset; | ||
238 | |||
239 | unsigned long fb_offset; | ||
240 | unsigned long mmio_offset; | ||
241 | unsigned long ring_offset; | ||
242 | unsigned long ring_rptr_offset; | ||
243 | unsigned long buffers_offset; | ||
244 | unsigned long agp_textures_offset; | ||
245 | } drm_r128_init_t; | ||
246 | |||
247 | typedef struct drm_r128_cce_stop { | ||
248 | int flush; | ||
249 | int idle; | ||
250 | } drm_r128_cce_stop_t; | ||
251 | |||
252 | typedef struct drm_r128_clear { | ||
253 | unsigned int flags; | ||
254 | unsigned int clear_color; | ||
255 | unsigned int clear_depth; | ||
256 | unsigned int color_mask; | ||
257 | unsigned int depth_mask; | ||
258 | } drm_r128_clear_t; | ||
259 | |||
260 | typedef struct drm_r128_vertex { | ||
261 | int prim; | ||
262 | int idx; /* Index of vertex buffer */ | ||
263 | int count; /* Number of vertices in buffer */ | ||
264 | int discard; /* Client finished with buffer? */ | ||
265 | } drm_r128_vertex_t; | ||
266 | |||
267 | typedef struct drm_r128_indices { | ||
268 | int prim; | ||
269 | int idx; | ||
270 | int start; | ||
271 | int end; | ||
272 | int discard; /* Client finished with buffer? */ | ||
273 | } drm_r128_indices_t; | ||
274 | |||
275 | typedef struct drm_r128_blit { | ||
276 | int idx; | ||
277 | int pitch; | ||
278 | int offset; | ||
279 | int format; | ||
280 | unsigned short x, y; | ||
281 | unsigned short width, height; | ||
282 | } drm_r128_blit_t; | ||
283 | |||
284 | typedef struct drm_r128_depth { | ||
285 | enum { | ||
286 | R128_WRITE_SPAN = 0x01, | ||
287 | R128_WRITE_PIXELS = 0x02, | ||
288 | R128_READ_SPAN = 0x03, | ||
289 | R128_READ_PIXELS = 0x04 | ||
290 | } func; | ||
291 | int n; | ||
292 | int __user *x; | ||
293 | int __user *y; | ||
294 | unsigned int __user *buffer; | ||
295 | unsigned char __user *mask; | ||
296 | } drm_r128_depth_t; | ||
297 | |||
298 | typedef struct drm_r128_stipple { | ||
299 | unsigned int __user *mask; | ||
300 | } drm_r128_stipple_t; | ||
301 | |||
302 | typedef struct drm_r128_indirect { | ||
303 | int idx; | ||
304 | int start; | ||
305 | int end; | ||
306 | int discard; | ||
307 | } drm_r128_indirect_t; | ||
308 | |||
309 | typedef struct drm_r128_fullscreen { | ||
310 | enum { | ||
311 | R128_INIT_FULLSCREEN = 0x01, | ||
312 | R128_CLEANUP_FULLSCREEN = 0x02 | ||
313 | } func; | ||
314 | } drm_r128_fullscreen_t; | ||
315 | |||
316 | /* 2.3: An ioctl to get parameters that aren't available to the 3d | ||
317 | * client any other way. | ||
318 | */ | ||
319 | #define R128_PARAM_IRQ_NR 1 | ||
320 | |||
321 | typedef struct drm_r128_getparam { | ||
322 | int param; | ||
323 | void __user *value; | ||
324 | } drm_r128_getparam_t; | ||
325 | |||
326 | #endif | ||
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h new file mode 100644 index 00000000000..b65be6054a1 --- /dev/null +++ b/include/drm/radeon_drm.h | |||
@@ -0,0 +1,922 @@ | |||
1 | /* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- | ||
2 | * | ||
3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | ||
4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | ||
5 | * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | * copy of this software and associated documentation files (the "Software"), | ||
10 | * to deal in the Software without restriction, including without limitation | ||
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 | ||
13 | * Software is furnished to do so, subject to the following conditions: | ||
14 | * | ||
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 | ||
17 | * Software. | ||
18 | * | ||
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, | ||
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 | ||
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 | ||
25 | * DEALINGS IN THE SOFTWARE. | ||
26 | * | ||
27 | * Authors: | ||
28 | * Kevin E. Martin <martin@valinux.com> | ||
29 | * Gareth Hughes <gareth@valinux.com> | ||
30 | * Keith Whitwell <keith@tungstengraphics.com> | ||
31 | */ | ||
32 | |||
33 | #ifndef __RADEON_DRM_H__ | ||
34 | #define __RADEON_DRM_H__ | ||
35 | |||
36 | #include "drm.h" | ||
37 | |||
38 | /* WARNING: If you change any of these defines, make sure to change the | ||
39 | * defines in the X server file (radeon_sarea.h) | ||
40 | */ | ||
41 | #ifndef __RADEON_SAREA_DEFINES__ | ||
42 | #define __RADEON_SAREA_DEFINES__ | ||
43 | |||
44 | /* Old style state flags, required for sarea interface (1.1 and 1.2 | ||
45 | * clears) and 1.2 drm_vertex2 ioctl. | ||
46 | */ | ||
47 | #define RADEON_UPLOAD_CONTEXT 0x00000001 | ||
48 | #define RADEON_UPLOAD_VERTFMT 0x00000002 | ||
49 | #define RADEON_UPLOAD_LINE 0x00000004 | ||
50 | #define RADEON_UPLOAD_BUMPMAP 0x00000008 | ||
51 | #define RADEON_UPLOAD_MASKS 0x00000010 | ||
52 | #define RADEON_UPLOAD_VIEWPORT 0x00000020 | ||
53 | #define RADEON_UPLOAD_SETUP 0x00000040 | ||
54 | #define RADEON_UPLOAD_TCL 0x00000080 | ||
55 | #define RADEON_UPLOAD_MISC 0x00000100 | ||
56 | #define RADEON_UPLOAD_TEX0 0x00000200 | ||
57 | #define RADEON_UPLOAD_TEX1 0x00000400 | ||
58 | #define RADEON_UPLOAD_TEX2 0x00000800 | ||
59 | #define RADEON_UPLOAD_TEX0IMAGES 0x00001000 | ||
60 | #define RADEON_UPLOAD_TEX1IMAGES 0x00002000 | ||
61 | #define RADEON_UPLOAD_TEX2IMAGES 0x00004000 | ||
62 | #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ | ||
63 | #define RADEON_REQUIRE_QUIESCENCE 0x00010000 | ||
64 | #define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */ | ||
65 | #define RADEON_UPLOAD_ALL 0x003effff | ||
66 | #define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff | ||
67 | |||
68 | /* New style per-packet identifiers for use in cmd_buffer ioctl with | ||
69 | * the RADEON_EMIT_PACKET command. Comments relate new packets to old | ||
70 | * state bits and the packet size: | ||
71 | */ | ||
72 | #define RADEON_EMIT_PP_MISC 0 /* context/7 */ | ||
73 | #define RADEON_EMIT_PP_CNTL 1 /* context/3 */ | ||
74 | #define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ | ||
75 | #define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ | ||
76 | #define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ | ||
77 | #define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ | ||
78 | #define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ | ||
79 | #define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ | ||
80 | #define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ | ||
81 | #define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ | ||
82 | #define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ | ||
83 | #define RADEON_EMIT_RE_MISC 11 /* misc/1 */ | ||
84 | #define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ | ||
85 | #define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ | ||
86 | #define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ | ||
87 | #define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ | ||
88 | #define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ | ||
89 | #define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ | ||
90 | #define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ | ||
91 | #define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ | ||
92 | #define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ | ||
93 | #define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ | ||
94 | #define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ | ||
95 | #define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ | ||
96 | #define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ | ||
97 | #define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ | ||
98 | #define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ | ||
99 | #define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ | ||
100 | #define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ | ||
101 | #define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */ | ||
102 | #define R200_EMIT_TFACTOR_0 30 /* tf/7 */ | ||
103 | #define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */ | ||
104 | #define R200_EMIT_VAP_CTL 32 /* vap/1 */ | ||
105 | #define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ | ||
106 | #define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ | ||
107 | #define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ | ||
108 | #define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ | ||
109 | #define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ | ||
110 | #define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ | ||
111 | #define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ | ||
112 | #define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ | ||
113 | #define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ | ||
114 | #define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ | ||
115 | #define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ | ||
116 | #define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ | ||
117 | #define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ | ||
118 | #define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ | ||
119 | #define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ | ||
120 | #define R200_EMIT_VTE_CNTL 48 /* vte/1 */ | ||
121 | #define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ | ||
122 | #define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ | ||
123 | #define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ | ||
124 | #define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ | ||
125 | #define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ | ||
126 | #define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ | ||
127 | #define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ | ||
128 | #define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ | ||
129 | #define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ | ||
130 | #define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ | ||
131 | #define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ | ||
132 | #define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ | ||
133 | #define R200_EMIT_PP_CUBIC_FACES_0 61 | ||
134 | #define R200_EMIT_PP_CUBIC_OFFSETS_0 62 | ||
135 | #define R200_EMIT_PP_CUBIC_FACES_1 63 | ||
136 | #define R200_EMIT_PP_CUBIC_OFFSETS_1 64 | ||
137 | #define R200_EMIT_PP_CUBIC_FACES_2 65 | ||
138 | #define R200_EMIT_PP_CUBIC_OFFSETS_2 66 | ||
139 | #define R200_EMIT_PP_CUBIC_FACES_3 67 | ||
140 | #define R200_EMIT_PP_CUBIC_OFFSETS_3 68 | ||
141 | #define R200_EMIT_PP_CUBIC_FACES_4 69 | ||
142 | #define R200_EMIT_PP_CUBIC_OFFSETS_4 70 | ||
143 | #define R200_EMIT_PP_CUBIC_FACES_5 71 | ||
144 | #define R200_EMIT_PP_CUBIC_OFFSETS_5 72 | ||
145 | #define RADEON_EMIT_PP_TEX_SIZE_0 73 | ||
146 | #define RADEON_EMIT_PP_TEX_SIZE_1 74 | ||
147 | #define RADEON_EMIT_PP_TEX_SIZE_2 75 | ||
148 | #define R200_EMIT_RB3D_BLENDCOLOR 76 | ||
149 | #define R200_EMIT_TCL_POINT_SPRITE_CNTL 77 | ||
150 | #define RADEON_EMIT_PP_CUBIC_FACES_0 78 | ||
151 | #define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79 | ||
152 | #define RADEON_EMIT_PP_CUBIC_FACES_1 80 | ||
153 | #define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81 | ||
154 | #define RADEON_EMIT_PP_CUBIC_FACES_2 82 | ||
155 | #define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83 | ||
156 | #define R200_EMIT_PP_TRI_PERF_CNTL 84 | ||
157 | #define R200_EMIT_PP_AFS_0 85 | ||
158 | #define R200_EMIT_PP_AFS_1 86 | ||
159 | #define R200_EMIT_ATF_TFACTOR 87 | ||
160 | #define R200_EMIT_PP_TXCTLALL_0 88 | ||
161 | #define R200_EMIT_PP_TXCTLALL_1 89 | ||
162 | #define R200_EMIT_PP_TXCTLALL_2 90 | ||
163 | #define R200_EMIT_PP_TXCTLALL_3 91 | ||
164 | #define R200_EMIT_PP_TXCTLALL_4 92 | ||
165 | #define R200_EMIT_PP_TXCTLALL_5 93 | ||
166 | #define R200_EMIT_VAP_PVS_CNTL 94 | ||
167 | #define RADEON_MAX_STATE_PACKETS 95 | ||
168 | |||
169 | /* Commands understood by cmd_buffer ioctl. More can be added but | ||
170 | * obviously these can't be removed or changed: | ||
171 | */ | ||
172 | #define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ | ||
173 | #define RADEON_CMD_SCALARS 2 /* emit scalar data */ | ||
174 | #define RADEON_CMD_VECTORS 3 /* emit vector data */ | ||
175 | #define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ | ||
176 | #define RADEON_CMD_PACKET3 5 /* emit hw packet */ | ||
177 | #define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ | ||
178 | #define RADEON_CMD_SCALARS2 7 /* r200 stopgap */ | ||
179 | #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: | ||
180 | * doesn't make the cpu wait, just | ||
181 | * the graphics hardware */ | ||
182 | #define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */ | ||
183 | |||
184 | typedef union { | ||
185 | int i; | ||
186 | struct { | ||
187 | unsigned char cmd_type, pad0, pad1, pad2; | ||
188 | } header; | ||
189 | struct { | ||
190 | unsigned char cmd_type, packet_id, pad0, pad1; | ||
191 | } packet; | ||
192 | struct { | ||
193 | unsigned char cmd_type, offset, stride, count; | ||
194 | } scalars; | ||
195 | struct { | ||
196 | unsigned char cmd_type, offset, stride, count; | ||
197 | } vectors; | ||
198 | struct { | ||
199 | unsigned char cmd_type, addr_lo, addr_hi, count; | ||
200 | } veclinear; | ||
201 | struct { | ||
202 | unsigned char cmd_type, buf_idx, pad0, pad1; | ||
203 | } dma; | ||
204 | struct { | ||
205 | unsigned char cmd_type, flags, pad0, pad1; | ||
206 | } wait; | ||
207 | } drm_radeon_cmd_header_t; | ||
208 | |||
209 | #define RADEON_WAIT_2D 0x1 | ||
210 | #define RADEON_WAIT_3D 0x2 | ||
211 | |||
212 | /* Allowed parameters for R300_CMD_PACKET3 | ||
213 | */ | ||
214 | #define R300_CMD_PACKET3_CLEAR 0 | ||
215 | #define R300_CMD_PACKET3_RAW 1 | ||
216 | |||
217 | /* Commands understood by cmd_buffer ioctl for R300. | ||
218 | * The interface has not been stabilized, so some of these may be removed | ||
219 | * and eventually reordered before stabilization. | ||
220 | */ | ||
221 | #define R300_CMD_PACKET0 1 | ||
222 | #define R300_CMD_VPU 2 /* emit vertex program upload */ | ||
223 | #define R300_CMD_PACKET3 3 /* emit a packet3 */ | ||
224 | #define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */ | ||
225 | #define R300_CMD_CP_DELAY 5 | ||
226 | #define R300_CMD_DMA_DISCARD 6 | ||
227 | #define R300_CMD_WAIT 7 | ||
228 | # define R300_WAIT_2D 0x1 | ||
229 | # define R300_WAIT_3D 0x2 | ||
230 | /* these two defines are DOING IT WRONG - however | ||
231 | * we have userspace which relies on using these. | ||
232 | * The wait interface is backwards compat new | ||
233 | * code should use the NEW_WAIT defines below | ||
234 | * THESE ARE NOT BIT FIELDS | ||
235 | */ | ||
236 | # define R300_WAIT_2D_CLEAN 0x3 | ||
237 | # define R300_WAIT_3D_CLEAN 0x4 | ||
238 | |||
239 | # define R300_NEW_WAIT_2D_3D 0x3 | ||
240 | # define R300_NEW_WAIT_2D_2D_CLEAN 0x4 | ||
241 | # define R300_NEW_WAIT_3D_3D_CLEAN 0x6 | ||
242 | # define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8 | ||
243 | |||
244 | #define R300_CMD_SCRATCH 8 | ||
245 | #define R300_CMD_R500FP 9 | ||
246 | |||
247 | typedef union { | ||
248 | unsigned int u; | ||
249 | struct { | ||
250 | unsigned char cmd_type, pad0, pad1, pad2; | ||
251 | } header; | ||
252 | struct { | ||
253 | unsigned char cmd_type, count, reglo, reghi; | ||
254 | } packet0; | ||
255 | struct { | ||
256 | unsigned char cmd_type, count, adrlo, adrhi; | ||
257 | } vpu; | ||
258 | struct { | ||
259 | unsigned char cmd_type, packet, pad0, pad1; | ||
260 | } packet3; | ||
261 | struct { | ||
262 | unsigned char cmd_type, packet; | ||
263 | unsigned short count; /* amount of packet2 to emit */ | ||
264 | } delay; | ||
265 | struct { | ||
266 | unsigned char cmd_type, buf_idx, pad0, pad1; | ||
267 | } dma; | ||
268 | struct { | ||
269 | unsigned char cmd_type, flags, pad0, pad1; | ||
270 | } wait; | ||
271 | struct { | ||
272 | unsigned char cmd_type, reg, n_bufs, flags; | ||
273 | } scratch; | ||
274 | struct { | ||
275 | unsigned char cmd_type, count, adrlo, adrhi_flags; | ||
276 | } r500fp; | ||
277 | } drm_r300_cmd_header_t; | ||
278 | |||
279 | #define RADEON_FRONT 0x1 | ||
280 | #define RADEON_BACK 0x2 | ||
281 | #define RADEON_DEPTH 0x4 | ||
282 | #define RADEON_STENCIL 0x8 | ||
283 | #define RADEON_CLEAR_FASTZ 0x80000000 | ||
284 | #define RADEON_USE_HIERZ 0x40000000 | ||
285 | #define RADEON_USE_COMP_ZBUF 0x20000000 | ||
286 | |||
287 | #define R500FP_CONSTANT_TYPE (1 << 1) | ||
288 | #define R500FP_CONSTANT_CLAMP (1 << 2) | ||
289 | |||
290 | /* Primitive types | ||
291 | */ | ||
292 | #define RADEON_POINTS 0x1 | ||
293 | #define RADEON_LINES 0x2 | ||
294 | #define RADEON_LINE_STRIP 0x3 | ||
295 | #define RADEON_TRIANGLES 0x4 | ||
296 | #define RADEON_TRIANGLE_FAN 0x5 | ||
297 | #define RADEON_TRIANGLE_STRIP 0x6 | ||
298 | |||
299 | /* Vertex/indirect buffer size | ||
300 | */ | ||
301 | #define RADEON_BUFFER_SIZE 65536 | ||
302 | |||
303 | /* Byte offsets for indirect buffer data | ||
304 | */ | ||
305 | #define RADEON_INDEX_PRIM_OFFSET 20 | ||
306 | |||
307 | #define RADEON_SCRATCH_REG_OFFSET 32 | ||
308 | |||
309 | #define R600_SCRATCH_REG_OFFSET 256 | ||
310 | |||
311 | #define RADEON_NR_SAREA_CLIPRECTS 12 | ||
312 | |||
313 | /* There are 2 heaps (local/GART). Each region within a heap is a | ||
314 | * minimum of 64k, and there are at most 64 of them per heap. | ||
315 | */ | ||
316 | #define RADEON_LOCAL_TEX_HEAP 0 | ||
317 | #define RADEON_GART_TEX_HEAP 1 | ||
318 | #define RADEON_NR_TEX_HEAPS 2 | ||
319 | #define RADEON_NR_TEX_REGIONS 64 | ||
320 | #define RADEON_LOG_TEX_GRANULARITY 16 | ||
321 | |||
322 | #define RADEON_MAX_TEXTURE_LEVELS 12 | ||
323 | #define RADEON_MAX_TEXTURE_UNITS 3 | ||
324 | |||
325 | #define RADEON_MAX_SURFACES 8 | ||
326 | |||
327 | /* Blits have strict offset rules. All blit offset must be aligned on | ||
328 | * a 1K-byte boundary. | ||
329 | */ | ||
330 | #define RADEON_OFFSET_SHIFT 10 | ||
331 | #define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) | ||
332 | #define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) | ||
333 | |||
334 | #endif /* __RADEON_SAREA_DEFINES__ */ | ||
335 | |||
336 | typedef struct { | ||
337 | unsigned int red; | ||
338 | unsigned int green; | ||
339 | unsigned int blue; | ||
340 | unsigned int alpha; | ||
341 | } radeon_color_regs_t; | ||
342 | |||
343 | typedef struct { | ||
344 | /* Context state */ | ||
345 | unsigned int pp_misc; /* 0x1c14 */ | ||
346 | unsigned int pp_fog_color; | ||
347 | unsigned int re_solid_color; | ||
348 | unsigned int rb3d_blendcntl; | ||
349 | unsigned int rb3d_depthoffset; | ||
350 | unsigned int rb3d_depthpitch; | ||
351 | unsigned int rb3d_zstencilcntl; | ||
352 | |||
353 | unsigned int pp_cntl; /* 0x1c38 */ | ||
354 | unsigned int rb3d_cntl; | ||
355 | unsigned int rb3d_coloroffset; | ||
356 | unsigned int re_width_height; | ||
357 | unsigned int rb3d_colorpitch; | ||
358 | unsigned int se_cntl; | ||
359 | |||
360 | /* Vertex format state */ | ||
361 | unsigned int se_coord_fmt; /* 0x1c50 */ | ||
362 | |||
363 | /* Line state */ | ||
364 | unsigned int re_line_pattern; /* 0x1cd0 */ | ||
365 | unsigned int re_line_state; | ||
366 | |||
367 | unsigned int se_line_width; /* 0x1db8 */ | ||
368 | |||
369 | /* Bumpmap state */ | ||
370 | unsigned int pp_lum_matrix; /* 0x1d00 */ | ||
371 | |||
372 | unsigned int pp_rot_matrix_0; /* 0x1d58 */ | ||
373 | unsigned int pp_rot_matrix_1; | ||
374 | |||
375 | /* Mask state */ | ||
376 | unsigned int rb3d_stencilrefmask; /* 0x1d7c */ | ||
377 | unsigned int rb3d_ropcntl; | ||
378 | unsigned int rb3d_planemask; | ||
379 | |||
380 | /* Viewport state */ | ||
381 | unsigned int se_vport_xscale; /* 0x1d98 */ | ||
382 | unsigned int se_vport_xoffset; | ||
383 | unsigned int se_vport_yscale; | ||
384 | unsigned int se_vport_yoffset; | ||
385 | unsigned int se_vport_zscale; | ||
386 | unsigned int se_vport_zoffset; | ||
387 | |||
388 | /* Setup state */ | ||
389 | unsigned int se_cntl_status; /* 0x2140 */ | ||
390 | |||
391 | /* Misc state */ | ||
392 | unsigned int re_top_left; /* 0x26c0 */ | ||
393 | unsigned int re_misc; | ||
394 | } drm_radeon_context_regs_t; | ||
395 | |||
396 | typedef struct { | ||
397 | /* Zbias state */ | ||
398 | unsigned int se_zbias_factor; /* 0x1dac */ | ||
399 | unsigned int se_zbias_constant; | ||
400 | } drm_radeon_context2_regs_t; | ||
401 | |||
402 | /* Setup registers for each texture unit | ||
403 | */ | ||
404 | typedef struct { | ||
405 | unsigned int pp_txfilter; | ||
406 | unsigned int pp_txformat; | ||
407 | unsigned int pp_txoffset; | ||
408 | unsigned int pp_txcblend; | ||
409 | unsigned int pp_txablend; | ||
410 | unsigned int pp_tfactor; | ||
411 | unsigned int pp_border_color; | ||
412 | } drm_radeon_texture_regs_t; | ||
413 | |||
414 | typedef struct { | ||
415 | unsigned int start; | ||
416 | unsigned int finish; | ||
417 | unsigned int prim:8; | ||
418 | unsigned int stateidx:8; | ||
419 | unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ | ||
420 | unsigned int vc_format; /* vertex format */ | ||
421 | } drm_radeon_prim_t; | ||
422 | |||
423 | typedef struct { | ||
424 | drm_radeon_context_regs_t context; | ||
425 | drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS]; | ||
426 | drm_radeon_context2_regs_t context2; | ||
427 | unsigned int dirty; | ||
428 | } drm_radeon_state_t; | ||
429 | |||
430 | typedef struct { | ||
431 | /* The channel for communication of state information to the | ||
432 | * kernel on firing a vertex buffer with either of the | ||
433 | * obsoleted vertex/index ioctls. | ||
434 | */ | ||
435 | drm_radeon_context_regs_t context_state; | ||
436 | drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; | ||
437 | unsigned int dirty; | ||
438 | unsigned int vertsize; | ||
439 | unsigned int vc_format; | ||
440 | |||
441 | /* The current cliprects, or a subset thereof. | ||
442 | */ | ||
443 | struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS]; | ||
444 | unsigned int nbox; | ||
445 | |||
446 | /* Counters for client-side throttling of rendering clients. | ||
447 | */ | ||
448 | unsigned int last_frame; | ||
449 | unsigned int last_dispatch; | ||
450 | unsigned int last_clear; | ||
451 | |||
452 | struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS + | ||
453 | 1]; | ||
454 | unsigned int tex_age[RADEON_NR_TEX_HEAPS]; | ||
455 | int ctx_owner; | ||
456 | int pfState; /* number of 3d windows (0,1,2ormore) */ | ||
457 | int pfCurrentPage; /* which buffer is being displayed? */ | ||
458 | int crtc2_base; /* CRTC2 frame offset */ | ||
459 | int tiling_enabled; /* set by drm, read by 2d + 3d clients */ | ||
460 | } drm_radeon_sarea_t; | ||
461 | |||
462 | /* WARNING: If you change any of these defines, make sure to change the | ||
463 | * defines in the Xserver file (xf86drmRadeon.h) | ||
464 | * | ||
465 | * KW: actually it's illegal to change any of this (backwards compatibility). | ||
466 | */ | ||
467 | |||
468 | /* Radeon specific ioctls | ||
469 | * The device specific ioctl range is 0x40 to 0x79. | ||
470 | */ | ||
471 | #define DRM_RADEON_CP_INIT 0x00 | ||
472 | #define DRM_RADEON_CP_START 0x01 | ||
473 | #define DRM_RADEON_CP_STOP 0x02 | ||
474 | #define DRM_RADEON_CP_RESET 0x03 | ||
475 | #define DRM_RADEON_CP_IDLE 0x04 | ||
476 | #define DRM_RADEON_RESET 0x05 | ||
477 | #define DRM_RADEON_FULLSCREEN 0x06 | ||
478 | #define DRM_RADEON_SWAP 0x07 | ||
479 | #define DRM_RADEON_CLEAR 0x08 | ||
480 | #define DRM_RADEON_VERTEX 0x09 | ||
481 | #define DRM_RADEON_INDICES 0x0A | ||
482 | #define DRM_RADEON_NOT_USED | ||
483 | #define DRM_RADEON_STIPPLE 0x0C | ||
484 | #define DRM_RADEON_INDIRECT 0x0D | ||
485 | #define DRM_RADEON_TEXTURE 0x0E | ||
486 | #define DRM_RADEON_VERTEX2 0x0F | ||
487 | #define DRM_RADEON_CMDBUF 0x10 | ||
488 | #define DRM_RADEON_GETPARAM 0x11 | ||
489 | #define DRM_RADEON_FLIP 0x12 | ||
490 | #define DRM_RADEON_ALLOC 0x13 | ||
491 | #define DRM_RADEON_FREE 0x14 | ||
492 | #define DRM_RADEON_INIT_HEAP 0x15 | ||
493 | #define DRM_RADEON_IRQ_EMIT 0x16 | ||
494 | #define DRM_RADEON_IRQ_WAIT 0x17 | ||
495 | #define DRM_RADEON_CP_RESUME 0x18 | ||
496 | #define DRM_RADEON_SETPARAM 0x19 | ||
497 | #define DRM_RADEON_SURF_ALLOC 0x1a | ||
498 | #define DRM_RADEON_SURF_FREE 0x1b | ||
499 | /* KMS ioctl */ | ||
500 | #define DRM_RADEON_GEM_INFO 0x1c | ||
501 | #define DRM_RADEON_GEM_CREATE 0x1d | ||
502 | #define DRM_RADEON_GEM_MMAP 0x1e | ||
503 | #define DRM_RADEON_GEM_PREAD 0x21 | ||
504 | #define DRM_RADEON_GEM_PWRITE 0x22 | ||
505 | #define DRM_RADEON_GEM_SET_DOMAIN 0x23 | ||
506 | #define DRM_RADEON_GEM_WAIT_IDLE 0x24 | ||
507 | #define DRM_RADEON_CS 0x26 | ||
508 | #define DRM_RADEON_INFO 0x27 | ||
509 | #define DRM_RADEON_GEM_SET_TILING 0x28 | ||
510 | #define DRM_RADEON_GEM_GET_TILING 0x29 | ||
511 | #define DRM_RADEON_GEM_BUSY 0x2a | ||
512 | |||
513 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) | ||
514 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) | ||
515 | #define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t) | ||
516 | #define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET) | ||
517 | #define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE) | ||
518 | #define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET) | ||
519 | #define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t) | ||
520 | #define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP) | ||
521 | #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t) | ||
522 | #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t) | ||
523 | #define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t) | ||
524 | #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t) | ||
525 | #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t) | ||
526 | #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t) | ||
527 | #define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t) | ||
528 | #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t) | ||
529 | #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t) | ||
530 | #define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP) | ||
531 | #define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t) | ||
532 | #define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t) | ||
533 | #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t) | ||
534 | #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t) | ||
535 | #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t) | ||
536 | #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME) | ||
537 | #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) | ||
538 | #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) | ||
539 | #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) | ||
540 | /* KMS */ | ||
541 | #define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info) | ||
542 | #define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create) | ||
543 | #define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap) | ||
544 | #define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread) | ||
545 | #define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite) | ||
546 | #define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain) | ||
547 | #define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle) | ||
548 | #define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs) | ||
549 | #define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) | ||
550 | #define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) | ||
551 | #define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) | ||
552 | #define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) | ||
553 | |||
554 | typedef struct drm_radeon_init { | ||
555 | enum { | ||
556 | RADEON_INIT_CP = 0x01, | ||
557 | RADEON_CLEANUP_CP = 0x02, | ||
558 | RADEON_INIT_R200_CP = 0x03, | ||
559 | RADEON_INIT_R300_CP = 0x04, | ||
560 | RADEON_INIT_R600_CP = 0x05 | ||
561 | } func; | ||
562 | unsigned long sarea_priv_offset; | ||
563 | int is_pci; | ||
564 | int cp_mode; | ||
565 | int gart_size; | ||
566 | int ring_size; | ||
567 | int usec_timeout; | ||
568 | |||
569 | unsigned int fb_bpp; | ||
570 | unsigned int front_offset, front_pitch; | ||
571 | unsigned int back_offset, back_pitch; | ||
572 | unsigned int depth_bpp; | ||
573 | unsigned int depth_offset, depth_pitch; | ||
574 | |||
575 | unsigned long fb_offset; | ||
576 | unsigned long mmio_offset; | ||
577 | unsigned long ring_offset; | ||
578 | unsigned long ring_rptr_offset; | ||
579 | unsigned long buffers_offset; | ||
580 | unsigned long gart_textures_offset; | ||
581 | } drm_radeon_init_t; | ||
582 | |||
583 | typedef struct drm_radeon_cp_stop { | ||
584 | int flush; | ||
585 | int idle; | ||
586 | } drm_radeon_cp_stop_t; | ||
587 | |||
588 | typedef struct drm_radeon_fullscreen { | ||
589 | enum { | ||
590 | RADEON_INIT_FULLSCREEN = 0x01, | ||
591 | RADEON_CLEANUP_FULLSCREEN = 0x02 | ||
592 | } func; | ||
593 | } drm_radeon_fullscreen_t; | ||
594 | |||
595 | #define CLEAR_X1 0 | ||
596 | #define CLEAR_Y1 1 | ||
597 | #define CLEAR_X2 2 | ||
598 | #define CLEAR_Y2 3 | ||
599 | #define CLEAR_DEPTH 4 | ||
600 | |||
601 | typedef union drm_radeon_clear_rect { | ||
602 | float f[5]; | ||
603 | unsigned int ui[5]; | ||
604 | } drm_radeon_clear_rect_t; | ||
605 | |||
606 | typedef struct drm_radeon_clear { | ||
607 | unsigned int flags; | ||
608 | unsigned int clear_color; | ||
609 | unsigned int clear_depth; | ||
610 | unsigned int color_mask; | ||
611 | unsigned int depth_mask; /* misnamed field: should be stencil */ | ||
612 | drm_radeon_clear_rect_t __user *depth_boxes; | ||
613 | } drm_radeon_clear_t; | ||
614 | |||
615 | typedef struct drm_radeon_vertex { | ||
616 | int prim; | ||
617 | int idx; /* Index of vertex buffer */ | ||
618 | int count; /* Number of vertices in buffer */ | ||
619 | int discard; /* Client finished with buffer? */ | ||
620 | } drm_radeon_vertex_t; | ||
621 | |||
622 | typedef struct drm_radeon_indices { | ||
623 | int prim; | ||
624 | int idx; | ||
625 | int start; | ||
626 | int end; | ||
627 | int discard; /* Client finished with buffer? */ | ||
628 | } drm_radeon_indices_t; | ||
629 | |||
630 | /* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices | ||
631 | * - allows multiple primitives and state changes in a single ioctl | ||
632 | * - supports driver change to emit native primitives | ||
633 | */ | ||
634 | typedef struct drm_radeon_vertex2 { | ||
635 | int idx; /* Index of vertex buffer */ | ||
636 | int discard; /* Client finished with buffer? */ | ||
637 | int nr_states; | ||
638 | drm_radeon_state_t __user *state; | ||
639 | int nr_prims; | ||
640 | drm_radeon_prim_t __user *prim; | ||
641 | } drm_radeon_vertex2_t; | ||
642 | |||
643 | /* v1.3 - obsoletes drm_radeon_vertex2 | ||
644 | * - allows arbitrarily large cliprect list | ||
645 | * - allows updating of tcl packet, vector and scalar state | ||
646 | * - allows memory-efficient description of state updates | ||
647 | * - allows state to be emitted without a primitive | ||
648 | * (for clears, ctx switches) | ||
649 | * - allows more than one dma buffer to be referenced per ioctl | ||
650 | * - supports tcl driver | ||
651 | * - may be extended in future versions with new cmd types, packets | ||
652 | */ | ||
653 | typedef struct drm_radeon_cmd_buffer { | ||
654 | int bufsz; | ||
655 | char __user *buf; | ||
656 | int nbox; | ||
657 | struct drm_clip_rect __user *boxes; | ||
658 | } drm_radeon_cmd_buffer_t; | ||
659 | |||
660 | typedef struct drm_radeon_tex_image { | ||
661 | unsigned int x, y; /* Blit coordinates */ | ||
662 | unsigned int width, height; | ||
663 | const void __user *data; | ||
664 | } drm_radeon_tex_image_t; | ||
665 | |||
666 | typedef struct drm_radeon_texture { | ||
667 | unsigned int offset; | ||
668 | int pitch; | ||
669 | int format; | ||
670 | int width; /* Texture image coordinates */ | ||
671 | int height; | ||
672 | drm_radeon_tex_image_t __user *image; | ||
673 | } drm_radeon_texture_t; | ||
674 | |||
675 | typedef struct drm_radeon_stipple { | ||
676 | unsigned int __user *mask; | ||
677 | } drm_radeon_stipple_t; | ||
678 | |||
679 | typedef struct drm_radeon_indirect { | ||
680 | int idx; | ||
681 | int start; | ||
682 | int end; | ||
683 | int discard; | ||
684 | } drm_radeon_indirect_t; | ||
685 | |||
686 | /* enum for card type parameters */ | ||
687 | #define RADEON_CARD_PCI 0 | ||
688 | #define RADEON_CARD_AGP 1 | ||
689 | #define RADEON_CARD_PCIE 2 | ||
690 | |||
691 | /* 1.3: An ioctl to get parameters that aren't available to the 3d | ||
692 | * client any other way. | ||
693 | */ | ||
694 | #define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */ | ||
695 | #define RADEON_PARAM_LAST_FRAME 2 | ||
696 | #define RADEON_PARAM_LAST_DISPATCH 3 | ||
697 | #define RADEON_PARAM_LAST_CLEAR 4 | ||
698 | /* Added with DRM version 1.6. */ | ||
699 | #define RADEON_PARAM_IRQ_NR 5 | ||
700 | #define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */ | ||
701 | /* Added with DRM version 1.8. */ | ||
702 | #define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */ | ||
703 | #define RADEON_PARAM_STATUS_HANDLE 8 | ||
704 | #define RADEON_PARAM_SAREA_HANDLE 9 | ||
705 | #define RADEON_PARAM_GART_TEX_HANDLE 10 | ||
706 | #define RADEON_PARAM_SCRATCH_OFFSET 11 | ||
707 | #define RADEON_PARAM_CARD_TYPE 12 | ||
708 | #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ | ||
709 | #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ | ||
710 | #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ | ||
711 | #define RADEON_PARAM_DEVICE_ID 16 | ||
712 | #define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */ | ||
713 | |||
714 | typedef struct drm_radeon_getparam { | ||
715 | int param; | ||
716 | void __user *value; | ||
717 | } drm_radeon_getparam_t; | ||
718 | |||
719 | /* 1.6: Set up a memory manager for regions of shared memory: | ||
720 | */ | ||
721 | #define RADEON_MEM_REGION_GART 1 | ||
722 | #define RADEON_MEM_REGION_FB 2 | ||
723 | |||
724 | typedef struct drm_radeon_mem_alloc { | ||
725 | int region; | ||
726 | int alignment; | ||
727 | int size; | ||
728 | int __user *region_offset; /* offset from start of fb or GART */ | ||
729 | } drm_radeon_mem_alloc_t; | ||
730 | |||
731 | typedef struct drm_radeon_mem_free { | ||
732 | int region; | ||
733 | int region_offset; | ||
734 | } drm_radeon_mem_free_t; | ||
735 | |||
736 | typedef struct drm_radeon_mem_init_heap { | ||
737 | int region; | ||
738 | int size; | ||
739 | int start; | ||
740 | } drm_radeon_mem_init_heap_t; | ||
741 | |||
742 | /* 1.6: Userspace can request & wait on irq's: | ||
743 | */ | ||
744 | typedef struct drm_radeon_irq_emit { | ||
745 | int __user *irq_seq; | ||
746 | } drm_radeon_irq_emit_t; | ||
747 | |||
748 | typedef struct drm_radeon_irq_wait { | ||
749 | int irq_seq; | ||
750 | } drm_radeon_irq_wait_t; | ||
751 | |||
752 | /* 1.10: Clients tell the DRM where they think the framebuffer is located in | ||
753 | * the card's address space, via a new generic ioctl to set parameters | ||
754 | */ | ||
755 | |||
756 | typedef struct drm_radeon_setparam { | ||
757 | unsigned int param; | ||
758 | __s64 value; | ||
759 | } drm_radeon_setparam_t; | ||
760 | |||
761 | #define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ | ||
762 | #define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */ | ||
763 | #define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */ | ||
764 | #define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */ | ||
765 | #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */ | ||
766 | #define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */ | ||
767 | /* 1.14: Clients can allocate/free a surface | ||
768 | */ | ||
769 | typedef struct drm_radeon_surface_alloc { | ||
770 | unsigned int address; | ||
771 | unsigned int size; | ||
772 | unsigned int flags; | ||
773 | } drm_radeon_surface_alloc_t; | ||
774 | |||
775 | typedef struct drm_radeon_surface_free { | ||
776 | unsigned int address; | ||
777 | } drm_radeon_surface_free_t; | ||
778 | |||
779 | #define DRM_RADEON_VBLANK_CRTC1 1 | ||
780 | #define DRM_RADEON_VBLANK_CRTC2 2 | ||
781 | |||
782 | /* | ||
783 | * Kernel modesetting world below. | ||
784 | */ | ||
785 | #define RADEON_GEM_DOMAIN_CPU 0x1 | ||
786 | #define RADEON_GEM_DOMAIN_GTT 0x2 | ||
787 | #define RADEON_GEM_DOMAIN_VRAM 0x4 | ||
788 | |||
789 | struct drm_radeon_gem_info { | ||
790 | uint64_t gart_size; | ||
791 | uint64_t vram_size; | ||
792 | uint64_t vram_visible; | ||
793 | }; | ||
794 | |||
795 | #define RADEON_GEM_NO_BACKING_STORE 1 | ||
796 | |||
797 | struct drm_radeon_gem_create { | ||
798 | uint64_t size; | ||
799 | uint64_t alignment; | ||
800 | uint32_t handle; | ||
801 | uint32_t initial_domain; | ||
802 | uint32_t flags; | ||
803 | }; | ||
804 | |||
805 | #define RADEON_TILING_MACRO 0x1 | ||
806 | #define RADEON_TILING_MICRO 0x2 | ||
807 | #define RADEON_TILING_SWAP_16BIT 0x4 | ||
808 | #define RADEON_TILING_SWAP_32BIT 0x8 | ||
809 | #define RADEON_TILING_SURFACE 0x10 /* this object requires a surface | ||
810 | * when mapped - i.e. front buffer */ | ||
811 | #define RADEON_TILING_MICRO_SQUARE 0x20 | ||
812 | |||
813 | struct drm_radeon_gem_set_tiling { | ||
814 | uint32_t handle; | ||
815 | uint32_t tiling_flags; | ||
816 | uint32_t pitch; | ||
817 | }; | ||
818 | |||
819 | struct drm_radeon_gem_get_tiling { | ||
820 | uint32_t handle; | ||
821 | uint32_t tiling_flags; | ||
822 | uint32_t pitch; | ||
823 | }; | ||
824 | |||
825 | struct drm_radeon_gem_mmap { | ||
826 | uint32_t handle; | ||
827 | uint32_t pad; | ||
828 | uint64_t offset; | ||
829 | uint64_t size; | ||
830 | uint64_t addr_ptr; | ||
831 | }; | ||
832 | |||
833 | struct drm_radeon_gem_set_domain { | ||
834 | uint32_t handle; | ||
835 | uint32_t read_domains; | ||
836 | uint32_t write_domain; | ||
837 | }; | ||
838 | |||
839 | struct drm_radeon_gem_wait_idle { | ||
840 | uint32_t handle; | ||
841 | uint32_t pad; | ||
842 | }; | ||
843 | |||
844 | struct drm_radeon_gem_busy { | ||
845 | uint32_t handle; | ||
846 | uint32_t domain; | ||
847 | }; | ||
848 | |||
849 | struct drm_radeon_gem_pread { | ||
850 | /** Handle for the object being read. */ | ||
851 | uint32_t handle; | ||
852 | uint32_t pad; | ||
853 | /** Offset into the object to read from */ | ||
854 | uint64_t offset; | ||
855 | /** Length of data to read */ | ||
856 | uint64_t size; | ||
857 | /** Pointer to write the data into. */ | ||
858 | /* void *, but pointers are not 32/64 compatible */ | ||
859 | uint64_t data_ptr; | ||
860 | }; | ||
861 | |||
862 | struct drm_radeon_gem_pwrite { | ||
863 | /** Handle for the object being written to. */ | ||
864 | uint32_t handle; | ||
865 | uint32_t pad; | ||
866 | /** Offset into the object to write to */ | ||
867 | uint64_t offset; | ||
868 | /** Length of data to write */ | ||
869 | uint64_t size; | ||
870 | /** Pointer to read the data from. */ | ||
871 | /* void *, but pointers are not 32/64 compatible */ | ||
872 | uint64_t data_ptr; | ||
873 | }; | ||
874 | |||
875 | #define RADEON_CHUNK_ID_RELOCS 0x01 | ||
876 | #define RADEON_CHUNK_ID_IB 0x02 | ||
877 | |||
878 | struct drm_radeon_cs_chunk { | ||
879 | uint32_t chunk_id; | ||
880 | uint32_t length_dw; | ||
881 | uint64_t chunk_data; | ||
882 | }; | ||
883 | |||
884 | struct drm_radeon_cs_reloc { | ||
885 | uint32_t handle; | ||
886 | uint32_t read_domains; | ||
887 | uint32_t write_domain; | ||
888 | uint32_t flags; | ||
889 | }; | ||
890 | |||
891 | struct drm_radeon_cs { | ||
892 | uint32_t num_chunks; | ||
893 | uint32_t cs_id; | ||
894 | /* this points to uint64_t * which point to cs chunks */ | ||
895 | uint64_t chunks; | ||
896 | /* updates to the limits after this CS ioctl */ | ||
897 | uint64_t gart_limit; | ||
898 | uint64_t vram_limit; | ||
899 | }; | ||
900 | |||
901 | #define RADEON_INFO_DEVICE_ID 0x00 | ||
902 | #define RADEON_INFO_NUM_GB_PIPES 0x01 | ||
903 | #define RADEON_INFO_NUM_Z_PIPES 0x02 | ||
904 | #define RADEON_INFO_ACCEL_WORKING 0x03 | ||
905 | #define RADEON_INFO_CRTC_FROM_ID 0x04 | ||
906 | #define RADEON_INFO_ACCEL_WORKING2 0x05 | ||
907 | #define RADEON_INFO_TILING_CONFIG 0x06 | ||
908 | #define RADEON_INFO_WANT_HYPERZ 0x07 | ||
909 | #define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ | ||
910 | #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ | ||
911 | #define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */ | ||
912 | #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ | ||
913 | #define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ | ||
914 | #define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ | ||
915 | |||
916 | struct drm_radeon_info { | ||
917 | uint32_t request; | ||
918 | uint32_t pad; | ||
919 | uint64_t value; | ||
920 | }; | ||
921 | |||
922 | #endif | ||
diff --git a/include/drm/savage_drm.h b/include/drm/savage_drm.h new file mode 100644 index 00000000000..818d49be2e6 --- /dev/null +++ b/include/drm/savage_drm.h | |||
@@ -0,0 +1,210 @@ | |||
1 | /* savage_drm.h -- Public header for the savage driver | ||
2 | * | ||
3 | * Copyright 2004 Felix Kuehling | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sub license, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the | ||
14 | * next paragraph) shall be included in all copies or substantial portions | ||
15 | * of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
20 | * NON-INFRINGEMENT. IN NO EVENT SHALL FELIX KUEHLING BE LIABLE FOR | ||
21 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
22 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | */ | ||
25 | |||
26 | #ifndef __SAVAGE_DRM_H__ | ||
27 | #define __SAVAGE_DRM_H__ | ||
28 | |||
29 | #ifndef __SAVAGE_SAREA_DEFINES__ | ||
30 | #define __SAVAGE_SAREA_DEFINES__ | ||
31 | |||
32 | /* 2 heaps (1 for card, 1 for agp), each divided into up to 128 | ||
33 | * regions, subject to a minimum region size of (1<<16) == 64k. | ||
34 | * | ||
35 | * Clients may subdivide regions internally, but when sharing between | ||
36 | * clients, the region size is the minimum granularity. | ||
37 | */ | ||
38 | |||
39 | #define SAVAGE_CARD_HEAP 0 | ||
40 | #define SAVAGE_AGP_HEAP 1 | ||
41 | #define SAVAGE_NR_TEX_HEAPS 2 | ||
42 | #define SAVAGE_NR_TEX_REGIONS 16 | ||
43 | #define SAVAGE_LOG_MIN_TEX_REGION_SIZE 16 | ||
44 | |||
45 | #endif /* __SAVAGE_SAREA_DEFINES__ */ | ||
46 | |||
47 | typedef struct _drm_savage_sarea { | ||
48 | /* LRU lists for texture memory in agp space and on the card. | ||
49 | */ | ||
50 | struct drm_tex_region texList[SAVAGE_NR_TEX_HEAPS][SAVAGE_NR_TEX_REGIONS + | ||
51 | 1]; | ||
52 | unsigned int texAge[SAVAGE_NR_TEX_HEAPS]; | ||
53 | |||
54 | /* Mechanism to validate card state. | ||
55 | */ | ||
56 | int ctxOwner; | ||
57 | } drm_savage_sarea_t, *drm_savage_sarea_ptr; | ||
58 | |||
59 | /* Savage-specific ioctls | ||
60 | */ | ||
61 | #define DRM_SAVAGE_BCI_INIT 0x00 | ||
62 | #define DRM_SAVAGE_BCI_CMDBUF 0x01 | ||
63 | #define DRM_SAVAGE_BCI_EVENT_EMIT 0x02 | ||
64 | #define DRM_SAVAGE_BCI_EVENT_WAIT 0x03 | ||
65 | |||
66 | #define DRM_IOCTL_SAVAGE_BCI_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t) | ||
67 | #define DRM_IOCTL_SAVAGE_BCI_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t) | ||
68 | #define DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t) | ||
69 | #define DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t) | ||
70 | |||
71 | #define SAVAGE_DMA_PCI 1 | ||
72 | #define SAVAGE_DMA_AGP 3 | ||
73 | typedef struct drm_savage_init { | ||
74 | enum { | ||
75 | SAVAGE_INIT_BCI = 1, | ||
76 | SAVAGE_CLEANUP_BCI = 2 | ||
77 | } func; | ||
78 | unsigned int sarea_priv_offset; | ||
79 | |||
80 | /* some parameters */ | ||
81 | unsigned int cob_size; | ||
82 | unsigned int bci_threshold_lo, bci_threshold_hi; | ||
83 | unsigned int dma_type; | ||
84 | |||
85 | /* frame buffer layout */ | ||
86 | unsigned int fb_bpp; | ||
87 | unsigned int front_offset, front_pitch; | ||
88 | unsigned int back_offset, back_pitch; | ||
89 | unsigned int depth_bpp; | ||
90 | unsigned int depth_offset, depth_pitch; | ||
91 | |||
92 | /* local textures */ | ||
93 | unsigned int texture_offset; | ||
94 | unsigned int texture_size; | ||
95 | |||
96 | /* physical locations of non-permanent maps */ | ||
97 | unsigned long status_offset; | ||
98 | unsigned long buffers_offset; | ||
99 | unsigned long agp_textures_offset; | ||
100 | unsigned long cmd_dma_offset; | ||
101 | } drm_savage_init_t; | ||
102 | |||
103 | typedef union drm_savage_cmd_header drm_savage_cmd_header_t; | ||
104 | typedef struct drm_savage_cmdbuf { | ||
105 | /* command buffer in client's address space */ | ||
106 | drm_savage_cmd_header_t __user *cmd_addr; | ||
107 | unsigned int size; /* size of the command buffer in 64bit units */ | ||
108 | |||
109 | unsigned int dma_idx; /* DMA buffer index to use */ | ||
110 | int discard; /* discard DMA buffer when done */ | ||
111 | /* vertex buffer in client's address space */ | ||
112 | unsigned int __user *vb_addr; | ||
113 | unsigned int vb_size; /* size of client vertex buffer in bytes */ | ||
114 | unsigned int vb_stride; /* stride of vertices in 32bit words */ | ||
115 | /* boxes in client's address space */ | ||
116 | struct drm_clip_rect __user *box_addr; | ||
117 | unsigned int nbox; /* number of clipping boxes */ | ||
118 | } drm_savage_cmdbuf_t; | ||
119 | |||
120 | #define SAVAGE_WAIT_2D 0x1 /* wait for 2D idle before updating event tag */ | ||
121 | #define SAVAGE_WAIT_3D 0x2 /* wait for 3D idle before updating event tag */ | ||
122 | #define SAVAGE_WAIT_IRQ 0x4 /* emit or wait for IRQ, not implemented yet */ | ||
123 | typedef struct drm_savage_event { | ||
124 | unsigned int count; | ||
125 | unsigned int flags; | ||
126 | } drm_savage_event_emit_t, drm_savage_event_wait_t; | ||
127 | |||
128 | /* Commands for the cmdbuf ioctl | ||
129 | */ | ||
130 | #define SAVAGE_CMD_STATE 0 /* a range of state registers */ | ||
131 | #define SAVAGE_CMD_DMA_PRIM 1 /* vertices from DMA buffer */ | ||
132 | #define SAVAGE_CMD_VB_PRIM 2 /* vertices from client vertex buffer */ | ||
133 | #define SAVAGE_CMD_DMA_IDX 3 /* indexed vertices from DMA buffer */ | ||
134 | #define SAVAGE_CMD_VB_IDX 4 /* indexed vertices client vertex buffer */ | ||
135 | #define SAVAGE_CMD_CLEAR 5 /* clear buffers */ | ||
136 | #define SAVAGE_CMD_SWAP 6 /* swap buffers */ | ||
137 | |||
138 | /* Primitive types | ||
139 | */ | ||
140 | #define SAVAGE_PRIM_TRILIST 0 /* triangle list */ | ||
141 | #define SAVAGE_PRIM_TRISTRIP 1 /* triangle strip */ | ||
142 | #define SAVAGE_PRIM_TRIFAN 2 /* triangle fan */ | ||
143 | #define SAVAGE_PRIM_TRILIST_201 3 /* reorder verts for correct flat | ||
144 | * shading on s3d */ | ||
145 | |||
146 | /* Skip flags (vertex format) | ||
147 | */ | ||
148 | #define SAVAGE_SKIP_Z 0x01 | ||
149 | #define SAVAGE_SKIP_W 0x02 | ||
150 | #define SAVAGE_SKIP_C0 0x04 | ||
151 | #define SAVAGE_SKIP_C1 0x08 | ||
152 | #define SAVAGE_SKIP_S0 0x10 | ||
153 | #define SAVAGE_SKIP_T0 0x20 | ||
154 | #define SAVAGE_SKIP_ST0 0x30 | ||
155 | #define SAVAGE_SKIP_S1 0x40 | ||
156 | #define SAVAGE_SKIP_T1 0x80 | ||
157 | #define SAVAGE_SKIP_ST1 0xc0 | ||
158 | #define SAVAGE_SKIP_ALL_S3D 0x3f | ||
159 | #define SAVAGE_SKIP_ALL_S4 0xff | ||
160 | |||
161 | /* Buffer names for clear command | ||
162 | */ | ||
163 | #define SAVAGE_FRONT 0x1 | ||
164 | #define SAVAGE_BACK 0x2 | ||
165 | #define SAVAGE_DEPTH 0x4 | ||
166 | |||
167 | /* 64-bit command header | ||
168 | */ | ||
169 | union drm_savage_cmd_header { | ||
170 | struct { | ||
171 | unsigned char cmd; /* command */ | ||
172 | unsigned char pad0; | ||
173 | unsigned short pad1; | ||
174 | unsigned short pad2; | ||
175 | unsigned short pad3; | ||
176 | } cmd; /* generic */ | ||
177 | struct { | ||
178 | unsigned char cmd; | ||
179 | unsigned char global; /* need idle engine? */ | ||
180 | unsigned short count; /* number of consecutive registers */ | ||
181 | unsigned short start; /* first register */ | ||
182 | unsigned short pad3; | ||
183 | } state; /* SAVAGE_CMD_STATE */ | ||
184 | struct { | ||
185 | unsigned char cmd; | ||
186 | unsigned char prim; /* primitive type */ | ||
187 | unsigned short skip; /* vertex format (skip flags) */ | ||
188 | unsigned short count; /* number of vertices */ | ||
189 | unsigned short start; /* first vertex in DMA/vertex buffer */ | ||
190 | } prim; /* SAVAGE_CMD_DMA_PRIM, SAVAGE_CMD_VB_PRIM */ | ||
191 | struct { | ||
192 | unsigned char cmd; | ||
193 | unsigned char prim; | ||
194 | unsigned short skip; | ||
195 | unsigned short count; /* number of indices that follow */ | ||
196 | unsigned short pad3; | ||
197 | } idx; /* SAVAGE_CMD_DMA_IDX, SAVAGE_CMD_VB_IDX */ | ||
198 | struct { | ||
199 | unsigned char cmd; | ||
200 | unsigned char pad0; | ||
201 | unsigned short pad1; | ||
202 | unsigned int flags; | ||
203 | } clear0; /* SAVAGE_CMD_CLEAR */ | ||
204 | struct { | ||
205 | unsigned int mask; | ||
206 | unsigned int value; | ||
207 | } clear1; /* SAVAGE_CMD_CLEAR data */ | ||
208 | }; | ||
209 | |||
210 | #endif | ||
diff --git a/include/drm/sis_drm.h b/include/drm/sis_drm.h new file mode 100644 index 00000000000..30f7b382746 --- /dev/null +++ b/include/drm/sis_drm.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ | ||
2 | /* | ||
3 | * Copyright 2005 Eric Anholt | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the next | ||
14 | * paragraph) shall be included in all copies or substantial portions of the | ||
15 | * Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
23 | * SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #ifndef __SIS_DRM_H__ | ||
28 | #define __SIS_DRM_H__ | ||
29 | |||
30 | /* SiS specific ioctls */ | ||
31 | #define NOT_USED_0_3 | ||
32 | #define DRM_SIS_FB_ALLOC 0x04 | ||
33 | #define DRM_SIS_FB_FREE 0x05 | ||
34 | #define NOT_USED_6_12 | ||
35 | #define DRM_SIS_AGP_INIT 0x13 | ||
36 | #define DRM_SIS_AGP_ALLOC 0x14 | ||
37 | #define DRM_SIS_AGP_FREE 0x15 | ||
38 | #define DRM_SIS_FB_INIT 0x16 | ||
39 | |||
40 | #define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) | ||
41 | #define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) | ||
42 | #define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) | ||
43 | #define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) | ||
44 | #define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) | ||
45 | #define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) | ||
46 | /* | ||
47 | #define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) | ||
48 | #define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) | ||
49 | #define DRM_IOCTL_SIS_FLIP_FINAL DRM_IO( 0x50) | ||
50 | */ | ||
51 | |||
52 | typedef struct { | ||
53 | int context; | ||
54 | unsigned int offset; | ||
55 | unsigned int size; | ||
56 | unsigned long free; | ||
57 | } drm_sis_mem_t; | ||
58 | |||
59 | typedef struct { | ||
60 | unsigned int offset, size; | ||
61 | } drm_sis_agp_t; | ||
62 | |||
63 | typedef struct { | ||
64 | unsigned int offset, size; | ||
65 | } drm_sis_fb_t; | ||
66 | |||
67 | #endif /* __SIS_DRM_H__ */ | ||
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h new file mode 100644 index 00000000000..fd11a5bd892 --- /dev/null +++ b/include/drm/via_drm.h | |||
@@ -0,0 +1,277 @@ | |||
1 | /* | ||
2 | * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. | ||
3 | * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * copy of this software and associated documentation files (the "Software"), | ||
7 | * to deal in the Software without restriction, including without limitation | ||
8 | * the rights to use, copy, modify, merge, publish, distribute, sub license, | ||
9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
10 | * Software is furnished to do so, subject to the following conditions: | ||
11 | * | ||
12 | * The above copyright notice and this permission notice (including the | ||
13 | * next paragraph) shall be included in all copies or substantial portions | ||
14 | * of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
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, | ||
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | #ifndef _VIA_DRM_H_ | ||
25 | #define _VIA_DRM_H_ | ||
26 | |||
27 | #include "drm.h" | ||
28 | |||
29 | /* WARNING: These defines must be the same as what the Xserver uses. | ||
30 | * if you change them, you must change the defines in the Xserver. | ||
31 | */ | ||
32 | |||
33 | #ifndef _VIA_DEFINES_ | ||
34 | #define _VIA_DEFINES_ | ||
35 | |||
36 | #ifndef __KERNEL__ | ||
37 | #include "via_drmclient.h" | ||
38 | #endif | ||
39 | |||
40 | #define VIA_NR_SAREA_CLIPRECTS 8 | ||
41 | #define VIA_NR_XVMC_PORTS 10 | ||
42 | #define VIA_NR_XVMC_LOCKS 5 | ||
43 | #define VIA_MAX_CACHELINE_SIZE 64 | ||
44 | #define XVMCLOCKPTR(saPriv,lockNo) \ | ||
45 | ((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ | ||
46 | (VIA_MAX_CACHELINE_SIZE - 1)) & \ | ||
47 | ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ | ||
48 | VIA_MAX_CACHELINE_SIZE*(lockNo))) | ||
49 | |||
50 | /* Each region is a minimum of 64k, and there are at most 64 of them. | ||
51 | */ | ||
52 | #define VIA_NR_TEX_REGIONS 64 | ||
53 | #define VIA_LOG_MIN_TEX_REGION_SIZE 16 | ||
54 | #endif | ||
55 | |||
56 | #define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ | ||
57 | #define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ | ||
58 | #define VIA_UPLOAD_CTX 0x4 | ||
59 | #define VIA_UPLOAD_BUFFERS 0x8 | ||
60 | #define VIA_UPLOAD_TEX0 0x10 | ||
61 | #define VIA_UPLOAD_TEX1 0x20 | ||
62 | #define VIA_UPLOAD_CLIPRECTS 0x40 | ||
63 | #define VIA_UPLOAD_ALL 0xff | ||
64 | |||
65 | /* VIA specific ioctls */ | ||
66 | #define DRM_VIA_ALLOCMEM 0x00 | ||
67 | #define DRM_VIA_FREEMEM 0x01 | ||
68 | #define DRM_VIA_AGP_INIT 0x02 | ||
69 | #define DRM_VIA_FB_INIT 0x03 | ||
70 | #define DRM_VIA_MAP_INIT 0x04 | ||
71 | #define DRM_VIA_DEC_FUTEX 0x05 | ||
72 | #define NOT_USED | ||
73 | #define DRM_VIA_DMA_INIT 0x07 | ||
74 | #define DRM_VIA_CMDBUFFER 0x08 | ||
75 | #define DRM_VIA_FLUSH 0x09 | ||
76 | #define DRM_VIA_PCICMD 0x0a | ||
77 | #define DRM_VIA_CMDBUF_SIZE 0x0b | ||
78 | #define NOT_USED | ||
79 | #define DRM_VIA_WAIT_IRQ 0x0d | ||
80 | #define DRM_VIA_DMA_BLIT 0x0e | ||
81 | #define DRM_VIA_BLIT_SYNC 0x0f | ||
82 | |||
83 | #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) | ||
84 | #define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) | ||
85 | #define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t) | ||
86 | #define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t) | ||
87 | #define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t) | ||
88 | #define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t) | ||
89 | #define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t) | ||
90 | #define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t) | ||
91 | #define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH) | ||
92 | #define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t) | ||
93 | #define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ | ||
94 | drm_via_cmdbuf_size_t) | ||
95 | #define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t) | ||
96 | #define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t) | ||
97 | #define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t) | ||
98 | |||
99 | /* Indices into buf.Setup where various bits of state are mirrored per | ||
100 | * context and per buffer. These can be fired at the card as a unit, | ||
101 | * or in a piecewise fashion as required. | ||
102 | */ | ||
103 | |||
104 | #define VIA_TEX_SETUP_SIZE 8 | ||
105 | |||
106 | /* Flags for clear ioctl | ||
107 | */ | ||
108 | #define VIA_FRONT 0x1 | ||
109 | #define VIA_BACK 0x2 | ||
110 | #define VIA_DEPTH 0x4 | ||
111 | #define VIA_STENCIL 0x8 | ||
112 | #define VIA_MEM_VIDEO 0 /* matches drm constant */ | ||
113 | #define VIA_MEM_AGP 1 /* matches drm constant */ | ||
114 | #define VIA_MEM_SYSTEM 2 | ||
115 | #define VIA_MEM_MIXED 3 | ||
116 | #define VIA_MEM_UNKNOWN 4 | ||
117 | |||
118 | typedef struct { | ||
119 | __u32 offset; | ||
120 | __u32 size; | ||
121 | } drm_via_agp_t; | ||
122 | |||
123 | typedef struct { | ||
124 | __u32 offset; | ||
125 | __u32 size; | ||
126 | } drm_via_fb_t; | ||
127 | |||
128 | typedef struct { | ||
129 | __u32 context; | ||
130 | __u32 type; | ||
131 | __u32 size; | ||
132 | unsigned long index; | ||
133 | unsigned long offset; | ||
134 | } drm_via_mem_t; | ||
135 | |||
136 | typedef struct _drm_via_init { | ||
137 | enum { | ||
138 | VIA_INIT_MAP = 0x01, | ||
139 | VIA_CLEANUP_MAP = 0x02 | ||
140 | } func; | ||
141 | |||
142 | unsigned long sarea_priv_offset; | ||
143 | unsigned long fb_offset; | ||
144 | unsigned long mmio_offset; | ||
145 | unsigned long agpAddr; | ||
146 | } drm_via_init_t; | ||
147 | |||
148 | typedef struct _drm_via_futex { | ||
149 | enum { | ||
150 | VIA_FUTEX_WAIT = 0x00, | ||
151 | VIA_FUTEX_WAKE = 0X01 | ||
152 | } func; | ||
153 | __u32 ms; | ||
154 | __u32 lock; | ||
155 | __u32 val; | ||
156 | } drm_via_futex_t; | ||
157 | |||
158 | typedef struct _drm_via_dma_init { | ||
159 | enum { | ||
160 | VIA_INIT_DMA = 0x01, | ||
161 | VIA_CLEANUP_DMA = 0x02, | ||
162 | VIA_DMA_INITIALIZED = 0x03 | ||
163 | } func; | ||
164 | |||
165 | unsigned long offset; | ||
166 | unsigned long size; | ||
167 | unsigned long reg_pause_addr; | ||
168 | } drm_via_dma_init_t; | ||
169 | |||
170 | typedef struct _drm_via_cmdbuffer { | ||
171 | char __user *buf; | ||
172 | unsigned long size; | ||
173 | } drm_via_cmdbuffer_t; | ||
174 | |||
175 | /* Warning: If you change the SAREA structure you must change the Xserver | ||
176 | * structure as well */ | ||
177 | |||
178 | typedef struct _drm_via_tex_region { | ||
179 | unsigned char next, prev; /* indices to form a circular LRU */ | ||
180 | unsigned char inUse; /* owned by a client, or free? */ | ||
181 | int age; /* tracked by clients to update local LRU's */ | ||
182 | } drm_via_tex_region_t; | ||
183 | |||
184 | typedef struct _drm_via_sarea { | ||
185 | unsigned int dirty; | ||
186 | unsigned int nbox; | ||
187 | struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS]; | ||
188 | drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; | ||
189 | int texAge; /* last time texture was uploaded */ | ||
190 | int ctxOwner; /* last context to upload state */ | ||
191 | int vertexPrim; | ||
192 | |||
193 | /* | ||
194 | * Below is for XvMC. | ||
195 | * We want the lock integers alone on, and aligned to, a cache line. | ||
196 | * Therefore this somewhat strange construct. | ||
197 | */ | ||
198 | |||
199 | char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)]; | ||
200 | |||
201 | unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS]; | ||
202 | unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS]; | ||
203 | unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */ | ||
204 | |||
205 | /* Used by the 3d driver only at this point, for pageflipping: | ||
206 | */ | ||
207 | unsigned int pfCurrentOffset; | ||
208 | } drm_via_sarea_t; | ||
209 | |||
210 | typedef struct _drm_via_cmdbuf_size { | ||
211 | enum { | ||
212 | VIA_CMDBUF_SPACE = 0x01, | ||
213 | VIA_CMDBUF_LAG = 0x02 | ||
214 | } func; | ||
215 | int wait; | ||
216 | __u32 size; | ||
217 | } drm_via_cmdbuf_size_t; | ||
218 | |||
219 | typedef enum { | ||
220 | VIA_IRQ_ABSOLUTE = 0x0, | ||
221 | VIA_IRQ_RELATIVE = 0x1, | ||
222 | VIA_IRQ_SIGNAL = 0x10000000, | ||
223 | VIA_IRQ_FORCE_SEQUENCE = 0x20000000 | ||
224 | } via_irq_seq_type_t; | ||
225 | |||
226 | #define VIA_IRQ_FLAGS_MASK 0xF0000000 | ||
227 | |||
228 | enum drm_via_irqs { | ||
229 | drm_via_irq_hqv0 = 0, | ||
230 | drm_via_irq_hqv1, | ||
231 | drm_via_irq_dma0_dd, | ||
232 | drm_via_irq_dma0_td, | ||
233 | drm_via_irq_dma1_dd, | ||
234 | drm_via_irq_dma1_td, | ||
235 | drm_via_irq_num | ||
236 | }; | ||
237 | |||
238 | struct drm_via_wait_irq_request { | ||
239 | unsigned irq; | ||
240 | via_irq_seq_type_t type; | ||
241 | __u32 sequence; | ||
242 | __u32 signal; | ||
243 | }; | ||
244 | |||
245 | typedef union drm_via_irqwait { | ||
246 | struct drm_via_wait_irq_request request; | ||
247 | struct drm_wait_vblank_reply reply; | ||
248 | } drm_via_irqwait_t; | ||
249 | |||
250 | typedef struct drm_via_blitsync { | ||
251 | __u32 sync_handle; | ||
252 | unsigned engine; | ||
253 | } drm_via_blitsync_t; | ||
254 | |||
255 | /* - * Below,"flags" is currently unused but will be used for possible future | ||
256 | * extensions like kernel space bounce buffers for bad alignments and | ||
257 | * blit engine busy-wait polling for better latency in the absence of | ||
258 | * interrupts. | ||
259 | */ | ||
260 | |||
261 | typedef struct drm_via_dmablit { | ||
262 | __u32 num_lines; | ||
263 | __u32 line_length; | ||
264 | |||
265 | __u32 fb_addr; | ||
266 | __u32 fb_stride; | ||
267 | |||
268 | unsigned char *mem_addr; | ||
269 | __u32 mem_stride; | ||
270 | |||
271 | __u32 flags; | ||
272 | int to_fb; | ||
273 | |||
274 | drm_via_blitsync_t sync; | ||
275 | } drm_via_dmablit_t; | ||
276 | |||
277 | #endif /* _VIA_DRM_H_ */ | ||
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h new file mode 100644 index 00000000000..5c36432d9ce --- /dev/null +++ b/include/drm/vmwgfx_drm.h | |||
@@ -0,0 +1,615 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
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, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | **************************************************************************/ | ||
27 | |||
28 | #ifndef __VMWGFX_DRM_H__ | ||
29 | #define __VMWGFX_DRM_H__ | ||
30 | |||
31 | #define DRM_VMW_MAX_SURFACE_FACES 6 | ||
32 | #define DRM_VMW_MAX_MIP_LEVELS 24 | ||
33 | |||
34 | #define DRM_VMW_EXT_NAME_LEN 128 | ||
35 | |||
36 | #define DRM_VMW_GET_PARAM 0 | ||
37 | #define DRM_VMW_ALLOC_DMABUF 1 | ||
38 | #define DRM_VMW_UNREF_DMABUF 2 | ||
39 | #define DRM_VMW_CURSOR_BYPASS 3 | ||
40 | /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ | ||
41 | #define DRM_VMW_CONTROL_STREAM 4 | ||
42 | #define DRM_VMW_CLAIM_STREAM 5 | ||
43 | #define DRM_VMW_UNREF_STREAM 6 | ||
44 | /* guarded by DRM_VMW_PARAM_3D == 1 */ | ||
45 | #define DRM_VMW_CREATE_CONTEXT 7 | ||
46 | #define DRM_VMW_UNREF_CONTEXT 8 | ||
47 | #define DRM_VMW_CREATE_SURFACE 9 | ||
48 | #define DRM_VMW_UNREF_SURFACE 10 | ||
49 | #define DRM_VMW_REF_SURFACE 11 | ||
50 | #define DRM_VMW_EXECBUF 12 | ||
51 | #define DRM_VMW_FIFO_DEBUG 13 | ||
52 | #define DRM_VMW_FENCE_WAIT 14 | ||
53 | /* guarded by minor version >= 2 */ | ||
54 | #define DRM_VMW_UPDATE_LAYOUT 15 | ||
55 | |||
56 | |||
57 | /*************************************************************************/ | ||
58 | /** | ||
59 | * DRM_VMW_GET_PARAM - get device information. | ||
60 | * | ||
61 | * DRM_VMW_PARAM_FIFO_OFFSET: | ||
62 | * Offset to use to map the first page of the FIFO read-only. | ||
63 | * The fifo is mapped using the mmap() system call on the drm device. | ||
64 | * | ||
65 | * DRM_VMW_PARAM_OVERLAY_IOCTL: | ||
66 | * Does the driver support the overlay ioctl. | ||
67 | */ | ||
68 | |||
69 | #define DRM_VMW_PARAM_NUM_STREAMS 0 | ||
70 | #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 | ||
71 | #define DRM_VMW_PARAM_3D 2 | ||
72 | #define DRM_VMW_PARAM_FIFO_OFFSET 3 | ||
73 | #define DRM_VMW_PARAM_HW_CAPS 4 | ||
74 | #define DRM_VMW_PARAM_FIFO_CAPS 5 | ||
75 | #define DRM_VMW_PARAM_MAX_FB_SIZE 6 | ||
76 | |||
77 | /** | ||
78 | * struct drm_vmw_getparam_arg | ||
79 | * | ||
80 | * @value: Returned value. //Out | ||
81 | * @param: Parameter to query. //In. | ||
82 | * | ||
83 | * Argument to the DRM_VMW_GET_PARAM Ioctl. | ||
84 | */ | ||
85 | |||
86 | struct drm_vmw_getparam_arg { | ||
87 | uint64_t value; | ||
88 | uint32_t param; | ||
89 | uint32_t pad64; | ||
90 | }; | ||
91 | |||
92 | /*************************************************************************/ | ||
93 | /** | ||
94 | * DRM_VMW_EXTENSION - Query device extensions. | ||
95 | */ | ||
96 | |||
97 | /** | ||
98 | * struct drm_vmw_extension_rep | ||
99 | * | ||
100 | * @exists: The queried extension exists. | ||
101 | * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension. | ||
102 | * @driver_sarea_offset: Offset to any space in the DRI SAREA | ||
103 | * used by the extension. | ||
104 | * @major: Major version number of the extension. | ||
105 | * @minor: Minor version number of the extension. | ||
106 | * @pl: Patch level version number of the extension. | ||
107 | * | ||
108 | * Output argument to the DRM_VMW_EXTENSION Ioctl. | ||
109 | */ | ||
110 | |||
111 | struct drm_vmw_extension_rep { | ||
112 | int32_t exists; | ||
113 | uint32_t driver_ioctl_offset; | ||
114 | uint32_t driver_sarea_offset; | ||
115 | uint32_t major; | ||
116 | uint32_t minor; | ||
117 | uint32_t pl; | ||
118 | uint32_t pad64; | ||
119 | }; | ||
120 | |||
121 | /** | ||
122 | * union drm_vmw_extension_arg | ||
123 | * | ||
124 | * @extension - Ascii name of the extension to be queried. //In | ||
125 | * @rep - Reply as defined above. //Out | ||
126 | * | ||
127 | * Argument to the DRM_VMW_EXTENSION Ioctl. | ||
128 | */ | ||
129 | |||
130 | union drm_vmw_extension_arg { | ||
131 | char extension[DRM_VMW_EXT_NAME_LEN]; | ||
132 | struct drm_vmw_extension_rep rep; | ||
133 | }; | ||
134 | |||
135 | /*************************************************************************/ | ||
136 | /** | ||
137 | * DRM_VMW_CREATE_CONTEXT - Create a host context. | ||
138 | * | ||
139 | * Allocates a device unique context id, and queues a create context command | ||
140 | * for the host. Does not wait for host completion. | ||
141 | */ | ||
142 | |||
143 | /** | ||
144 | * struct drm_vmw_context_arg | ||
145 | * | ||
146 | * @cid: Device unique context ID. | ||
147 | * | ||
148 | * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. | ||
149 | * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. | ||
150 | */ | ||
151 | |||
152 | struct drm_vmw_context_arg { | ||
153 | int32_t cid; | ||
154 | uint32_t pad64; | ||
155 | }; | ||
156 | |||
157 | /*************************************************************************/ | ||
158 | /** | ||
159 | * DRM_VMW_UNREF_CONTEXT - Create a host context. | ||
160 | * | ||
161 | * Frees a global context id, and queues a destroy host command for the host. | ||
162 | * Does not wait for host completion. The context ID can be used directly | ||
163 | * in the command stream and shows up as the same context ID on the host. | ||
164 | */ | ||
165 | |||
166 | /*************************************************************************/ | ||
167 | /** | ||
168 | * DRM_VMW_CREATE_SURFACE - Create a host suface. | ||
169 | * | ||
170 | * Allocates a device unique surface id, and queues a create surface command | ||
171 | * for the host. Does not wait for host completion. The surface ID can be | ||
172 | * used directly in the command stream and shows up as the same surface | ||
173 | * ID on the host. | ||
174 | */ | ||
175 | |||
176 | /** | ||
177 | * struct drm_wmv_surface_create_req | ||
178 | * | ||
179 | * @flags: Surface flags as understood by the host. | ||
180 | * @format: Surface format as understood by the host. | ||
181 | * @mip_levels: Number of mip levels for each face. | ||
182 | * An unused face should have 0 encoded. | ||
183 | * @size_addr: Address of a user-space array of sruct drm_vmw_size | ||
184 | * cast to an uint64_t for 32-64 bit compatibility. | ||
185 | * The size of the array should equal the total number of mipmap levels. | ||
186 | * @shareable: Boolean whether other clients (as identified by file descriptors) | ||
187 | * may reference this surface. | ||
188 | * @scanout: Boolean whether the surface is intended to be used as a | ||
189 | * scanout. | ||
190 | * | ||
191 | * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. | ||
192 | * Output data from the DRM_VMW_REF_SURFACE Ioctl. | ||
193 | */ | ||
194 | |||
195 | struct drm_vmw_surface_create_req { | ||
196 | uint32_t flags; | ||
197 | uint32_t format; | ||
198 | uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; | ||
199 | uint64_t size_addr; | ||
200 | int32_t shareable; | ||
201 | int32_t scanout; | ||
202 | }; | ||
203 | |||
204 | /** | ||
205 | * struct drm_wmv_surface_arg | ||
206 | * | ||
207 | * @sid: Surface id of created surface or surface to destroy or reference. | ||
208 | * | ||
209 | * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. | ||
210 | * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. | ||
211 | * Input argument to the DRM_VMW_REF_SURFACE Ioctl. | ||
212 | */ | ||
213 | |||
214 | struct drm_vmw_surface_arg { | ||
215 | int32_t sid; | ||
216 | uint32_t pad64; | ||
217 | }; | ||
218 | |||
219 | /** | ||
220 | * struct drm_vmw_size ioctl. | ||
221 | * | ||
222 | * @width - mip level width | ||
223 | * @height - mip level height | ||
224 | * @depth - mip level depth | ||
225 | * | ||
226 | * Description of a mip level. | ||
227 | * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. | ||
228 | */ | ||
229 | |||
230 | struct drm_vmw_size { | ||
231 | uint32_t width; | ||
232 | uint32_t height; | ||
233 | uint32_t depth; | ||
234 | uint32_t pad64; | ||
235 | }; | ||
236 | |||
237 | /** | ||
238 | * union drm_vmw_surface_create_arg | ||
239 | * | ||
240 | * @rep: Output data as described above. | ||
241 | * @req: Input data as described above. | ||
242 | * | ||
243 | * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. | ||
244 | */ | ||
245 | |||
246 | union drm_vmw_surface_create_arg { | ||
247 | struct drm_vmw_surface_arg rep; | ||
248 | struct drm_vmw_surface_create_req req; | ||
249 | }; | ||
250 | |||
251 | /*************************************************************************/ | ||
252 | /** | ||
253 | * DRM_VMW_REF_SURFACE - Reference a host surface. | ||
254 | * | ||
255 | * Puts a reference on a host surface with a give sid, as previously | ||
256 | * returned by the DRM_VMW_CREATE_SURFACE ioctl. | ||
257 | * A reference will make sure the surface isn't destroyed while we hold | ||
258 | * it and will allow the calling client to use the surface ID in the command | ||
259 | * stream. | ||
260 | * | ||
261 | * On successful return, the Ioctl returns the surface information given | ||
262 | * in the DRM_VMW_CREATE_SURFACE ioctl. | ||
263 | */ | ||
264 | |||
265 | /** | ||
266 | * union drm_vmw_surface_reference_arg | ||
267 | * | ||
268 | * @rep: Output data as described above. | ||
269 | * @req: Input data as described above. | ||
270 | * | ||
271 | * Argument to the DRM_VMW_REF_SURFACE Ioctl. | ||
272 | */ | ||
273 | |||
274 | union drm_vmw_surface_reference_arg { | ||
275 | struct drm_vmw_surface_create_req rep; | ||
276 | struct drm_vmw_surface_arg req; | ||
277 | }; | ||
278 | |||
279 | /*************************************************************************/ | ||
280 | /** | ||
281 | * DRM_VMW_UNREF_SURFACE - Unreference a host surface. | ||
282 | * | ||
283 | * Clear a reference previously put on a host surface. | ||
284 | * When all references are gone, including the one implicitly placed | ||
285 | * on creation, | ||
286 | * a destroy surface command will be queued for the host. | ||
287 | * Does not wait for completion. | ||
288 | */ | ||
289 | |||
290 | /*************************************************************************/ | ||
291 | /** | ||
292 | * DRM_VMW_EXECBUF | ||
293 | * | ||
294 | * Submit a command buffer for execution on the host, and return a | ||
295 | * fence sequence that when signaled, indicates that the command buffer has | ||
296 | * executed. | ||
297 | */ | ||
298 | |||
299 | /** | ||
300 | * struct drm_vmw_execbuf_arg | ||
301 | * | ||
302 | * @commands: User-space address of a command buffer cast to an uint64_t. | ||
303 | * @command-size: Size in bytes of the command buffer. | ||
304 | * @throttle-us: Sleep until software is less than @throttle_us | ||
305 | * microseconds ahead of hardware. The driver may round this value | ||
306 | * to the nearest kernel tick. | ||
307 | * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an | ||
308 | * uint64_t. | ||
309 | * @version: Allows expanding the execbuf ioctl parameters without breaking | ||
310 | * backwards compatibility, since user-space will always tell the kernel | ||
311 | * which version it uses. | ||
312 | * @flags: Execbuf flags. None currently. | ||
313 | * | ||
314 | * Argument to the DRM_VMW_EXECBUF Ioctl. | ||
315 | */ | ||
316 | |||
317 | #define DRM_VMW_EXECBUF_VERSION 0 | ||
318 | |||
319 | struct drm_vmw_execbuf_arg { | ||
320 | uint64_t commands; | ||
321 | uint32_t command_size; | ||
322 | uint32_t throttle_us; | ||
323 | uint64_t fence_rep; | ||
324 | uint32_t version; | ||
325 | uint32_t flags; | ||
326 | }; | ||
327 | |||
328 | /** | ||
329 | * struct drm_vmw_fence_rep | ||
330 | * | ||
331 | * @fence_seq: Fence sequence associated with a command submission. | ||
332 | * @error: This member should've been set to -EFAULT on submission. | ||
333 | * The following actions should be take on completion: | ||
334 | * error == -EFAULT: Fence communication failed. The host is synchronized. | ||
335 | * Use the last fence id read from the FIFO fence register. | ||
336 | * error != 0 && error != -EFAULT: | ||
337 | * Fence submission failed. The host is synchronized. Use the fence_seq member. | ||
338 | * error == 0: All is OK, The host may not be synchronized. | ||
339 | * Use the fence_seq member. | ||
340 | * | ||
341 | * Input / Output data to the DRM_VMW_EXECBUF Ioctl. | ||
342 | */ | ||
343 | |||
344 | struct drm_vmw_fence_rep { | ||
345 | uint64_t fence_seq; | ||
346 | int32_t error; | ||
347 | uint32_t pad64; | ||
348 | }; | ||
349 | |||
350 | /*************************************************************************/ | ||
351 | /** | ||
352 | * DRM_VMW_ALLOC_DMABUF | ||
353 | * | ||
354 | * Allocate a DMA buffer that is visible also to the host. | ||
355 | * NOTE: The buffer is | ||
356 | * identified by a handle and an offset, which are private to the guest, but | ||
357 | * useable in the command stream. The guest kernel may translate these | ||
358 | * and patch up the command stream accordingly. In the future, the offset may | ||
359 | * be zero at all times, or it may disappear from the interface before it is | ||
360 | * fixed. | ||
361 | * | ||
362 | * The DMA buffer may stay user-space mapped in the guest at all times, | ||
363 | * and is thus suitable for sub-allocation. | ||
364 | * | ||
365 | * DMA buffers are mapped using the mmap() syscall on the drm device. | ||
366 | */ | ||
367 | |||
368 | /** | ||
369 | * struct drm_vmw_alloc_dmabuf_req | ||
370 | * | ||
371 | * @size: Required minimum size of the buffer. | ||
372 | * | ||
373 | * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
374 | */ | ||
375 | |||
376 | struct drm_vmw_alloc_dmabuf_req { | ||
377 | uint32_t size; | ||
378 | uint32_t pad64; | ||
379 | }; | ||
380 | |||
381 | /** | ||
382 | * struct drm_vmw_dmabuf_rep | ||
383 | * | ||
384 | * @map_handle: Offset to use in the mmap() call used to map the buffer. | ||
385 | * @handle: Handle unique to this buffer. Used for unreferencing. | ||
386 | * @cur_gmr_id: GMR id to use in the command stream when this buffer is | ||
387 | * referenced. See not above. | ||
388 | * @cur_gmr_offset: Offset to use in the command stream when this buffer is | ||
389 | * referenced. See note above. | ||
390 | * | ||
391 | * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
392 | */ | ||
393 | |||
394 | struct drm_vmw_dmabuf_rep { | ||
395 | uint64_t map_handle; | ||
396 | uint32_t handle; | ||
397 | uint32_t cur_gmr_id; | ||
398 | uint32_t cur_gmr_offset; | ||
399 | uint32_t pad64; | ||
400 | }; | ||
401 | |||
402 | /** | ||
403 | * union drm_vmw_dmabuf_arg | ||
404 | * | ||
405 | * @req: Input data as described above. | ||
406 | * @rep: Output data as described above. | ||
407 | * | ||
408 | * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
409 | */ | ||
410 | |||
411 | union drm_vmw_alloc_dmabuf_arg { | ||
412 | struct drm_vmw_alloc_dmabuf_req req; | ||
413 | struct drm_vmw_dmabuf_rep rep; | ||
414 | }; | ||
415 | |||
416 | /*************************************************************************/ | ||
417 | /** | ||
418 | * DRM_VMW_UNREF_DMABUF - Free a DMA buffer. | ||
419 | * | ||
420 | */ | ||
421 | |||
422 | /** | ||
423 | * struct drm_vmw_unref_dmabuf_arg | ||
424 | * | ||
425 | * @handle: Handle indicating what buffer to free. Obtained from the | ||
426 | * DRM_VMW_ALLOC_DMABUF Ioctl. | ||
427 | * | ||
428 | * Argument to the DRM_VMW_UNREF_DMABUF Ioctl. | ||
429 | */ | ||
430 | |||
431 | struct drm_vmw_unref_dmabuf_arg { | ||
432 | uint32_t handle; | ||
433 | uint32_t pad64; | ||
434 | }; | ||
435 | |||
436 | /*************************************************************************/ | ||
437 | /** | ||
438 | * DRM_VMW_FIFO_DEBUG - Get last FIFO submission. | ||
439 | * | ||
440 | * This IOCTL copies the last FIFO submission directly out of the FIFO buffer. | ||
441 | */ | ||
442 | |||
443 | /** | ||
444 | * struct drm_vmw_fifo_debug_arg | ||
445 | * | ||
446 | * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In | ||
447 | * @debug_buffer_size: Size in bytes of debug buffer //In | ||
448 | * @used_size: Number of bytes copied to the buffer // Out | ||
449 | * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out | ||
450 | * | ||
451 | * Argument to the DRM_VMW_FIFO_DEBUG Ioctl. | ||
452 | */ | ||
453 | |||
454 | struct drm_vmw_fifo_debug_arg { | ||
455 | uint64_t debug_buffer; | ||
456 | uint32_t debug_buffer_size; | ||
457 | uint32_t used_size; | ||
458 | int32_t did_not_fit; | ||
459 | uint32_t pad64; | ||
460 | }; | ||
461 | |||
462 | struct drm_vmw_fence_wait_arg { | ||
463 | uint64_t sequence; | ||
464 | uint64_t kernel_cookie; | ||
465 | int32_t cookie_valid; | ||
466 | int32_t pad64; | ||
467 | }; | ||
468 | |||
469 | /*************************************************************************/ | ||
470 | /** | ||
471 | * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. | ||
472 | * | ||
473 | * This IOCTL controls the overlay units of the svga device. | ||
474 | * The SVGA overlay units does not work like regular hardware units in | ||
475 | * that they do not automaticaly read back the contents of the given dma | ||
476 | * buffer. But instead only read back for each call to this ioctl, and | ||
477 | * at any point between this call being made and a following call that | ||
478 | * either changes the buffer or disables the stream. | ||
479 | */ | ||
480 | |||
481 | /** | ||
482 | * struct drm_vmw_rect | ||
483 | * | ||
484 | * Defines a rectangle. Used in the overlay ioctl to define | ||
485 | * source and destination rectangle. | ||
486 | */ | ||
487 | |||
488 | struct drm_vmw_rect { | ||
489 | int32_t x; | ||
490 | int32_t y; | ||
491 | uint32_t w; | ||
492 | uint32_t h; | ||
493 | }; | ||
494 | |||
495 | /** | ||
496 | * struct drm_vmw_control_stream_arg | ||
497 | * | ||
498 | * @stream_id: Stearm to control | ||
499 | * @enabled: If false all following arguments are ignored. | ||
500 | * @handle: Handle to buffer for getting data from. | ||
501 | * @format: Format of the overlay as understood by the host. | ||
502 | * @width: Width of the overlay. | ||
503 | * @height: Height of the overlay. | ||
504 | * @size: Size of the overlay in bytes. | ||
505 | * @pitch: Array of pitches, the two last are only used for YUV12 formats. | ||
506 | * @offset: Offset from start of dma buffer to overlay. | ||
507 | * @src: Source rect, must be within the defined area above. | ||
508 | * @dst: Destination rect, x and y may be negative. | ||
509 | * | ||
510 | * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. | ||
511 | */ | ||
512 | |||
513 | struct drm_vmw_control_stream_arg { | ||
514 | uint32_t stream_id; | ||
515 | uint32_t enabled; | ||
516 | |||
517 | uint32_t flags; | ||
518 | uint32_t color_key; | ||
519 | |||
520 | uint32_t handle; | ||
521 | uint32_t offset; | ||
522 | int32_t format; | ||
523 | uint32_t size; | ||
524 | uint32_t width; | ||
525 | uint32_t height; | ||
526 | uint32_t pitch[3]; | ||
527 | |||
528 | uint32_t pad64; | ||
529 | struct drm_vmw_rect src; | ||
530 | struct drm_vmw_rect dst; | ||
531 | }; | ||
532 | |||
533 | /*************************************************************************/ | ||
534 | /** | ||
535 | * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. | ||
536 | * | ||
537 | */ | ||
538 | |||
539 | #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) | ||
540 | #define DRM_VMW_CURSOR_BYPASS_FLAGS (1) | ||
541 | |||
542 | /** | ||
543 | * struct drm_vmw_cursor_bypass_arg | ||
544 | * | ||
545 | * @flags: Flags. | ||
546 | * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. | ||
547 | * @xpos: X position of cursor. | ||
548 | * @ypos: Y position of cursor. | ||
549 | * @xhot: X hotspot. | ||
550 | * @yhot: Y hotspot. | ||
551 | * | ||
552 | * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. | ||
553 | */ | ||
554 | |||
555 | struct drm_vmw_cursor_bypass_arg { | ||
556 | uint32_t flags; | ||
557 | uint32_t crtc_id; | ||
558 | int32_t xpos; | ||
559 | int32_t ypos; | ||
560 | int32_t xhot; | ||
561 | int32_t yhot; | ||
562 | }; | ||
563 | |||
564 | /*************************************************************************/ | ||
565 | /** | ||
566 | * DRM_VMW_CLAIM_STREAM - Claim a single stream. | ||
567 | */ | ||
568 | |||
569 | /** | ||
570 | * struct drm_vmw_context_arg | ||
571 | * | ||
572 | * @stream_id: Device unique context ID. | ||
573 | * | ||
574 | * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. | ||
575 | * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. | ||
576 | */ | ||
577 | |||
578 | struct drm_vmw_stream_arg { | ||
579 | uint32_t stream_id; | ||
580 | uint32_t pad64; | ||
581 | }; | ||
582 | |||
583 | /*************************************************************************/ | ||
584 | /** | ||
585 | * DRM_VMW_UNREF_STREAM - Unclaim a stream. | ||
586 | * | ||
587 | * Return a single stream that was claimed by this process. Also makes | ||
588 | * sure that the stream has been stopped. | ||
589 | */ | ||
590 | |||
591 | /*************************************************************************/ | ||
592 | /** | ||
593 | * DRM_VMW_UPDATE_LAYOUT - Update layout | ||
594 | * | ||
595 | * Updates the preferred modes and connection status for connectors. The | ||
596 | * command conisits of one drm_vmw_update_layout_arg pointing out a array | ||
597 | * of num_outputs drm_vmw_rect's. | ||
598 | */ | ||
599 | |||
600 | /** | ||
601 | * struct drm_vmw_update_layout_arg | ||
602 | * | ||
603 | * @num_outputs: number of active | ||
604 | * @rects: pointer to array of drm_vmw_rect | ||
605 | * | ||
606 | * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl. | ||
607 | */ | ||
608 | |||
609 | struct drm_vmw_update_layout_arg { | ||
610 | uint32_t num_outputs; | ||
611 | uint32_t pad64; | ||
612 | uint64_t rects; | ||
613 | }; | ||
614 | |||
615 | #endif | ||