1 /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
2 * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
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
21 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
27 * Rickard E. (Rik) Faith <faith@precisioninsight.com>
35 #include <linux/config.h>
36 #include <linux/module.h>
37 #include <linux/kernel.h>
38 #include <linux/miscdevice.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>
48 #include <asm/uaccess.h>
52 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
53 #include <linux/poll.h>
57 #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
58 also include looping detection. */
59 #define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */
61 #define DRM_HASH_SIZE 16 /* Size of key hash table */
62 #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
63 #define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
64 #define DRM_LOOPING_LIMIT 5000000
65 #define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */
66 #define DRM_TIME_SLICE (HZ/20) /* Time slice for GLXContexts */
67 #define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */
69 #define DRM_FLAG_DEBUG 0x01
70 #define DRM_FLAG_NOCTX 0x02
73 #define DRM_MEM_SAREA 1
74 #define DRM_MEM_DRIVER 2
75 #define DRM_MEM_MAGIC 3
76 #define DRM_MEM_IOCTLS 4
77 #define DRM_MEM_MAPS 5
78 #define DRM_MEM_VMAS 6
79 #define DRM_MEM_BUFS 7
80 #define DRM_MEM_SEGS 8
81 #define DRM_MEM_PAGES 9
82 #define DRM_MEM_FILES 10
83 #define DRM_MEM_QUEUES 11
84 #define DRM_MEM_CMDS 12
85 #define DRM_MEM_MAPPINGS 13
86 #define DRM_MEM_BUFLISTS 14
88 /* Backward compatibility section */
89 /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */
91 #define _PAGE_PWT _PAGE_WT
93 /* Wait queue declarations changed in 2.3.1 */
94 #ifndef DECLARE_WAITQUEUE
95 #define DECLARE_WAITQUEUE(w,c) struct wait_queue w = { c, NULL }
96 typedef struct wait_queue
*wait_queue_head_t
;
97 #define init_waitqueue_head(q) *q = NULL;
100 /* _PAGE_4M changed to _PAGE_PSE in 2.3.23 */
102 #define _PAGE_PSE _PAGE_4M
105 /* vm_offset changed to vm_pgoff in 2.3.25 */
106 #if LINUX_VERSION_CODE < 0x020319
107 #define VM_OFFSET(vma) ((vma)->vm_offset)
109 #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
112 /* *_nopage return values defined in 2.3.26 */
113 #ifndef NOPAGE_SIGBUS
114 #define NOPAGE_SIGBUS 0
120 /* Generic cmpxchg added in 2.3.x */
121 #ifndef __HAVE_ARCH_CMPXCHG
122 /* Include this here so that driver can be
123 used with older kernels. */
124 static inline unsigned long __cmpxchg(volatile void *ptr
, unsigned long old
,
125 unsigned long new, int size
)
130 __asm__
__volatile__(LOCK_PREFIX
"cmpxchgb %b1,%2"
132 : "q"(new), "m"(*__xg(ptr
)), "0"(old
)
136 __asm__
__volatile__(LOCK_PREFIX
"cmpxchgw %w1,%2"
138 : "q"(new), "m"(*__xg(ptr
)), "0"(old
)
142 __asm__
__volatile__(LOCK_PREFIX
"cmpxchgl %1,%2"
144 : "q"(new), "m"(*__xg(ptr
)), "0"(old
)
151 #define cmpxchg(ptr,o,n) \
152 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
153 (unsigned long)(n),sizeof(*(ptr))))
156 /* Macros to make printk easier */
157 #define DRM_ERROR(fmt, arg...) \
158 printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg)
159 #define DRM_MEM_ERROR(area, fmt, arg...) \
160 printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \
161 drm_mem_stats[area].name , ##arg)
162 #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
165 #define DRM_DEBUG(fmt, arg...) \
167 if (drm_flags&DRM_FLAG_DEBUG) \
169 "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \
173 #define DRM_DEBUG(fmt, arg...) do { } while (0)
176 #define DRM_PROC_LIMIT (PAGE_SIZE-80)
178 #define DRM_PROC_PRINT(fmt, arg...) \
179 len += sprintf(&buf[len], fmt , ##arg); \
180 if (len > DRM_PROC_LIMIT) return len;
182 #define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
183 len += sprintf(&buf[len], fmt , ##arg); \
184 if (len > DRM_PROC_LIMIT) { ret; return len; }
186 /* Internal types and structures */
187 #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
188 #define DRM_MIN(a,b) ((a)<(b)?(a):(b))
189 #define DRM_MAX(a,b) ((a)>(b)?(a):(b))
191 #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
192 #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
193 #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
195 typedef int drm_ioctl_t(struct inode
*inode
, struct file
*filp
,
196 unsigned int cmd
, unsigned long arg
);
198 typedef struct drm_ioctl_desc
{
204 typedef struct drm_devstate
{
205 pid_t owner
; /* X server pid holding x_lock */
209 typedef struct drm_magic_entry
{
211 struct drm_file
*priv
;
212 struct drm_magic_entry
*next
;
215 typedef struct drm_magic_head
{
216 struct drm_magic_entry
*head
;
217 struct drm_magic_entry
*tail
;
220 typedef struct drm_vma_entry
{
221 struct vm_area_struct
*vma
;
222 struct drm_vma_entry
*next
;
226 typedef struct drm_buf
{
227 int idx
; /* Index into master buflist */
228 int total
; /* Buffer size */
229 int order
; /* log-base-2(total) */
230 int used
; /* Amount of buffer in use (for DMA) */
231 unsigned long offset
; /* Byte offset (used internally) */
232 void *address
; /* Address of buffer */
233 struct drm_buf
*next
; /* Kernel-only: used for free list */
234 __volatile__
int waiting
; /* On kernel DMA queue */
235 __volatile__
int pending
; /* On hardware DMA queue */
236 wait_queue_head_t dma_wait
; /* Processes waiting */
237 pid_t pid
; /* PID of holding process */
238 int context
; /* Kernel queue for this buffer */
239 int while_locked
;/* Dispatch this buffer while locked */
247 } list
; /* Which list we're on */
248 #if DRM_DMA_HISTOGRAM
249 cycles_t time_queued
; /* Queued to kernel DMA queue */
250 cycles_t time_dispatched
; /* Dispatched to hardware */
251 cycles_t time_completed
; /* Completed by hardware */
252 cycles_t time_freed
; /* Back on freelist */
256 #if DRM_DMA_HISTOGRAM
257 #define DRM_DMA_HISTOGRAM_SLOTS 9
258 #define DRM_DMA_HISTOGRAM_INITIAL 10
259 #define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10)
260 typedef struct drm_histogram
{
263 atomic_t queued_to_dispatched
[DRM_DMA_HISTOGRAM_SLOTS
];
264 atomic_t dispatched_to_completed
[DRM_DMA_HISTOGRAM_SLOTS
];
265 atomic_t completed_to_freed
[DRM_DMA_HISTOGRAM_SLOTS
];
267 atomic_t queued_to_completed
[DRM_DMA_HISTOGRAM_SLOTS
];
268 atomic_t queued_to_freed
[DRM_DMA_HISTOGRAM_SLOTS
];
270 atomic_t dma
[DRM_DMA_HISTOGRAM_SLOTS
];
271 atomic_t schedule
[DRM_DMA_HISTOGRAM_SLOTS
];
272 atomic_t ctx
[DRM_DMA_HISTOGRAM_SLOTS
];
273 atomic_t lacq
[DRM_DMA_HISTOGRAM_SLOTS
];
274 atomic_t lhld
[DRM_DMA_HISTOGRAM_SLOTS
];
278 /* bufs is one longer than it has to be */
279 typedef struct drm_waitlist
{
280 int count
; /* Number of possible buffers */
281 drm_buf_t
**bufs
; /* List of pointers to buffers */
282 drm_buf_t
**rp
; /* Read pointer */
283 drm_buf_t
**wp
; /* Write pointer */
284 drm_buf_t
**end
; /* End pointer */
285 spinlock_t read_lock
;
286 spinlock_t write_lock
;
289 typedef struct drm_freelist
{
290 int initialized
; /* Freelist in use */
291 atomic_t count
; /* Number of free buffers */
292 drm_buf_t
*next
; /* End pointer */
294 wait_queue_head_t waiting
; /* Processes waiting on free bufs */
295 int low_mark
; /* Low water mark */
296 int high_mark
; /* High water mark */
297 atomic_t wfh
; /* If waiting for high mark */
300 typedef struct drm_buf_entry
{
306 unsigned long *seglist
;
308 drm_freelist_t freelist
;
311 typedef struct drm_hw_lock
{
312 __volatile__
unsigned int lock
;
313 char padding
[60]; /* Pad to cache line */
316 typedef struct drm_file
{
322 unsigned long ioctl_count
;
323 struct drm_file
*next
;
324 struct drm_file
*prev
;
325 struct drm_device
*dev
;
329 typedef struct drm_queue
{
330 atomic_t use_count
; /* Outstanding uses (+1) */
331 atomic_t finalization
; /* Finalization in progress */
332 atomic_t block_count
; /* Count of processes waiting */
333 atomic_t block_read
; /* Queue blocked for reads */
334 wait_queue_head_t read_queue
; /* Processes waiting on block_read */
335 atomic_t block_write
; /* Queue blocked for writes */
336 wait_queue_head_t write_queue
; /* Processes waiting on block_write */
337 atomic_t total_queued
; /* Total queued statistic */
338 atomic_t total_flushed
;/* Total flushes statistic */
339 atomic_t total_locks
; /* Total locks statistics */
340 drm_ctx_flags_t flags
; /* Context preserving and 2D-only */
341 drm_waitlist_t waitlist
; /* Pending buffers */
342 wait_queue_head_t flush_queue
; /* Processes waiting until flush */
345 typedef struct drm_lock_data
{
346 drm_hw_lock_t
*hw_lock
; /* Hardware lock */
347 pid_t pid
; /* PID of lock holder (0=kernel) */
348 wait_queue_head_t lock_queue
; /* Queue of blocked processes */
349 unsigned long lock_time
; /* Time of last lock in jiffies */
352 typedef struct drm_device_dma
{
353 /* Performance Counters */
354 atomic_t total_prio
; /* Total DRM_DMA_PRIORITY */
355 atomic_t total_bytes
; /* Total bytes DMA'd */
356 atomic_t total_dmas
; /* Total DMA buffers dispatched */
358 atomic_t total_missed_dma
; /* Missed drm_do_dma */
359 atomic_t total_missed_lock
; /* Missed lock in drm_do_dma */
360 atomic_t total_missed_free
; /* Missed drm_free_this_buffer */
361 atomic_t total_missed_sched
;/* Missed drm_dma_schedule */
363 atomic_t total_tried
; /* Tried next_buffer */
364 atomic_t total_hit
; /* Sent next_buffer */
365 atomic_t total_lost
; /* Lost interrupt */
367 drm_buf_entry_t bufs
[DRM_MAX_ORDER
+1];
369 drm_buf_t
**buflist
; /* Vector of pointers info bufs */
372 unsigned long *pagelist
;
373 unsigned long byte_count
;
376 drm_buf_t
*this_buffer
; /* Buffer being sent */
377 drm_buf_t
*next_buffer
; /* Selected buffer to send */
378 drm_queue_t
*next_queue
; /* Queue from which buffer selected*/
379 wait_queue_head_t waiting
; /* Processes waiting on free bufs */
382 typedef struct drm_device
{
383 const char *name
; /* Simple driver name */
384 char *unique
; /* Unique identifier: e.g., busid */
385 int unique_len
; /* Length of unique field */
386 dev_t device
; /* Device number for mknod */
387 char *devname
; /* For /proc/interrupts */
389 int blocked
; /* Blocked due to VC switch? */
390 struct proc_dir_entry
*root
; /* Root for this device's entries */
393 spinlock_t count_lock
; /* For inuse, open_count, buf_use */
394 struct semaphore struct_sem
; /* For others */
397 int open_count
; /* Outstanding files open */
398 atomic_t ioctl_count
; /* Outstanding IOCTLs pending */
399 atomic_t vma_count
; /* Outstanding vma areas open */
400 int buf_use
; /* Buffers in use -- cannot alloc */
401 atomic_t buf_alloc
; /* Buffer allocation in progress */
403 /* Performance Counters */
405 atomic_t total_close
;
406 atomic_t total_ioctl
;
407 atomic_t total_irq
; /* Total interruptions */
408 atomic_t total_ctx
; /* Total context switches */
410 atomic_t total_locks
;
411 atomic_t total_unlocks
;
412 atomic_t total_contends
;
413 atomic_t total_sleeps
;
416 drm_file_t
*file_first
;
417 drm_file_t
*file_last
;
418 drm_magic_head_t magiclist
[DRM_HASH_SIZE
];
420 /* Memory management */
421 drm_map_t
**maplist
; /* Vector of pointers to regions */
422 int map_count
; /* Number of mappable regions */
424 drm_vma_entry_t
*vmalist
; /* List of vmas (for debugging) */
425 drm_lock_data_t lock
; /* Information on hardware lock */
427 /* DMA queues (contexts) */
428 int queue_count
; /* Number of active DMA queues */
429 int queue_reserved
; /* Number of reserved DMA queues */
430 int queue_slots
; /* Actual length of queuelist */
431 drm_queue_t
**queuelist
; /* Vector of pointers to DMA queues */
432 drm_device_dma_t
*dma
; /* Optional pointer for DMA support */
434 /* Context support */
435 int irq
; /* Interrupt used by board */
436 __volatile__
long context_flag
; /* Context swapping flag */
437 __volatile__
long interrupt_flag
;/* Interruption handler flag */
438 __volatile__
long dma_flag
; /* DMA dispatch flag */
439 struct timer_list timer
; /* Timer for delaying ctx switch */
440 wait_queue_head_t context_wait
; /* Processes waiting on ctx switch */
441 int last_checked
; /* Last context checked for DMA */
442 int last_context
; /* Last current context */
443 unsigned long last_switch
; /* jiffies at last context switch */
447 #if DRM_DMA_HISTOGRAM
448 drm_histogram_t histo
;
451 /* Callback to X server for context switch
452 and for heavy-handed reset. */
453 char buf
[DRM_BSZ
]; /* Output buffer */
454 char *buf_rp
; /* Read pointer */
455 char *buf_wp
; /* Write pointer */
456 char *buf_end
; /* End pointer */
457 struct fasync_struct
*buf_async
;/* Processes waiting for SIGIO */
458 wait_queue_head_t buf_readers
; /* Processes waiting to read */
459 wait_queue_head_t buf_writers
; /* Processes waiting to ctx switch */
463 /* Internal function definitions */
465 /* Misc. support (init.c) */
466 extern int drm_flags
;
467 extern void drm_parse_options(char *s
);
468 extern int drm_cpu_valid(void);
471 /* Device support (fops.c) */
472 extern int drm_open_helper(struct inode
*inode
, struct file
*filp
,
474 extern int drm_flush(struct file
*filp
);
475 extern int drm_release(struct inode
*inode
, struct file
*filp
);
476 extern int drm_fasync(int fd
, struct file
*filp
, int on
);
477 extern ssize_t
drm_read(struct file
*filp
, char *buf
, size_t count
,
479 extern int drm_write_string(drm_device_t
*dev
, const char *s
);
480 extern unsigned int drm_poll(struct file
*filp
, struct poll_table_struct
*wait
);
482 /* Mapping support (vm.c) */
483 #if LINUX_VERSION_CODE < 0x020317
484 extern unsigned long drm_vm_nopage(struct vm_area_struct
*vma
,
485 unsigned long address
,
487 extern unsigned long drm_vm_shm_nopage(struct vm_area_struct
*vma
,
488 unsigned long address
,
490 extern unsigned long drm_vm_dma_nopage(struct vm_area_struct
*vma
,
491 unsigned long address
,
494 /* Return type changed in 2.3.23 */
495 extern struct page
*drm_vm_nopage(struct vm_area_struct
*vma
,
496 unsigned long address
,
498 extern struct page
*drm_vm_shm_nopage(struct vm_area_struct
*vma
,
499 unsigned long address
,
501 extern struct page
*drm_vm_dma_nopage(struct vm_area_struct
*vma
,
502 unsigned long address
,
505 extern void drm_vm_open(struct vm_area_struct
*vma
);
506 extern void drm_vm_close(struct vm_area_struct
*vma
);
507 extern int drm_mmap_dma(struct file
*filp
,
508 struct vm_area_struct
*vma
);
509 extern int drm_mmap(struct file
*filp
, struct vm_area_struct
*vma
);
512 /* Proc support (proc.c) */
513 extern int drm_proc_init(drm_device_t
*dev
);
514 extern int drm_proc_cleanup(void);
516 /* Memory management support (memory.c) */
517 extern void drm_mem_init(void);
518 extern int drm_mem_info(char *buf
, char **start
, off_t offset
,
519 int len
, int *eof
, void *data
);
520 extern void *drm_alloc(size_t size
, int area
);
521 extern void *drm_realloc(void *oldpt
, size_t oldsize
, size_t size
,
523 extern char *drm_strdup(const char *s
, int area
);
524 extern void drm_strfree(const char *s
, int area
);
525 extern void drm_free(void *pt
, size_t size
, int area
);
526 extern unsigned long drm_alloc_pages(int order
, int area
);
527 extern void drm_free_pages(unsigned long address
, int order
,
529 extern void *drm_ioremap(unsigned long offset
, unsigned long size
);
530 extern void drm_ioremapfree(void *pt
, unsigned long size
);
532 /* Buffer management support (bufs.c) */
533 extern int drm_order(unsigned long size
);
534 extern int drm_addmap(struct inode
*inode
, struct file
*filp
,
535 unsigned int cmd
, unsigned long arg
);
536 extern int drm_addbufs(struct inode
*inode
, struct file
*filp
,
537 unsigned int cmd
, unsigned long arg
);
538 extern int drm_infobufs(struct inode
*inode
, struct file
*filp
,
539 unsigned int cmd
, unsigned long arg
);
540 extern int drm_markbufs(struct inode
*inode
, struct file
*filp
,
541 unsigned int cmd
, unsigned long arg
);
542 extern int drm_freebufs(struct inode
*inode
, struct file
*filp
,
543 unsigned int cmd
, unsigned long arg
);
544 extern int drm_mapbufs(struct inode
*inode
, struct file
*filp
,
545 unsigned int cmd
, unsigned long arg
);
548 /* Buffer list management support (lists.c) */
549 extern int drm_waitlist_create(drm_waitlist_t
*bl
, int count
);
550 extern int drm_waitlist_destroy(drm_waitlist_t
*bl
);
551 extern int drm_waitlist_put(drm_waitlist_t
*bl
, drm_buf_t
*buf
);
552 extern drm_buf_t
*drm_waitlist_get(drm_waitlist_t
*bl
);
554 extern int drm_freelist_create(drm_freelist_t
*bl
, int count
);
555 extern int drm_freelist_destroy(drm_freelist_t
*bl
);
556 extern int drm_freelist_put(drm_device_t
*dev
, drm_freelist_t
*bl
,
558 extern drm_buf_t
*drm_freelist_get(drm_freelist_t
*bl
, int block
);
560 /* DMA support (gen_dma.c) */
561 extern void drm_dma_setup(drm_device_t
*dev
);
562 extern void drm_dma_takedown(drm_device_t
*dev
);
563 extern void drm_free_buffer(drm_device_t
*dev
, drm_buf_t
*buf
);
564 extern void drm_reclaim_buffers(drm_device_t
*dev
, pid_t pid
);
565 extern int drm_context_switch(drm_device_t
*dev
, int old
, int new);
566 extern int drm_context_switch_complete(drm_device_t
*dev
, int new);
567 extern void drm_wakeup(drm_device_t
*dev
, drm_buf_t
*buf
);
568 extern void drm_clear_next_buffer(drm_device_t
*dev
);
569 extern int drm_select_queue(drm_device_t
*dev
,
570 void (*wrapper
)(unsigned long));
571 extern int drm_dma_enqueue(drm_device_t
*dev
, drm_dma_t
*dma
);
572 extern int drm_dma_get_buffers(drm_device_t
*dev
, drm_dma_t
*dma
);
573 #if DRM_DMA_HISTOGRAM
574 extern int drm_histogram_slot(unsigned long count
);
575 extern void drm_histogram_compute(drm_device_t
*dev
, drm_buf_t
*buf
);
579 /* Misc. IOCTL support (ioctl.c) */
580 extern int drm_irq_busid(struct inode
*inode
, struct file
*filp
,
581 unsigned int cmd
, unsigned long arg
);
582 extern int drm_getunique(struct inode
*inode
, struct file
*filp
,
583 unsigned int cmd
, unsigned long arg
);
584 extern int drm_setunique(struct inode
*inode
, struct file
*filp
,
585 unsigned int cmd
, unsigned long arg
);
588 /* Context IOCTL support (context.c) */
589 extern int drm_resctx(struct inode
*inode
, struct file
*filp
,
590 unsigned int cmd
, unsigned long arg
);
591 extern int drm_addctx(struct inode
*inode
, struct file
*filp
,
592 unsigned int cmd
, unsigned long arg
);
593 extern int drm_modctx(struct inode
*inode
, struct file
*filp
,
594 unsigned int cmd
, unsigned long arg
);
595 extern int drm_getctx(struct inode
*inode
, struct file
*filp
,
596 unsigned int cmd
, unsigned long arg
);
597 extern int drm_switchctx(struct inode
*inode
, struct file
*filp
,
598 unsigned int cmd
, unsigned long arg
);
599 extern int drm_newctx(struct inode
*inode
, struct file
*filp
,
600 unsigned int cmd
, unsigned long arg
);
601 extern int drm_rmctx(struct inode
*inode
, struct file
*filp
,
602 unsigned int cmd
, unsigned long arg
);
605 /* Drawable IOCTL support (drawable.c) */
606 extern int drm_adddraw(struct inode
*inode
, struct file
*filp
,
607 unsigned int cmd
, unsigned long arg
);
608 extern int drm_rmdraw(struct inode
*inode
, struct file
*filp
,
609 unsigned int cmd
, unsigned long arg
);
612 /* Authentication IOCTL support (auth.c) */
613 extern int drm_add_magic(drm_device_t
*dev
, drm_file_t
*priv
,
615 extern int drm_remove_magic(drm_device_t
*dev
, drm_magic_t magic
);
616 extern int drm_getmagic(struct inode
*inode
, struct file
*filp
,
617 unsigned int cmd
, unsigned long arg
);
618 extern int drm_authmagic(struct inode
*inode
, struct file
*filp
,
619 unsigned int cmd
, unsigned long arg
);
622 /* Locking IOCTL support (lock.c) */
623 extern int drm_block(struct inode
*inode
, struct file
*filp
,
624 unsigned int cmd
, unsigned long arg
);
625 extern int drm_unblock(struct inode
*inode
, struct file
*filp
,
626 unsigned int cmd
, unsigned long arg
);
627 extern int drm_lock_take(__volatile__
unsigned int *lock
,
628 unsigned int context
);
629 extern int drm_lock_transfer(drm_device_t
*dev
,
630 __volatile__
unsigned int *lock
,
631 unsigned int context
);
632 extern int drm_lock_free(drm_device_t
*dev
,
633 __volatile__
unsigned int *lock
,
634 unsigned int context
);
635 extern int drm_finish(struct inode
*inode
, struct file
*filp
,
636 unsigned int cmd
, unsigned long arg
);
637 extern int drm_flush_unblock(drm_device_t
*dev
, int context
,
638 drm_lock_flags_t flags
);
639 extern int drm_flush_block_and_flush(drm_device_t
*dev
, int context
,
640 drm_lock_flags_t flags
);