Import 2.3.18pre1
[davej-history.git] / drivers / char / drm / drmP.h
blob75103b074cd1d4d6cf889f4907b246859339866b
1 /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
2 * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
3 * Revised: Fri Aug 20 13:04:33 1999 by faith@precisioninsight.com
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * All rights reserved.
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:
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.
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.
27 * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
28 * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drmP.h,v 1.2 1999/06/27 14:08:24 dawes Exp $
32 #ifndef _DRM_P_H_
33 #define _DRM_P_H_
35 #ifdef __KERNEL__
36 #include <linux/module.h>
37 #include <linux/kernel.h>
38 #include <linux/miscdevice.h>
39 #include <linux/fs.h>
40 #include <linux/proc_fs.h>
41 #include <linux/init.h>
42 #include <linux/file.h>
43 #include <linux/pci.h>
44 #include <linux/wrapper.h>
45 #include <linux/version.h>
46 #include <asm/io.h>
47 #include <asm/mman.h>
48 #include <asm/uaccess.h>
49 #ifdef CONFIG_MTRR
50 #include <asm/mtrr.h>
51 #endif
52 #include "drm.h"
54 #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
55 also include looping detection. */
56 #define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */
58 #define DRM_HASH_SIZE 16 /* Size of key hash table */
59 #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
60 #define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
61 #define DRM_LOOPING_LIMIT 5000000
62 #define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */
63 #define DRM_TIME_SLICE (HZ/20) /* Time slice for GLXContexts */
64 #define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */
66 #define DRM_FLAG_DEBUG 0x01
67 #define DRM_FLAG_NOCTX 0x02
69 #define DRM_MEM_DMA 0
70 #define DRM_MEM_SAREA 1
71 #define DRM_MEM_DRIVER 2
72 #define DRM_MEM_MAGIC 3
73 #define DRM_MEM_IOCTLS 4
74 #define DRM_MEM_MAPS 5
75 #define DRM_MEM_VMAS 6
76 #define DRM_MEM_BUFS 7
77 #define DRM_MEM_SEGS 8
78 #define DRM_MEM_PAGES 9
79 #define DRM_MEM_FILES 10
80 #define DRM_MEM_QUEUES 11
81 #define DRM_MEM_CMDS 12
82 #define DRM_MEM_MAPPINGS 13
83 #define DRM_MEM_BUFLISTS 14
85 /* Backward compatibility section */
86 #ifndef _PAGE_PWT
87 /* The name of _PAGE_WT was changed to
88 _PAGE_PWT in Linux 2.2.6 */
89 #define _PAGE_PWT _PAGE_WT
90 #endif
91 /* Wait queue declarations changes in 2.3.1 */
92 #ifndef DECLARE_WAITQUEUE
93 #define DECLARE_WAITQUEUE(w,c) struct wait_queue w = { c, NULL }
94 typedef struct wait_queue *wait_queue_head_t;
95 #define init_waitqueue_head(q) *q = NULL;
96 #endif
98 #define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock)
99 #define _DRM_CAS(lock,old,new,__ret) \
100 do { \
101 int __dummy; /* Can't mark eax as clobbered */ \
102 __asm__ __volatile__( \
103 "lock ; cmpxchg %4,%1\n\t" \
104 "setnz %0" \
105 : "=d" (__ret), \
106 "=m" (__drm_dummy_lock(lock)), \
107 "=a" (__dummy) \
108 : "2" (old), \
109 "r" (new)); \
110 } while (0)
114 /* Macros to make printk easier */
115 #define DRM_ERROR(fmt, arg...) \
116 printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg)
117 #define DRM_MEM_ERROR(area, fmt, arg...) \
118 printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \
119 drm_mem_stats[area].name , ##arg)
120 #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
122 #if DRM_DEBUG_CODE
123 #define DRM_DEBUG(fmt, arg...) \
124 do { \
125 if (drm_flags&DRM_FLAG_DEBUG) \
126 printk(KERN_DEBUG \
127 "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \
128 ##arg); \
129 } while (0)
130 #else
131 #define DRM_DEBUG(fmt, arg...) do { } while (0)
132 #endif
134 #define DRM_PROC_LIMIT (PAGE_SIZE-80)
136 #define DRM_PROC_PRINT(fmt, arg...) \
137 len += sprintf(&buf[len], fmt , ##arg); \
138 if (len > DRM_PROC_LIMIT) return len;
140 #define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
141 len += sprintf(&buf[len], fmt , ##arg); \
142 if (len > DRM_PROC_LIMIT) { ret; return len; }
144 /* Internal types and structures */
145 #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
146 #define DRM_MIN(a,b) ((a)<(b)?(a):(b))
147 #define DRM_MAX(a,b) ((a)>(b)?(a):(b))
149 #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
150 #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
151 #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
153 typedef int drm_ioctl_t(struct inode *inode, struct file *filp,
154 unsigned int cmd, unsigned long arg);
156 typedef struct drm_ioctl_desc {
157 drm_ioctl_t *func;
158 int auth_needed;
159 int root_only;
160 } drm_ioctl_desc_t;
162 typedef struct drm_devstate {
163 pid_t owner; /* X server pid holding x_lock */
165 } drm_devstate_t;
167 typedef struct drm_magic_entry {
168 drm_magic_t magic;
169 struct drm_file *priv;
170 struct drm_magic_entry *next;
171 } drm_magic_entry_t;
173 typedef struct drm_magic_head {
174 struct drm_magic_entry *head;
175 struct drm_magic_entry *tail;
176 } drm_magic_head_t;
178 typedef struct drm_vma_entry {
179 struct vm_area_struct *vma;
180 struct drm_vma_entry *next;
181 pid_t pid;
182 } drm_vma_entry_t;
184 typedef struct drm_buf {
185 int idx; /* Index into master buflist */
186 int total; /* Buffer size */
187 int order; /* log-base-2(total) */
188 int used; /* Amount of buffer in use (for DMA) */
189 unsigned long offset; /* Byte offset (used internally) */
190 void *address; /* Address of buffer */
191 struct drm_buf *next; /* Kernel-only: used for free list */
192 __volatile__ int waiting; /* On kernel DMA queue */
193 __volatile__ int pending; /* On hardware DMA queue */
194 wait_queue_head_t dma_wait; /* Processes waiting */
195 pid_t pid; /* PID of holding process */
196 int context; /* Kernel queue for this buffer */
197 int while_locked;/* Dispatch this buffer while locked */
198 enum {
199 DRM_LIST_NONE = 0,
200 DRM_LIST_FREE = 1,
201 DRM_LIST_WAIT = 2,
202 DRM_LIST_PEND = 3,
203 DRM_LIST_PRIO = 4,
204 DRM_LIST_RECLAIM = 5
205 } list; /* Which list we're on */
206 #if DRM_DMA_HISTOGRAM
207 cycles_t time_queued; /* Queued to kernel DMA queue */
208 cycles_t time_dispatched; /* Dispatched to hardware */
209 cycles_t time_completed; /* Completed by hardware */
210 cycles_t time_freed; /* Back on freelist */
211 #endif
212 } drm_buf_t;
214 #if DRM_DMA_HISTOGRAM
215 #define DRM_DMA_HISTOGRAM_SLOTS 9
216 #define DRM_DMA_HISTOGRAM_INITIAL 10
217 #define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10)
218 typedef struct drm_histogram {
219 atomic_t total;
221 atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS];
222 atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS];
223 atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS];
225 atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS];
226 atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS];
228 atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS];
229 atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS];
230 atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS];
231 atomic_t lacq[DRM_DMA_HISTOGRAM_SLOTS];
232 atomic_t lhld[DRM_DMA_HISTOGRAM_SLOTS];
233 } drm_histogram_t;
234 #endif
236 /* bufs is one longer than it has to be */
237 typedef struct drm_waitlist {
238 int count; /* Number of possible buffers */
239 drm_buf_t **bufs; /* List of pointers to buffers */
240 drm_buf_t **rp; /* Read pointer */
241 drm_buf_t **wp; /* Write pointer */
242 drm_buf_t **end; /* End pointer */
243 spinlock_t read_lock;
244 spinlock_t write_lock;
245 } drm_waitlist_t;
247 typedef struct drm_freelist {
248 int initialized; /* Freelist in use */
249 atomic_t count; /* Number of free buffers */
250 drm_buf_t *next; /* End pointer */
252 wait_queue_head_t waiting; /* Processes waiting on free bufs */
253 int low_mark; /* Low water mark */
254 int high_mark; /* High water mark */
255 atomic_t wfh; /* If waiting for high mark */
256 } drm_freelist_t;
258 typedef struct drm_buf_entry {
259 int buf_size;
260 int buf_count;
261 drm_buf_t *buflist;
262 int seg_count;
263 int page_order;
264 unsigned long *seglist;
266 drm_freelist_t freelist;
267 } drm_buf_entry_t;
269 typedef struct drm_hw_lock {
270 __volatile__ unsigned int lock;
271 char padding[60]; /* Pad to cache line */
272 } drm_hw_lock_t;
274 typedef struct drm_file {
275 int authenticated;
276 int minor;
277 pid_t pid;
278 uid_t uid;
279 drm_magic_t magic;
280 unsigned long ioctl_count;
281 struct drm_file *next;
282 struct drm_file *prev;
283 struct drm_device *dev;
284 } drm_file_t;
287 typedef struct drm_queue {
288 atomic_t use_count; /* Outstanding uses (+1) */
289 atomic_t finalization; /* Finalization in progress */
290 atomic_t block_count; /* Count of processes waiting */
291 atomic_t block_read; /* Queue blocked for reads */
292 wait_queue_head_t read_queue; /* Processes waiting on block_read */
293 atomic_t block_write; /* Queue blocked for writes */
294 wait_queue_head_t write_queue; /* Processes waiting on block_write */
295 atomic_t total_queued; /* Total queued statistic */
296 atomic_t total_flushed;/* Total flushes statistic */
297 atomic_t total_locks; /* Total locks statistics */
298 drm_ctx_flags_t flags; /* Context preserving and 2D-only */
299 drm_waitlist_t waitlist; /* Pending buffers */
300 wait_queue_head_t flush_queue; /* Processes waiting until flush */
301 } drm_queue_t;
303 typedef struct drm_lock_data {
304 drm_hw_lock_t *hw_lock; /* Hardware lock */
305 pid_t pid; /* PID of lock holder (0=kernel) */
306 wait_queue_head_t lock_queue; /* Queue of blocked processes */
307 unsigned long lock_time; /* Time of last lock in jiffies */
308 } drm_lock_data_t;
310 typedef struct drm_device_dma {
311 /* Performance Counters */
312 atomic_t total_prio; /* Total DRM_DMA_PRIORITY */
313 atomic_t total_bytes; /* Total bytes DMA'd */
314 atomic_t total_dmas; /* Total DMA buffers dispatched */
316 atomic_t total_missed_dma; /* Missed drm_do_dma */
317 atomic_t total_missed_lock; /* Missed lock in drm_do_dma */
318 atomic_t total_missed_free; /* Missed drm_free_this_buffer */
319 atomic_t total_missed_sched;/* Missed drm_dma_schedule */
321 atomic_t total_tried; /* Tried next_buffer */
322 atomic_t total_hit; /* Sent next_buffer */
323 atomic_t total_lost; /* Lost interrupt */
325 drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
326 int buf_count;
327 drm_buf_t **buflist; /* Vector of pointers info bufs */
328 int seg_count;
329 int page_count;
330 unsigned long *pagelist;
331 unsigned long byte_count;
333 /* DMA support */
334 drm_buf_t *this_buffer; /* Buffer being sent */
335 drm_buf_t *next_buffer; /* Selected buffer to send */
336 drm_queue_t *next_queue; /* Queue from which buffer selected*/
337 wait_queue_head_t waiting; /* Processes waiting on free bufs */
338 } drm_device_dma_t;
340 typedef struct drm_device {
341 const char *name; /* Simple driver name */
342 char *unique; /* Unique identifier: e.g., busid */
343 int unique_len; /* Length of unique field */
344 dev_t device; /* Device number for mknod */
345 char *devname; /* For /proc/interrupts */
347 int blocked; /* Blocked due to VC switch? */
348 struct proc_dir_entry *root; /* Root for this device's entries */
350 /* Locks */
351 spinlock_t count_lock; /* For inuse, open_count, buf_use */
352 struct semaphore struct_sem; /* For others */
354 /* Usage Counters */
355 int open_count; /* Outstanding files open */
356 atomic_t ioctl_count; /* Outstanding IOCTLs pending */
357 atomic_t vma_count; /* Outstanding vma areas open */
358 int buf_use; /* Buffers in use -- cannot alloc */
359 atomic_t buf_alloc; /* Buffer allocation in progress */
361 /* Performance Counters */
362 atomic_t total_open;
363 atomic_t total_close;
364 atomic_t total_ioctl;
365 atomic_t total_irq; /* Total interruptions */
366 atomic_t total_ctx; /* Total context switches */
368 atomic_t total_locks;
369 atomic_t total_unlocks;
370 atomic_t total_contends;
371 atomic_t total_sleeps;
373 /* Authentication */
374 drm_file_t *file_first;
375 drm_file_t *file_last;
376 drm_magic_head_t magiclist[DRM_HASH_SIZE];
378 /* Memory management */
379 drm_map_t **maplist; /* Vector of pointers to regions */
380 int map_count; /* Number of mappable regions */
382 drm_vma_entry_t *vmalist; /* List of vmas (for debugging) */
383 drm_lock_data_t lock; /* Information on hardware lock */
385 /* DMA queues (contexts) */
386 int queue_count; /* Number of active DMA queues */
387 int queue_reserved; /* Number of reserved DMA queues */
388 int queue_slots; /* Actual length of queuelist */
389 drm_queue_t **queuelist; /* Vector of pointers to DMA queues */
390 drm_device_dma_t *dma; /* Optional pointer for DMA support */
392 /* Context support */
393 int irq; /* Interrupt used by board */
394 __volatile__ int context_flag; /* Context swapping flag */
395 __volatile__ int interrupt_flag;/* Interruption handler flag */
396 __volatile__ int dma_flag; /* DMA dispatch flag */
397 struct timer_list timer; /* Timer for delaying ctx switch */
398 wait_queue_head_t context_wait; /* Processes waiting on ctx switch */
399 int last_checked; /* Last context checked for DMA */
400 int last_context; /* Last current context */
401 unsigned long last_switch; /* jiffies at last context switch */
402 struct tq_struct tq;
403 cycles_t ctx_start;
404 cycles_t lck_start;
405 #if DRM_DMA_HISTOGRAM
406 drm_histogram_t histo;
407 #endif
409 /* Callback to X server for context switch
410 and for heavy-handed reset. */
411 char buf[DRM_BSZ]; /* Output buffer */
412 char *buf_rp; /* Read pointer */
413 char *buf_wp; /* Write pointer */
414 char *buf_end; /* End pointer */
415 struct fasync_struct *buf_async;/* Processes waiting for SIGIO */
416 wait_queue_head_t buf_readers; /* Processes waiting to read */
417 wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
418 } drm_device_t;
421 /* Internal function definitions */
423 /* Misc. support (init.c) */
424 extern int drm_flags;
425 extern void drm_parse_options(char *s);
428 /* Device support (fops.c) */
429 extern int drm_open_helper(struct inode *inode, struct file *filp,
430 drm_device_t *dev);
431 extern int drm_flush(struct file *filp);
432 extern int drm_release(struct inode *inode, struct file *filp);
433 extern int drm_fasync(int fd, struct file *filp, int on);
434 extern ssize_t drm_read(struct file *filp, char *buf, size_t count,
435 loff_t *off);
436 extern int drm_write_string(drm_device_t *dev, const char *s);
438 /* Mapping support (vm.c) */
439 extern unsigned long drm_vm_nopage(struct vm_area_struct *vma,
440 unsigned long address,
441 int write_access);
442 extern unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
443 unsigned long address,
444 int write_access);
445 extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
446 unsigned long address,
447 int write_access);
448 extern void drm_vm_open(struct vm_area_struct *vma);
449 extern void drm_vm_close(struct vm_area_struct *vma);
450 extern int drm_mmap_dma(struct file *filp,
451 struct vm_area_struct *vma);
452 extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
455 /* Proc support (proc.c) */
456 extern int drm_proc_init(drm_device_t *dev);
457 extern int drm_proc_cleanup(void);
459 /* Memory management support (memory.c) */
460 extern void drm_mem_init(void);
461 extern int drm_mem_info(char *buf, char **start, off_t offset,
462 int len, int *eof, void *data);
463 extern void *drm_alloc(size_t size, int area);
464 extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
465 int area);
466 extern char *drm_strdup(const char *s, int area);
467 extern void drm_strfree(const char *s, int area);
468 extern void drm_free(void *pt, size_t size, int area);
469 extern unsigned long drm_alloc_pages(int order, int area);
470 extern void drm_free_pages(unsigned long address, int order,
471 int area);
472 extern void *drm_ioremap(unsigned long offset, unsigned long size);
473 extern void drm_ioremapfree(void *pt, unsigned long size);
475 /* Buffer management support (bufs.c) */
476 extern int drm_order(unsigned long size);
477 extern int drm_addmap(struct inode *inode, struct file *filp,
478 unsigned int cmd, unsigned long arg);
479 extern int drm_addbufs(struct inode *inode, struct file *filp,
480 unsigned int cmd, unsigned long arg);
481 extern int drm_infobufs(struct inode *inode, struct file *filp,
482 unsigned int cmd, unsigned long arg);
483 extern int drm_markbufs(struct inode *inode, struct file *filp,
484 unsigned int cmd, unsigned long arg);
485 extern int drm_freebufs(struct inode *inode, struct file *filp,
486 unsigned int cmd, unsigned long arg);
487 extern int drm_mapbufs(struct inode *inode, struct file *filp,
488 unsigned int cmd, unsigned long arg);
491 /* Buffer list management support (lists.c) */
492 extern int drm_waitlist_create(drm_waitlist_t *bl, int count);
493 extern int drm_waitlist_destroy(drm_waitlist_t *bl);
494 extern int drm_waitlist_put(drm_waitlist_t *bl, drm_buf_t *buf);
495 extern drm_buf_t *drm_waitlist_get(drm_waitlist_t *bl);
497 extern int drm_freelist_create(drm_freelist_t *bl, int count);
498 extern int drm_freelist_destroy(drm_freelist_t *bl);
499 extern int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl,
500 drm_buf_t *buf);
501 extern drm_buf_t *drm_freelist_get(drm_freelist_t *bl, int block);
503 /* DMA support (gen_dma.c) */
504 extern void drm_dma_setup(drm_device_t *dev);
505 extern void drm_dma_takedown(drm_device_t *dev);
506 extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
507 extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
508 extern int drm_context_switch(drm_device_t *dev, int old, int new);
509 extern int drm_context_switch_complete(drm_device_t *dev, int new);
510 extern void drm_wakeup(drm_device_t *dev, drm_buf_t *buf);
511 extern void drm_clear_next_buffer(drm_device_t *dev);
512 extern int drm_select_queue(drm_device_t *dev,
513 void (*wrapper)(unsigned long));
514 extern int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *dma);
515 extern int drm_dma_get_buffers(drm_device_t *dev, drm_dma_t *dma);
516 #if DRM_DMA_HISTOGRAM
517 extern int drm_histogram_slot(unsigned long count);
518 extern void drm_histogram_compute(drm_device_t *dev, drm_buf_t *buf);
519 #endif
522 /* Misc. IOCTL support (ioctl.c) */
523 extern int drm_irq_busid(struct inode *inode, struct file *filp,
524 unsigned int cmd, unsigned long arg);
525 extern int drm_getunique(struct inode *inode, struct file *filp,
526 unsigned int cmd, unsigned long arg);
527 extern int drm_setunique(struct inode *inode, struct file *filp,
528 unsigned int cmd, unsigned long arg);
531 /* Context IOCTL support (context.c) */
532 extern int drm_resctx(struct inode *inode, struct file *filp,
533 unsigned int cmd, unsigned long arg);
534 extern int drm_addctx(struct inode *inode, struct file *filp,
535 unsigned int cmd, unsigned long arg);
536 extern int drm_modctx(struct inode *inode, struct file *filp,
537 unsigned int cmd, unsigned long arg);
538 extern int drm_getctx(struct inode *inode, struct file *filp,
539 unsigned int cmd, unsigned long arg);
540 extern int drm_switchctx(struct inode *inode, struct file *filp,
541 unsigned int cmd, unsigned long arg);
542 extern int drm_newctx(struct inode *inode, struct file *filp,
543 unsigned int cmd, unsigned long arg);
544 extern int drm_rmctx(struct inode *inode, struct file *filp,
545 unsigned int cmd, unsigned long arg);
548 /* Drawable IOCTL support (drawable.c) */
549 extern int drm_adddraw(struct inode *inode, struct file *filp,
550 unsigned int cmd, unsigned long arg);
551 extern int drm_rmdraw(struct inode *inode, struct file *filp,
552 unsigned int cmd, unsigned long arg);
555 /* Authentication IOCTL support (auth.c) */
556 extern int drm_add_magic(drm_device_t *dev, drm_file_t *priv,
557 drm_magic_t magic);
558 extern int drm_remove_magic(drm_device_t *dev, drm_magic_t magic);
559 extern int drm_getmagic(struct inode *inode, struct file *filp,
560 unsigned int cmd, unsigned long arg);
561 extern int drm_authmagic(struct inode *inode, struct file *filp,
562 unsigned int cmd, unsigned long arg);
565 /* Locking IOCTL support (lock.c) */
566 extern int drm_block(struct inode *inode, struct file *filp,
567 unsigned int cmd, unsigned long arg);
568 extern int drm_unblock(struct inode *inode, struct file *filp,
569 unsigned int cmd, unsigned long arg);
570 extern int drm_lock_take(__volatile__ unsigned int *lock,
571 unsigned int context);
572 extern int drm_lock_transfer(__volatile__ unsigned int *lock,
573 unsigned int context);
574 extern int drm_lock_free(drm_device_t *dev,
575 __volatile__ unsigned int *lock,
576 unsigned int context);
577 extern int drm_finish(struct inode *inode, struct file *filp,
578 unsigned int cmd, unsigned long arg);
579 extern int drm_flush_unblock(drm_device_t *dev, int context,
580 drm_lock_flags_t flags);
581 extern int drm_flush_block_and_flush(drm_device_t *dev, int context,
582 drm_lock_flags_t flags);
583 #endif
584 #endif