aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drmP.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-09-25 00:28:13 -0400
committerDave Airlie <airlied@linux.ie>2005-09-25 00:28:13 -0400
commitb5e89ed53ed8d24f83ba1941c07382af00ed238e (patch)
tree747bae7a565f88a2e1d5974776eeb054a932c505 /drivers/char/drm/drmP.h
parent99a2657a29e2d623c3568cd86b27cac13fb63140 (diff)
drm: lindent the drm directory.
I've been threatening this for a while, so no point hanging around. This lindents the DRM code which was always really bad in tabbing department. I've also fixed some misnamed files in comments and removed some trailing whitespace. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drmP.h')
-rw-r--r--drivers/char/drm/drmP.h863
1 files changed, 431 insertions, 432 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 79221783a14c..255a21783d10 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -1,7 +1,7 @@
1/** 1/**
2 * \file drmP.h 2 * \file drmP.h
3 * Private header for Direct Rendering Manager 3 * Private header for Direct Rendering Manager
4 * 4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com> 5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com> 6 * \author Gareth Hughes <gareth@valinux.com>
7 */ 7 */
@@ -43,7 +43,7 @@
43 * before static inline funcs in wait.h. Doing this so we 43 * before static inline funcs in wait.h. Doing this so we
44 * can build the DRM (part of PI DRI). 4/21/2000 S + B */ 44 * can build the DRM (part of PI DRI). 4/21/2000 S + B */
45#include <asm/current.h> 45#include <asm/current.h>
46#endif /* __alpha__ */ 46#endif /* __alpha__ */
47#include <linux/config.h> 47#include <linux/config.h>
48#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/kernel.h> 49#include <linux/kernel.h>
@@ -58,7 +58,7 @@
58#include <linux/mm.h> 58#include <linux/mm.h>
59#include <linux/cdev.h> 59#include <linux/cdev.h>
60#if defined(__alpha__) || defined(__powerpc__) 60#if defined(__alpha__) || defined(__powerpc__)
61#include <asm/pgtable.h> /* For pte_wrprotect */ 61#include <asm/pgtable.h> /* For pte_wrprotect */
62#endif 62#endif
63#include <asm/io.h> 63#include <asm/io.h>
64#include <asm/mman.h> 64#include <asm/mman.h>
@@ -138,16 +138,15 @@
138#define DRM_MEM_CTXLIST 21 138#define DRM_MEM_CTXLIST 21
139 139
140#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) 140#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
141
142/*@}*/
143 141
142/*@}*/
144 143
145/***********************************************************************/ 144/***********************************************************************/
146/** \name Backward compatibility section */ 145/** \name Backward compatibility section */
147/*@{*/ 146/*@{*/
148 147
149#ifndef MODULE_LICENSE 148#ifndef MODULE_LICENSE
150#define MODULE_LICENSE(x) 149#define MODULE_LICENSE(x)
151#endif 150#endif
152 151
153#ifndef preempt_disable 152#ifndef preempt_disable
@@ -155,7 +154,7 @@
155#define preempt_enable() 154#define preempt_enable()
156#endif 155#endif
157 156
158#ifndef pte_offset_map 157#ifndef pte_offset_map
159#define pte_offset_map pte_offset 158#define pte_offset_map pte_offset
160#define pte_unmap(pte) 159#define pte_unmap(pte)
161#endif 160#endif
@@ -166,7 +165,6 @@
166 165
167/*@}*/ 166/*@}*/
168 167
169
170/***********************************************************************/ 168/***********************************************************************/
171/** \name Macros to make printk easier */ 169/** \name Macros to make printk easier */
172/*@{*/ 170/*@{*/
@@ -195,7 +193,7 @@
195 193
196/** 194/**
197 * Debug output. 195 * Debug output.
198 * 196 *
199 * \param fmt printf() like format string. 197 * \param fmt printf() like format string.
200 * \param arg arguments 198 * \param arg arguments
201 */ 199 */
@@ -223,7 +221,6 @@
223 221
224/*@}*/ 222/*@}*/
225 223
226
227/***********************************************************************/ 224/***********************************************************************/
228/** \name Internal types and structures */ 225/** \name Internal types and structures */
229/*@{*/ 226/*@{*/
@@ -275,7 +272,7 @@ do { \
275 if ( copy_to_user( name, value, len ) ) \ 272 if ( copy_to_user( name, value, len ) ) \
276 return -EFAULT; \ 273 return -EFAULT; \
277 } 274 }
278 275
279/** 276/**
280 * Ioctl function type. 277 * Ioctl function type.
281 * 278 *
@@ -284,25 +281,25 @@ do { \
284 * \param cmd command. 281 * \param cmd command.
285 * \param arg argument. 282 * \param arg argument.
286 */ 283 */
287typedef int drm_ioctl_t( struct inode *inode, struct file *filp, 284typedef int drm_ioctl_t(struct inode *inode, struct file *filp,
288 unsigned int cmd, unsigned long arg ); 285 unsigned int cmd, unsigned long arg);
289 286
290typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, 287typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
291 unsigned long arg); 288 unsigned long arg);
292 289
293typedef struct drm_ioctl_desc { 290typedef struct drm_ioctl_desc {
294 drm_ioctl_t *func; 291 drm_ioctl_t *func;
295 int auth_needed; 292 int auth_needed;
296 int root_only; 293 int root_only;
297} drm_ioctl_desc_t; 294} drm_ioctl_desc_t;
298 295
299typedef struct drm_devstate { 296typedef struct drm_devstate {
300 pid_t owner; /**< X server pid holding x_lock */ 297 pid_t owner; /**< X server pid holding x_lock */
301} drm_devstate_t; 298} drm_devstate_t;
302 299
303typedef struct drm_magic_entry { 300typedef struct drm_magic_entry {
304 drm_magic_t magic; 301 drm_magic_t magic;
305 struct drm_file *priv; 302 struct drm_file *priv;
306 struct drm_magic_entry *next; 303 struct drm_magic_entry *next;
307} drm_magic_entry_t; 304} drm_magic_entry_t;
308 305
@@ -313,111 +310,110 @@ typedef struct drm_magic_head {
313 310
314typedef struct drm_vma_entry { 311typedef struct drm_vma_entry {
315 struct vm_area_struct *vma; 312 struct vm_area_struct *vma;
316 struct drm_vma_entry *next; 313 struct drm_vma_entry *next;
317 pid_t pid; 314 pid_t pid;
318} drm_vma_entry_t; 315} drm_vma_entry_t;
319 316
320/** 317/**
321 * DMA buffer. 318 * DMA buffer.
322 */ 319 */
323typedef struct drm_buf { 320typedef struct drm_buf {
324 int idx; /**< Index into master buflist */ 321 int idx; /**< Index into master buflist */
325 int total; /**< Buffer size */ 322 int total; /**< Buffer size */
326 int order; /**< log-base-2(total) */ 323 int order; /**< log-base-2(total) */
327 int used; /**< Amount of buffer in use (for DMA) */ 324 int used; /**< Amount of buffer in use (for DMA) */
328 unsigned long offset; /**< Byte offset (used internally) */ 325 unsigned long offset; /**< Byte offset (used internally) */
329 void *address; /**< Address of buffer */ 326 void *address; /**< Address of buffer */
330 unsigned long bus_address; /**< Bus address of buffer */ 327 unsigned long bus_address; /**< Bus address of buffer */
331 struct drm_buf *next; /**< Kernel-only: used for free list */ 328 struct drm_buf *next; /**< Kernel-only: used for free list */
332 __volatile__ int waiting; /**< On kernel DMA queue */ 329 __volatile__ int waiting; /**< On kernel DMA queue */
333 __volatile__ int pending; /**< On hardware DMA queue */ 330 __volatile__ int pending; /**< On hardware DMA queue */
334 wait_queue_head_t dma_wait; /**< Processes waiting */ 331 wait_queue_head_t dma_wait; /**< Processes waiting */
335 struct file *filp; /**< Pointer to holding file descr */ 332 struct file *filp; /**< Pointer to holding file descr */
336 int context; /**< Kernel queue for this buffer */ 333 int context; /**< Kernel queue for this buffer */
337 int while_locked;/**< Dispatch this buffer while locked */ 334 int while_locked; /**< Dispatch this buffer while locked */
338 enum { 335 enum {
339 DRM_LIST_NONE = 0, 336 DRM_LIST_NONE = 0,
340 DRM_LIST_FREE = 1, 337 DRM_LIST_FREE = 1,
341 DRM_LIST_WAIT = 2, 338 DRM_LIST_WAIT = 2,
342 DRM_LIST_PEND = 3, 339 DRM_LIST_PEND = 3,
343 DRM_LIST_PRIO = 4, 340 DRM_LIST_PRIO = 4,
344 DRM_LIST_RECLAIM = 5 341 DRM_LIST_RECLAIM = 5
345 } list; /**< Which list we're on */ 342 } list; /**< Which list we're on */
346 343
347 int dev_priv_size; /**< Size of buffer private storage */ 344 int dev_priv_size; /**< Size of buffer private storage */
348 void *dev_private; /**< Per-buffer private storage */ 345 void *dev_private; /**< Per-buffer private storage */
349} drm_buf_t; 346} drm_buf_t;
350 347
351
352/** bufs is one longer than it has to be */ 348/** bufs is one longer than it has to be */
353typedef struct drm_waitlist { 349typedef struct drm_waitlist {
354 int count; /**< Number of possible buffers */ 350 int count; /**< Number of possible buffers */
355 drm_buf_t **bufs; /**< List of pointers to buffers */ 351 drm_buf_t **bufs; /**< List of pointers to buffers */
356 drm_buf_t **rp; /**< Read pointer */ 352 drm_buf_t **rp; /**< Read pointer */
357 drm_buf_t **wp; /**< Write pointer */ 353 drm_buf_t **wp; /**< Write pointer */
358 drm_buf_t **end; /**< End pointer */ 354 drm_buf_t **end; /**< End pointer */
359 spinlock_t read_lock; 355 spinlock_t read_lock;
360 spinlock_t write_lock; 356 spinlock_t write_lock;
361} drm_waitlist_t; 357} drm_waitlist_t;
362 358
363typedef struct drm_freelist { 359typedef struct drm_freelist {
364 int initialized; /**< Freelist in use */ 360 int initialized; /**< Freelist in use */
365 atomic_t count; /**< Number of free buffers */ 361 atomic_t count; /**< Number of free buffers */
366 drm_buf_t *next; /**< End pointer */ 362 drm_buf_t *next; /**< End pointer */
367 363
368 wait_queue_head_t waiting; /**< Processes waiting on free bufs */ 364 wait_queue_head_t waiting; /**< Processes waiting on free bufs */
369 int low_mark; /**< Low water mark */ 365 int low_mark; /**< Low water mark */
370 int high_mark; /**< High water mark */ 366 int high_mark; /**< High water mark */
371 atomic_t wfh; /**< If waiting for high mark */ 367 atomic_t wfh; /**< If waiting for high mark */
372 spinlock_t lock; 368 spinlock_t lock;
373} drm_freelist_t; 369} drm_freelist_t;
374 370
375/** 371/**
376 * Buffer entry. There is one of this for each buffer size order. 372 * Buffer entry. There is one of this for each buffer size order.
377 */ 373 */
378typedef struct drm_buf_entry { 374typedef struct drm_buf_entry {
379 int buf_size; /**< size */ 375 int buf_size; /**< size */
380 int buf_count; /**< number of buffers */ 376 int buf_count; /**< number of buffers */
381 drm_buf_t *buflist; /**< buffer list */ 377 drm_buf_t *buflist; /**< buffer list */
382 int seg_count; 378 int seg_count;
383 int page_order; 379 int page_order;
384 unsigned long *seglist; 380 unsigned long *seglist;
385 381
386 drm_freelist_t freelist; 382 drm_freelist_t freelist;
387} drm_buf_entry_t; 383} drm_buf_entry_t;
388 384
389/** File private data */ 385/** File private data */
390typedef struct drm_file { 386typedef struct drm_file {
391 int authenticated; 387 int authenticated;
392 int minor; 388 int minor;
393 pid_t pid; 389 pid_t pid;
394 uid_t uid; 390 uid_t uid;
395 drm_magic_t magic; 391 drm_magic_t magic;
396 unsigned long ioctl_count; 392 unsigned long ioctl_count;
397 struct drm_file *next; 393 struct drm_file *next;
398 struct drm_file *prev; 394 struct drm_file *prev;
399 struct drm_head *head; 395 struct drm_head *head;
400 int remove_auth_on_close; 396 int remove_auth_on_close;
401 unsigned long lock_count; 397 unsigned long lock_count;
402 void *driver_priv; 398 void *driver_priv;
403} drm_file_t; 399} drm_file_t;
404 400
405/** Wait queue */ 401/** Wait queue */
406typedef struct drm_queue { 402typedef struct drm_queue {
407 atomic_t use_count; /**< Outstanding uses (+1) */ 403 atomic_t use_count; /**< Outstanding uses (+1) */
408 atomic_t finalization; /**< Finalization in progress */ 404 atomic_t finalization; /**< Finalization in progress */
409 atomic_t block_count; /**< Count of processes waiting */ 405 atomic_t block_count; /**< Count of processes waiting */
410 atomic_t block_read; /**< Queue blocked for reads */ 406 atomic_t block_read; /**< Queue blocked for reads */
411 wait_queue_head_t read_queue; /**< Processes waiting on block_read */ 407 wait_queue_head_t read_queue; /**< Processes waiting on block_read */
412 atomic_t block_write; /**< Queue blocked for writes */ 408 atomic_t block_write; /**< Queue blocked for writes */
413 wait_queue_head_t write_queue; /**< Processes waiting on block_write */ 409 wait_queue_head_t write_queue; /**< Processes waiting on block_write */
414#if 1 410#if 1
415 atomic_t total_queued; /**< Total queued statistic */ 411 atomic_t total_queued; /**< Total queued statistic */
416 atomic_t total_flushed;/**< Total flushes statistic */ 412 atomic_t total_flushed; /**< Total flushes statistic */
417 atomic_t total_locks; /**< Total locks statistics */ 413 atomic_t total_locks; /**< Total locks statistics */
418#endif 414#endif
419 drm_ctx_flags_t flags; /**< Context preserving and 2D-only */ 415 drm_ctx_flags_t flags; /**< Context preserving and 2D-only */
420 drm_waitlist_t waitlist; /**< Pending buffers */ 416 drm_waitlist_t waitlist; /**< Pending buffers */
421 wait_queue_head_t flush_queue; /**< Processes waiting until flush */ 417 wait_queue_head_t flush_queue; /**< Processes waiting until flush */
422} drm_queue_t; 418} drm_queue_t;
423 419
@@ -425,10 +421,10 @@ typedef struct drm_queue {
425 * Lock data. 421 * Lock data.
426 */ 422 */
427typedef struct drm_lock_data { 423typedef struct drm_lock_data {
428 drm_hw_lock_t *hw_lock; /**< Hardware lock */ 424 drm_hw_lock_t *hw_lock; /**< Hardware lock */
429 struct file *filp; /**< File descr of lock holder (0=kernel) */ 425 struct file *filp; /**< File descr of lock holder (0=kernel) */
430 wait_queue_head_t lock_queue; /**< Queue of blocked processes */ 426 wait_queue_head_t lock_queue; /**< Queue of blocked processes */
431 unsigned long lock_time; /**< Time of last lock in jiffies */ 427 unsigned long lock_time; /**< Time of last lock in jiffies */
432} drm_lock_data_t; 428} drm_lock_data_t;
433 429
434/** 430/**
@@ -436,29 +432,29 @@ typedef struct drm_lock_data {
436 */ 432 */
437typedef struct drm_device_dma { 433typedef struct drm_device_dma {
438 434
439 drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; /**< buffers, grouped by their size order */ 435 drm_buf_entry_t bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */
440 int buf_count; /**< total number of buffers */ 436 int buf_count; /**< total number of buffers */
441 drm_buf_t **buflist; /**< Vector of pointers into drm_device_dma::bufs */ 437 drm_buf_t **buflist; /**< Vector of pointers into drm_device_dma::bufs */
442 int seg_count; 438 int seg_count;
443 int page_count; /**< number of pages */ 439 int page_count; /**< number of pages */
444 unsigned long *pagelist; /**< page list */ 440 unsigned long *pagelist; /**< page list */
445 unsigned long byte_count; 441 unsigned long byte_count;
446 enum { 442 enum {
447 _DRM_DMA_USE_AGP = 0x01, 443 _DRM_DMA_USE_AGP = 0x01,
448 _DRM_DMA_USE_SG = 0x02, 444 _DRM_DMA_USE_SG = 0x02,
449 _DRM_DMA_USE_FB = 0x04 445 _DRM_DMA_USE_FB = 0x04
450 } flags; 446 } flags;
451 447
452} drm_device_dma_t; 448} drm_device_dma_t;
453 449
454/** 450/**
455 * AGP memory entry. Stored as a doubly linked list. 451 * AGP memory entry. Stored as a doubly linked list.
456 */ 452 */
457typedef struct drm_agp_mem { 453typedef struct drm_agp_mem {
458 unsigned long handle; /**< handle */ 454 unsigned long handle; /**< handle */
459 DRM_AGP_MEM *memory; 455 DRM_AGP_MEM *memory;
460 unsigned long bound; /**< address */ 456 unsigned long bound; /**< address */
461 int pages; 457 int pages;
462 struct drm_agp_mem *prev; /**< previous entry */ 458 struct drm_agp_mem *prev; /**< previous entry */
463 struct drm_agp_mem *next; /**< next entry */ 459 struct drm_agp_mem *next; /**< next entry */
464} drm_agp_mem_t; 460} drm_agp_mem_t;
@@ -469,31 +465,31 @@ typedef struct drm_agp_mem {
469 * \sa drm_agp_init() and drm_device::agp. 465 * \sa drm_agp_init() and drm_device::agp.
470 */ 466 */
471typedef struct drm_agp_head { 467typedef struct drm_agp_head {
472 DRM_AGP_KERN agp_info; /**< AGP device information */ 468 DRM_AGP_KERN agp_info; /**< AGP device information */
473 drm_agp_mem_t *memory; /**< memory entries */ 469 drm_agp_mem_t *memory; /**< memory entries */
474 unsigned long mode; /**< AGP mode */ 470 unsigned long mode; /**< AGP mode */
475 struct agp_bridge_data *bridge; 471 struct agp_bridge_data *bridge;
476 int enabled; /**< whether the AGP bus as been enabled */ 472 int enabled; /**< whether the AGP bus as been enabled */
477 int acquired; /**< whether the AGP device has been acquired */ 473 int acquired; /**< whether the AGP device has been acquired */
478 unsigned long base; 474 unsigned long base;
479 int agp_mtrr; 475 int agp_mtrr;
480 int cant_use_aperture; 476 int cant_use_aperture;
481 unsigned long page_mask; 477 unsigned long page_mask;
482} drm_agp_head_t; 478} drm_agp_head_t;
483 479
484/** 480/**
485 * Scatter-gather memory. 481 * Scatter-gather memory.
486 */ 482 */
487typedef struct drm_sg_mem { 483typedef struct drm_sg_mem {
488 unsigned long handle; 484 unsigned long handle;
489 void *virtual; 485 void *virtual;
490 int pages; 486 int pages;
491 struct page **pagelist; 487 struct page **pagelist;
492 dma_addr_t *busaddr; 488 dma_addr_t *busaddr;
493} drm_sg_mem_t; 489} drm_sg_mem_t;
494 490
495typedef struct drm_sigdata { 491typedef struct drm_sigdata {
496 int context; 492 int context;
497 drm_hw_lock_t *lock; 493 drm_hw_lock_t *lock;
498} drm_sigdata_t; 494} drm_sigdata_t;
499 495
@@ -507,8 +503,8 @@ typedef struct drm_dma_handle {
507 * Mappings list 503 * Mappings list
508 */ 504 */
509typedef struct drm_map_list { 505typedef struct drm_map_list {
510 struct list_head head; /**< list head */ 506 struct list_head head; /**< list head */
511 drm_map_t *map; /**< mapping */ 507 drm_map_t *map; /**< mapping */
512 unsigned int user_token; 508 unsigned int user_token;
513} drm_map_list_t; 509} drm_map_list_t;
514 510
@@ -518,20 +514,18 @@ typedef drm_map_t drm_local_map_t;
518 * Context handle list 514 * Context handle list
519 */ 515 */
520typedef struct drm_ctx_list { 516typedef struct drm_ctx_list {
521 struct list_head head; /**< list head */ 517 struct list_head head; /**< list head */
522 drm_context_t handle; /**< context handle */ 518 drm_context_t handle; /**< context handle */
523 drm_file_t *tag; /**< associated fd private data */ 519 drm_file_t *tag; /**< associated fd private data */
524} drm_ctx_list_t; 520} drm_ctx_list_t;
525 521
526
527typedef struct drm_vbl_sig { 522typedef struct drm_vbl_sig {
528 struct list_head head; 523 struct list_head head;
529 unsigned int sequence; 524 unsigned int sequence;
530 struct siginfo info; 525 struct siginfo info;
531 struct task_struct *task; 526 struct task_struct *task;
532} drm_vbl_sig_t; 527} drm_vbl_sig_t;
533 528
534
535/* location of GART table */ 529/* location of GART table */
536#define DRM_ATI_GART_MAIN 1 530#define DRM_ATI_GART_MAIN 1
537#define DRM_ATI_GART_FB 2 531#define DRM_ATI_GART_FB 2
@@ -551,24 +545,26 @@ typedef struct ati_pcigart_info {
551struct drm_device; 545struct drm_device;
552 546
553struct drm_driver { 547struct drm_driver {
554 int (*preinit)(struct drm_device *, unsigned long flags); 548 int (*preinit) (struct drm_device *, unsigned long flags);
555 void (*prerelease)(struct drm_device *, struct file *filp); 549 void (*prerelease) (struct drm_device *, struct file * filp);
556 void (*pretakedown)(struct drm_device *); 550 void (*pretakedown) (struct drm_device *);
557 int (*postcleanup)(struct drm_device *); 551 int (*postcleanup) (struct drm_device *);
558 int (*presetup)(struct drm_device *); 552 int (*presetup) (struct drm_device *);
559 int (*postsetup)(struct drm_device *); 553 int (*postsetup) (struct drm_device *);
560 int (*dma_ioctl)( DRM_IOCTL_ARGS ); 554 int (*dma_ioctl) (DRM_IOCTL_ARGS);
561 int (*open_helper)(struct drm_device *, drm_file_t *); 555 int (*open_helper) (struct drm_device *, drm_file_t *);
562 void (*free_filp_priv)(struct drm_device *, drm_file_t *); 556 void (*free_filp_priv) (struct drm_device *, drm_file_t *);
563 void (*release)(struct drm_device *, struct file *filp); 557 void (*release) (struct drm_device *, struct file * filp);
564 void (*dma_ready)(struct drm_device *); 558 void (*dma_ready) (struct drm_device *);
565 int (*dma_quiescent)(struct drm_device *); 559 int (*dma_quiescent) (struct drm_device *);
566 int (*context_ctor)(struct drm_device *dev, int context); 560 int (*context_ctor) (struct drm_device * dev, int context);
567 int (*context_dtor)(struct drm_device *dev, int context); 561 int (*context_dtor) (struct drm_device * dev, int context);
568 int (*kernel_context_switch)(struct drm_device *dev, int old, int new); 562 int (*kernel_context_switch) (struct drm_device * dev, int old,
569 void (*kernel_context_switch_unlock)(struct drm_device *dev, drm_lock_t *lock); 563 int new);
570 int (*vblank_wait)(struct drm_device *dev, unsigned int *sequence); 564 void (*kernel_context_switch_unlock) (struct drm_device * dev,
571 565 drm_lock_t * lock);
566 int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence);
567
572 /** 568 /**
573 * Called by \c drm_device_is_agp. Typically used to determine if a 569 * Called by \c drm_device_is_agp. Typically used to determine if a
574 * card is really attached to AGP or not. 570 * card is really attached to AGP or not.
@@ -583,17 +579,17 @@ struct drm_driver {
583 int (*device_is_agp) (struct drm_device * dev); 579 int (*device_is_agp) (struct drm_device * dev);
584 580
585 /* these have to be filled in */ 581 /* these have to be filled in */
586 582
587 int (*postinit)(struct drm_device *, unsigned long flags); 583 int (*postinit) (struct drm_device *, unsigned long flags);
588 irqreturn_t (*irq_handler)( DRM_IRQ_ARGS ); 584 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
589 void (*irq_preinstall)(struct drm_device *dev); 585 void (*irq_preinstall) (struct drm_device * dev);
590 void (*irq_postinstall)(struct drm_device *dev); 586 void (*irq_postinstall) (struct drm_device * dev);
591 void (*irq_uninstall)(struct drm_device *dev); 587 void (*irq_uninstall) (struct drm_device * dev);
592 void (*reclaim_buffers)(struct drm_device *dev, struct file *filp); 588 void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
593 unsigned long (*get_map_ofs)(drm_map_t *map); 589 unsigned long (*get_map_ofs) (drm_map_t * map);
594 unsigned long (*get_reg_ofs)(struct drm_device *dev); 590 unsigned long (*get_reg_ofs) (struct drm_device * dev);
595 void (*set_version)(struct drm_device *dev, drm_set_version_t *sv); 591 void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
596 int (*version)(drm_version_t *version); 592 int (*version) (drm_version_t * version);
597 u32 driver_features; 593 u32 driver_features;
598 int dev_priv_size; 594 int dev_priv_size;
599 drm_ioctl_desc_t *ioctls; 595 drm_ioctl_desc_t *ioctls;
@@ -620,128 +616,129 @@ typedef struct drm_head {
620 * may contain multiple heads. 616 * may contain multiple heads.
621 */ 617 */
622typedef struct drm_device { 618typedef struct drm_device {
623 char *unique; /**< Unique identifier: e.g., busid */ 619 char *unique; /**< Unique identifier: e.g., busid */
624 int unique_len; /**< Length of unique field */ 620 int unique_len; /**< Length of unique field */
625 char *devname; /**< For /proc/interrupts */ 621 char *devname; /**< For /proc/interrupts */
626 int if_version; /**< Highest interface version set */ 622 int if_version; /**< Highest interface version set */
627 623
628 int blocked; /**< Blocked due to VC switch? */ 624 int blocked; /**< Blocked due to VC switch? */
629 625
630 /** \name Locks */ 626 /** \name Locks */
631 /*@{*/ 627 /*@{ */
632 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ 628 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
633 struct semaphore struct_sem; /**< For others */ 629 struct semaphore struct_sem; /**< For others */
634 /*@}*/ 630 /*@} */
635 631
636 /** \name Usage Counters */ 632 /** \name Usage Counters */
637 /*@{*/ 633 /*@{ */
638 int open_count; /**< Outstanding files open */ 634 int open_count; /**< Outstanding files open */
639 atomic_t ioctl_count; /**< Outstanding IOCTLs pending */ 635 atomic_t ioctl_count; /**< Outstanding IOCTLs pending */
640 atomic_t vma_count; /**< Outstanding vma areas open */ 636 atomic_t vma_count; /**< Outstanding vma areas open */
641 int buf_use; /**< Buffers in use -- cannot alloc */ 637 int buf_use; /**< Buffers in use -- cannot alloc */
642 atomic_t buf_alloc; /**< Buffer allocation in progress */ 638 atomic_t buf_alloc; /**< Buffer allocation in progress */
643 /*@}*/ 639 /*@} */
644 640
645 /** \name Performance counters */ 641 /** \name Performance counters */
646 /*@{*/ 642 /*@{ */
647 unsigned long counters; 643 unsigned long counters;
648 drm_stat_type_t types[15]; 644 drm_stat_type_t types[15];
649 atomic_t counts[15]; 645 atomic_t counts[15];
650 /*@}*/ 646 /*@} */
651 647
652 /** \name Authentication */ 648 /** \name Authentication */
653 /*@{*/ 649 /*@{ */
654 drm_file_t *file_first; /**< file list head */ 650 drm_file_t *file_first; /**< file list head */
655 drm_file_t *file_last; /**< file list tail */ 651 drm_file_t *file_last; /**< file list tail */
656 drm_magic_head_t magiclist[DRM_HASH_SIZE]; /**< magic hash table */ 652 drm_magic_head_t magiclist[DRM_HASH_SIZE]; /**< magic hash table */
657 /*@}*/ 653 /*@} */
658 654
659 /** \name Memory management */ 655 /** \name Memory management */
660 /*@{*/ 656 /*@{ */
661 drm_map_list_t *maplist; /**< Linked list of regions */ 657 drm_map_list_t *maplist; /**< Linked list of regions */
662 int map_count; /**< Number of mappable regions */ 658 int map_count; /**< Number of mappable regions */
663 659
664 /** \name Context handle management */ 660 /** \name Context handle management */
665 /*@{*/ 661 /*@{ */
666 drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ 662 drm_ctx_list_t *ctxlist; /**< Linked list of context handles */
667 int ctx_count; /**< Number of context handles */ 663 int ctx_count; /**< Number of context handles */
668 struct semaphore ctxlist_sem; /**< For ctxlist */ 664 struct semaphore ctxlist_sem; /**< For ctxlist */
669 665
670 drm_map_t **context_sareas; /**< per-context SAREA's */ 666 drm_map_t **context_sareas; /**< per-context SAREA's */
671 int max_context; 667 int max_context;
672 668
673 drm_vma_entry_t *vmalist; /**< List of vmas (for debugging) */ 669 drm_vma_entry_t *vmalist; /**< List of vmas (for debugging) */
674 drm_lock_data_t lock; /**< Information on hardware lock */ 670 drm_lock_data_t lock; /**< Information on hardware lock */
675 /*@}*/ 671 /*@} */
676 672
677 /** \name DMA queues (contexts) */ 673 /** \name DMA queues (contexts) */
678 /*@{*/ 674 /*@{ */
679 int queue_count; /**< Number of active DMA queues */ 675 int queue_count; /**< Number of active DMA queues */
680 int queue_reserved; /**< Number of reserved DMA queues */ 676 int queue_reserved; /**< Number of reserved DMA queues */
681 int queue_slots; /**< Actual length of queuelist */ 677 int queue_slots; /**< Actual length of queuelist */
682 drm_queue_t **queuelist; /**< Vector of pointers to DMA queues */ 678 drm_queue_t **queuelist; /**< Vector of pointers to DMA queues */
683 drm_device_dma_t *dma; /**< Optional pointer for DMA support */ 679 drm_device_dma_t *dma; /**< Optional pointer for DMA support */
684 /*@}*/ 680 /*@} */
685 681
686 /** \name Context support */ 682 /** \name Context support */
687 /*@{*/ 683 /*@{ */
688 int irq; /**< Interrupt used by board */ 684 int irq; /**< Interrupt used by board */
689 int irq_enabled; /**< True if irq handler is enabled */ 685 int irq_enabled; /**< True if irq handler is enabled */
690 __volatile__ long context_flag; /**< Context swapping flag */ 686 __volatile__ long context_flag; /**< Context swapping flag */
691 __volatile__ long interrupt_flag; /**< Interruption handler flag */ 687 __volatile__ long interrupt_flag; /**< Interruption handler flag */
692 __volatile__ long dma_flag; /**< DMA dispatch flag */ 688 __volatile__ long dma_flag; /**< DMA dispatch flag */
693 struct timer_list timer; /**< Timer for delaying ctx switch */ 689 struct timer_list timer; /**< Timer for delaying ctx switch */
694 wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ 690 wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */
695 int last_checked; /**< Last context checked for DMA */ 691 int last_checked; /**< Last context checked for DMA */
696 int last_context; /**< Last current context */ 692 int last_context; /**< Last current context */
697 unsigned long last_switch; /**< jiffies at last context switch */ 693 unsigned long last_switch; /**< jiffies at last context switch */
698 /*@}*/ 694 /*@} */
699 695
700 struct work_struct work; 696 struct work_struct work;
701 /** \name VBLANK IRQ support */ 697 /** \name VBLANK IRQ support */
702 /*@{*/ 698 /*@{ */
703 699
704 wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ 700 wait_queue_head_t vbl_queue; /**< VBLANK wait queue */
705 atomic_t vbl_received; 701 atomic_t vbl_received;
706 spinlock_t vbl_lock; 702 spinlock_t vbl_lock;
707 drm_vbl_sig_t vbl_sigs; /**< signal list to send on VBLANK */ 703 drm_vbl_sig_t vbl_sigs; /**< signal list to send on VBLANK */
708 unsigned int vbl_pending; 704 unsigned int vbl_pending;
709 705
710 /*@}*/ 706 /*@} */
711 cycles_t ctx_start; 707 cycles_t ctx_start;
712 cycles_t lck_start; 708 cycles_t lck_start;
713 709
714 char buf[DRM_BSZ]; /**< Output buffer */ 710 char buf[DRM_BSZ]; /**< Output buffer */
715 char *buf_rp; /**< Read pointer */ 711 char *buf_rp; /**< Read pointer */
716 char *buf_wp; /**< Write pointer */ 712 char *buf_wp; /**< Write pointer */
717 char *buf_end; /**< End pointer */ 713 char *buf_end; /**< End pointer */
718 struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ 714 struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */
719 wait_queue_head_t buf_readers; /**< Processes waiting to read */ 715 wait_queue_head_t buf_readers; /**< Processes waiting to read */
720 wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ 716 wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */
721 717
722 drm_agp_head_t *agp; /**< AGP data */ 718 drm_agp_head_t *agp; /**< AGP data */
723 719
724 struct pci_dev *pdev; /**< PCI device structure */ 720 struct pci_dev *pdev; /**< PCI device structure */
725 int pci_domain; /**< PCI bus domain number */ 721 int pci_domain; /**< PCI bus domain number */
726 int pci_bus; /**< PCI bus number */ 722 int pci_bus; /**< PCI bus number */
727 int pci_slot; /**< PCI slot number */ 723 int pci_slot; /**< PCI slot number */
728 int pci_func; /**< PCI function number */ 724 int pci_func; /**< PCI function number */
729#ifdef __alpha__ 725#ifdef __alpha__
730 struct pci_controller *hose; 726 struct pci_controller *hose;
731#endif 727#endif
732 drm_sg_mem_t *sg; /**< Scatter gather memory */ 728 drm_sg_mem_t *sg; /**< Scatter gather memory */
733 unsigned long *ctx_bitmap; /**< context bitmap */ 729 unsigned long *ctx_bitmap; /**< context bitmap */
734 void *dev_private; /**< device private data */ 730 void *dev_private; /**< device private data */
735 drm_sigdata_t sigdata; /**< For block_all_signals */ 731 drm_sigdata_t sigdata; /**< For block_all_signals */
736 sigset_t sigmask; 732 sigset_t sigmask;
737 733
738 struct drm_driver *driver; 734 struct drm_driver *driver;
739 drm_local_map_t *agp_buffer_map; 735 drm_local_map_t *agp_buffer_map;
740 unsigned int agp_buffer_token; 736 unsigned int agp_buffer_token;
741 drm_head_t primary; /**< primary screen head */ 737 drm_head_t primary; /**< primary screen head */
742} drm_device_t; 738} drm_device_t;
743 739
744static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) 740static __inline__ int drm_core_check_feature(struct drm_device *dev,
741 int feature)
745{ 742{
746 return ((dev->driver->driver_features & feature) ? 1 : 0); 743 return ((dev->driver->driver_features & feature) ? 1 : 0);
747} 744}
@@ -749,7 +746,7 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature
749#if __OS_HAS_AGP 746#if __OS_HAS_AGP
750static inline int drm_core_has_AGP(struct drm_device *dev) 747static inline int drm_core_has_AGP(struct drm_device *dev)
751{ 748{
752 return drm_core_check_feature(dev, DRIVER_USE_AGP); 749 return drm_core_check_feature(dev, DRIVER_USE_AGP);
753} 750}
754#else 751#else
755#define drm_core_has_AGP(dev) (0) 752#define drm_core_has_AGP(dev) (0)
@@ -758,7 +755,7 @@ static inline int drm_core_has_AGP(struct drm_device *dev)
758#if __OS_HAS_MTRR 755#if __OS_HAS_MTRR
759static inline int drm_core_has_MTRR(struct drm_device *dev) 756static inline int drm_core_has_MTRR(struct drm_device *dev)
760{ 757{
761 return drm_core_check_feature(dev, DRIVER_USE_MTRR); 758 return drm_core_check_feature(dev, DRIVER_USE_MTRR);
762} 759}
763#else 760#else
764#define drm_core_has_MTRR(dev) (0) 761#define drm_core_has_MTRR(dev) (0)
@@ -769,230 +766,229 @@ static inline int drm_core_has_MTRR(struct drm_device *dev)
769/*@{*/ 766/*@{*/
770 767
771 /* Misc. support (drm_init.h) */ 768 /* Misc. support (drm_init.h) */
772extern int drm_flags; 769extern int drm_flags;
773extern void drm_parse_options( char *s ); 770extern void drm_parse_options(char *s);
774extern int drm_cpu_valid( void ); 771extern int drm_cpu_valid(void);
775 772
776 /* Driver support (drm_drv.h) */ 773 /* Driver support (drm_drv.h) */
777extern int drm_init(struct drm_driver *driver); 774extern int drm_init(struct drm_driver *driver);
778extern void drm_exit(struct drm_driver *driver); 775extern void drm_exit(struct drm_driver *driver);
779extern int drm_ioctl(struct inode *inode, struct file *filp, 776extern int drm_ioctl(struct inode *inode, struct file *filp,
780 unsigned int cmd, unsigned long arg); 777 unsigned int cmd, unsigned long arg);
781extern long drm_compat_ioctl(struct file *filp, 778extern long drm_compat_ioctl(struct file *filp,
782 unsigned int cmd, unsigned long arg); 779 unsigned int cmd, unsigned long arg);
783extern int drm_takedown(drm_device_t * dev); 780extern int drm_takedown(drm_device_t * dev);
784 781
785 /* Device support (drm_fops.h) */ 782 /* Device support (drm_fops.h) */
786extern int drm_open(struct inode *inode, struct file *filp); 783extern int drm_open(struct inode *inode, struct file *filp);
787extern int drm_stub_open(struct inode *inode, struct file *filp); 784extern int drm_stub_open(struct inode *inode, struct file *filp);
788extern int drm_flush(struct file *filp); 785extern int drm_flush(struct file *filp);
789extern int drm_fasync(int fd, struct file *filp, int on); 786extern int drm_fasync(int fd, struct file *filp, int on);
790extern int drm_release(struct inode *inode, struct file *filp); 787extern int drm_release(struct inode *inode, struct file *filp);
791 788
792 /* Mapping support (drm_vm.h) */ 789 /* Mapping support (drm_vm.h) */
793extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 790extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
794extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 791extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
795 792
796 /* Memory management support (drm_memory.h) */ 793 /* Memory management support (drm_memory.h) */
797#include "drm_memory.h" 794#include "drm_memory.h"
798extern void drm_mem_init(void); 795extern void drm_mem_init(void);
799extern int drm_mem_info(char *buf, char **start, off_t offset, 796extern int drm_mem_info(char *buf, char **start, off_t offset,
800 int request, int *eof, void *data); 797 int request, int *eof, void *data);
801extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, 798extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
802 int area);
803extern unsigned long drm_alloc_pages(int order, int area); 799extern unsigned long drm_alloc_pages(int order, int area);
804extern void drm_free_pages(unsigned long address, int order, 800extern void drm_free_pages(unsigned long address, int order, int area);
805 int area); 801extern void *drm_ioremap(unsigned long offset, unsigned long size,
806extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev); 802 drm_device_t * dev);
807extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, 803extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size,
808 drm_device_t *dev); 804 drm_device_t * dev);
809extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *dev); 805extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev);
810 806
811extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t *dev, int pages, u32 type); 807extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type);
812extern int drm_free_agp(DRM_AGP_MEM *handle, int pages); 808extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
813extern int drm_bind_agp(DRM_AGP_MEM *handle, unsigned int start); 809extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
814extern int drm_unbind_agp(DRM_AGP_MEM *handle); 810extern int drm_unbind_agp(DRM_AGP_MEM * handle);
815 811
816 /* Misc. IOCTL support (drm_ioctl.h) */ 812 /* Misc. IOCTL support (drm_ioctl.h) */
817extern int drm_irq_by_busid(struct inode *inode, struct file *filp, 813extern int drm_irq_by_busid(struct inode *inode, struct file *filp,
818 unsigned int cmd, unsigned long arg); 814 unsigned int cmd, unsigned long arg);
819extern int drm_getunique(struct inode *inode, struct file *filp, 815extern int drm_getunique(struct inode *inode, struct file *filp,
820 unsigned int cmd, unsigned long arg); 816 unsigned int cmd, unsigned long arg);
821extern int drm_setunique(struct inode *inode, struct file *filp, 817extern int drm_setunique(struct inode *inode, struct file *filp,
822 unsigned int cmd, unsigned long arg); 818 unsigned int cmd, unsigned long arg);
823extern int drm_getmap(struct inode *inode, struct file *filp, 819extern int drm_getmap(struct inode *inode, struct file *filp,
824 unsigned int cmd, unsigned long arg); 820 unsigned int cmd, unsigned long arg);
825extern int drm_getclient(struct inode *inode, struct file *filp, 821extern int drm_getclient(struct inode *inode, struct file *filp,
826 unsigned int cmd, unsigned long arg); 822 unsigned int cmd, unsigned long arg);
827extern int drm_getstats(struct inode *inode, struct file *filp, 823extern int drm_getstats(struct inode *inode, struct file *filp,
828 unsigned int cmd, unsigned long arg); 824 unsigned int cmd, unsigned long arg);
829extern int drm_setversion(struct inode *inode, struct file *filp, 825extern int drm_setversion(struct inode *inode, struct file *filp,
830 unsigned int cmd, unsigned long arg); 826 unsigned int cmd, unsigned long arg);
831 827
832 /* Context IOCTL support (drm_context.h) */ 828 /* Context IOCTL support (drm_context.h) */
833extern int drm_resctx( struct inode *inode, struct file *filp, 829extern int drm_resctx(struct inode *inode, struct file *filp,
834 unsigned int cmd, unsigned long arg ); 830 unsigned int cmd, unsigned long arg);
835extern int drm_addctx( struct inode *inode, struct file *filp, 831extern int drm_addctx(struct inode *inode, struct file *filp,
836 unsigned int cmd, unsigned long arg ); 832 unsigned int cmd, unsigned long arg);
837extern int drm_modctx( struct inode *inode, struct file *filp, 833extern int drm_modctx(struct inode *inode, struct file *filp,
838 unsigned int cmd, unsigned long arg ); 834 unsigned int cmd, unsigned long arg);
839extern int drm_getctx( struct inode *inode, struct file *filp, 835extern int drm_getctx(struct inode *inode, struct file *filp,
840 unsigned int cmd, unsigned long arg ); 836 unsigned int cmd, unsigned long arg);
841extern int drm_switchctx( struct inode *inode, struct file *filp, 837extern int drm_switchctx(struct inode *inode, struct file *filp,
842 unsigned int cmd, unsigned long arg ); 838 unsigned int cmd, unsigned long arg);
843extern int drm_newctx( struct inode *inode, struct file *filp, 839extern int drm_newctx(struct inode *inode, struct file *filp,
844 unsigned int cmd, unsigned long arg ); 840 unsigned int cmd, unsigned long arg);
845extern int drm_rmctx( struct inode *inode, struct file *filp, 841extern int drm_rmctx(struct inode *inode, struct file *filp,
846 unsigned int cmd, unsigned long arg ); 842 unsigned int cmd, unsigned long arg);
847 843
848extern int drm_ctxbitmap_init( drm_device_t *dev ); 844extern int drm_ctxbitmap_init(drm_device_t * dev);
849extern void drm_ctxbitmap_cleanup( drm_device_t *dev ); 845extern void drm_ctxbitmap_cleanup(drm_device_t * dev);
850extern void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle ); 846extern void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle);
851 847
852extern int drm_setsareactx( struct inode *inode, struct file *filp, 848extern int drm_setsareactx(struct inode *inode, struct file *filp,
853 unsigned int cmd, unsigned long arg ); 849 unsigned int cmd, unsigned long arg);
854extern int drm_getsareactx( struct inode *inode, struct file *filp, 850extern int drm_getsareactx(struct inode *inode, struct file *filp,
855 unsigned int cmd, unsigned long arg ); 851 unsigned int cmd, unsigned long arg);
856 852
857 /* Drawable IOCTL support (drm_drawable.h) */ 853 /* Drawable IOCTL support (drm_drawable.h) */
858extern int drm_adddraw(struct inode *inode, struct file *filp, 854extern int drm_adddraw(struct inode *inode, struct file *filp,
859 unsigned int cmd, unsigned long arg); 855 unsigned int cmd, unsigned long arg);
860extern int drm_rmdraw(struct inode *inode, struct file *filp, 856extern int drm_rmdraw(struct inode *inode, struct file *filp,
861 unsigned int cmd, unsigned long arg); 857 unsigned int cmd, unsigned long arg);
862
863 858
864 /* Authentication IOCTL support (drm_auth.h) */ 859 /* Authentication IOCTL support (drm_auth.h) */
865extern int drm_getmagic(struct inode *inode, struct file *filp, 860extern int drm_getmagic(struct inode *inode, struct file *filp,
866 unsigned int cmd, unsigned long arg); 861 unsigned int cmd, unsigned long arg);
867extern int drm_authmagic(struct inode *inode, struct file *filp, 862extern int drm_authmagic(struct inode *inode, struct file *filp,
868 unsigned int cmd, unsigned long arg); 863 unsigned int cmd, unsigned long arg);
869 864
870 /* Placeholder for ioctls past */ 865 /* Placeholder for ioctls past */
871extern int drm_noop(struct inode *inode, struct file *filp, 866extern int drm_noop(struct inode *inode, struct file *filp,
872 unsigned int cmd, unsigned long arg); 867 unsigned int cmd, unsigned long arg);
873 868
874 /* Locking IOCTL support (drm_lock.h) */ 869 /* Locking IOCTL support (drm_lock.h) */
875extern int drm_lock(struct inode *inode, struct file *filp, 870extern int drm_lock(struct inode *inode, struct file *filp,
876 unsigned int cmd, unsigned long arg); 871 unsigned int cmd, unsigned long arg);
877extern int drm_unlock(struct inode *inode, struct file *filp, 872extern int drm_unlock(struct inode *inode, struct file *filp,
878 unsigned int cmd, unsigned long arg); 873 unsigned int cmd, unsigned long arg);
879extern int drm_lock_take(__volatile__ unsigned int *lock, 874extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context);
880 unsigned int context); 875extern int drm_lock_free(drm_device_t * dev,
881extern int drm_lock_free(drm_device_t *dev, 876 __volatile__ unsigned int *lock, unsigned int context);
882 __volatile__ unsigned int *lock,
883 unsigned int context);
884 877
885 /* Buffer management support (drm_bufs.h) */ 878 /* Buffer management support (drm_bufs.h) */
886extern int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request); 879extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
887extern int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request); 880extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request);
888extern int drm_addmap(drm_device_t *dev, unsigned int offset, 881extern int drm_addmap(drm_device_t * dev, unsigned int offset,
889 unsigned int size, drm_map_type_t type, 882 unsigned int size, drm_map_type_t type,
890 drm_map_flags_t flags, drm_local_map_t **map_ptr); 883 drm_map_flags_t flags, drm_local_map_t ** map_ptr);
891extern int drm_addmap_ioctl(struct inode *inode, struct file *filp, 884extern int drm_addmap_ioctl(struct inode *inode, struct file *filp,
892 unsigned int cmd, unsigned long arg); 885 unsigned int cmd, unsigned long arg);
893extern int drm_rmmap(drm_device_t *dev, drm_local_map_t *map); 886extern int drm_rmmap(drm_device_t * dev, drm_local_map_t * map);
894extern int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map); 887extern int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map);
895extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp, 888extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
896 unsigned int cmd, unsigned long arg); 889 unsigned int cmd, unsigned long arg);
897 890
898extern int drm_order( unsigned long size ); 891extern int drm_order(unsigned long size);
899extern int drm_addbufs( struct inode *inode, struct file *filp, 892extern int drm_addbufs(struct inode *inode, struct file *filp,
900 unsigned int cmd, unsigned long arg ); 893 unsigned int cmd, unsigned long arg);
901extern int drm_infobufs( struct inode *inode, struct file *filp, 894extern int drm_infobufs(struct inode *inode, struct file *filp,
902 unsigned int cmd, unsigned long arg ); 895 unsigned int cmd, unsigned long arg);
903extern int drm_markbufs( struct inode *inode, struct file *filp, 896extern int drm_markbufs(struct inode *inode, struct file *filp,
904 unsigned int cmd, unsigned long arg ); 897 unsigned int cmd, unsigned long arg);
905extern int drm_freebufs( struct inode *inode, struct file *filp, 898extern int drm_freebufs(struct inode *inode, struct file *filp,
906 unsigned int cmd, unsigned long arg ); 899 unsigned int cmd, unsigned long arg);
907extern int drm_mapbufs( struct inode *inode, struct file *filp, 900extern int drm_mapbufs(struct inode *inode, struct file *filp,
908 unsigned int cmd, unsigned long arg ); 901 unsigned int cmd, unsigned long arg);
909extern unsigned long drm_get_resource_start(drm_device_t *dev, 902extern unsigned long drm_get_resource_start(drm_device_t * dev,
910 unsigned int resource); 903 unsigned int resource);
911extern unsigned long drm_get_resource_len(drm_device_t *dev, 904extern unsigned long drm_get_resource_len(drm_device_t * dev,
912 unsigned int resource); 905 unsigned int resource);
913 906
914 /* DMA support (drm_dma.h) */ 907 /* DMA support (drm_dma.h) */
915extern int drm_dma_setup(drm_device_t *dev); 908extern int drm_dma_setup(drm_device_t * dev);
916extern void drm_dma_takedown(drm_device_t *dev); 909extern void drm_dma_takedown(drm_device_t * dev);
917extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); 910extern void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf);
918extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp); 911extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp);
919 912
920 /* IRQ support (drm_irq.h) */ 913 /* IRQ support (drm_irq.h) */
921extern int drm_control( struct inode *inode, struct file *filp, 914extern int drm_control(struct inode *inode, struct file *filp,
922 unsigned int cmd, unsigned long arg ); 915 unsigned int cmd, unsigned long arg);
923extern int drm_irq_uninstall( drm_device_t *dev ); 916extern int drm_irq_uninstall(drm_device_t * dev);
924extern irqreturn_t drm_irq_handler( DRM_IRQ_ARGS ); 917extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
925extern void drm_driver_irq_preinstall( drm_device_t *dev ); 918extern void drm_driver_irq_preinstall(drm_device_t * dev);
926extern void drm_driver_irq_postinstall( drm_device_t *dev ); 919extern void drm_driver_irq_postinstall(drm_device_t * dev);
927extern void drm_driver_irq_uninstall( drm_device_t *dev ); 920extern void drm_driver_irq_uninstall(drm_device_t * dev);
928 921
929extern int drm_wait_vblank(struct inode *inode, struct file *filp, 922extern int drm_wait_vblank(struct inode *inode, struct file *filp,
930 unsigned int cmd, unsigned long arg); 923 unsigned int cmd, unsigned long arg);
931extern int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq); 924extern int drm_vblank_wait(drm_device_t * dev, unsigned int *vbl_seq);
932extern void drm_vbl_send_signals( drm_device_t *dev ); 925extern void drm_vbl_send_signals(drm_device_t * dev);
933 926
934 /* AGP/GART support (drm_agpsupport.h) */ 927 /* AGP/GART support (drm_agpsupport.h) */
935extern drm_agp_head_t *drm_agp_init(drm_device_t *dev); 928extern drm_agp_head_t *drm_agp_init(drm_device_t * dev);
936extern int drm_agp_acquire(drm_device_t * dev); 929extern int drm_agp_acquire(drm_device_t * dev);
937extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, 930extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
938 unsigned int cmd, unsigned long arg); 931 unsigned int cmd, unsigned long arg);
939extern int drm_agp_release(drm_device_t *dev); 932extern int drm_agp_release(drm_device_t * dev);
940extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp, 933extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
941 unsigned int cmd, unsigned long arg); 934 unsigned int cmd, unsigned long arg);
942extern int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode); 935extern int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode);
943extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, 936extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
944 unsigned int cmd, unsigned long arg); 937 unsigned int cmd, unsigned long arg);
945extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info); 938extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info);
946extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, 939extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
940 unsigned int cmd, unsigned long arg);
941extern int drm_agp_alloc(struct inode *inode, struct file *filp,
942 unsigned int cmd, unsigned long arg);
943extern int drm_agp_free(struct inode *inode, struct file *filp,
947 unsigned int cmd, unsigned long arg); 944 unsigned int cmd, unsigned long arg);
948extern int drm_agp_alloc(struct inode *inode, struct file *filp, 945extern int drm_agp_unbind(struct inode *inode, struct file *filp,
949 unsigned int cmd, unsigned long arg); 946 unsigned int cmd, unsigned long arg);
950extern int drm_agp_free(struct inode *inode, struct file *filp, 947extern int drm_agp_bind(struct inode *inode, struct file *filp,
951 unsigned int cmd, unsigned long arg); 948 unsigned int cmd, unsigned long arg);
952extern int drm_agp_unbind(struct inode *inode, struct file *filp, 949extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge,
953 unsigned int cmd, unsigned long arg); 950 size_t pages, u32 type);
954extern int drm_agp_bind(struct inode *inode, struct file *filp, 951extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
955 unsigned int cmd, unsigned long arg); 952extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
956extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); 953extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
957extern int drm_agp_free_memory(DRM_AGP_MEM *handle);
958extern int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start);
959extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle);
960 954
961 /* Stub support (drm_stub.h) */ 955 /* Stub support (drm_stub.h) */
962extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 956extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
963 struct drm_driver *driver); 957 struct drm_driver *driver);
964extern int drm_put_dev(drm_device_t * dev); 958extern int drm_put_dev(drm_device_t * dev);
965extern int drm_put_head(drm_head_t * head); 959extern int drm_put_head(drm_head_t * head);
966extern unsigned int drm_debug; 960extern unsigned int drm_debug;
967extern unsigned int drm_cards_limit; 961extern unsigned int drm_cards_limit;
968extern drm_head_t **drm_heads; 962extern drm_head_t **drm_heads;
969extern struct drm_sysfs_class *drm_class; 963extern struct drm_sysfs_class *drm_class;
970extern struct proc_dir_entry *drm_proc_root; 964extern struct proc_dir_entry *drm_proc_root;
971 965
972 /* Proc support (drm_proc.h) */ 966 /* Proc support (drm_proc.h) */
973extern int drm_proc_init(drm_device_t *dev, 967extern int drm_proc_init(drm_device_t * dev,
974 int minor, 968 int minor,
975 struct proc_dir_entry *root, 969 struct proc_dir_entry *root,
976 struct proc_dir_entry **dev_root); 970 struct proc_dir_entry **dev_root);
977extern int drm_proc_cleanup(int minor, 971extern int drm_proc_cleanup(int minor,
978 struct proc_dir_entry *root, 972 struct proc_dir_entry *root,
979 struct proc_dir_entry *dev_root); 973 struct proc_dir_entry *dev_root);
980 974
981 /* Scatter Gather Support (drm_scatter.h) */ 975 /* Scatter Gather Support (drm_scatter.h) */
982extern void drm_sg_cleanup(drm_sg_mem_t *entry); 976extern void drm_sg_cleanup(drm_sg_mem_t * entry);
983extern int drm_sg_alloc(struct inode *inode, struct file *filp, 977extern int drm_sg_alloc(struct inode *inode, struct file *filp,
984 unsigned int cmd, unsigned long arg); 978 unsigned int cmd, unsigned long arg);
985extern int drm_sg_free(struct inode *inode, struct file *filp, 979extern int drm_sg_free(struct inode *inode, struct file *filp,
986 unsigned int cmd, unsigned long arg); 980 unsigned int cmd, unsigned long arg);
987 981
988 /* ATI PCIGART support (ati_pcigart.h) */ 982 /* ATI PCIGART support (ati_pcigart.h) */
989extern int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info *gart_info); 983extern int drm_ati_pcigart_init(drm_device_t * dev,
990extern int drm_ati_pcigart_cleanup(drm_device_t * dev, drm_ati_pcigart_info *gart_info); 984 drm_ati_pcigart_info * gart_info);
985extern int drm_ati_pcigart_cleanup(drm_device_t * dev,
986 drm_ati_pcigart_info * gart_info);
991 987
992extern drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, 988extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size,
993 size_t align, dma_addr_t maxaddr); 989 size_t align, dma_addr_t maxaddr);
994extern void __drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah); 990extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
995extern void drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah); 991extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
996 992
997 /* sysfs support (drm_sysfs.c) */ 993 /* sysfs support (drm_sysfs.c) */
998struct drm_sysfs_class; 994struct drm_sysfs_class;
@@ -1005,38 +1001,41 @@ extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
1005 const char *fmt, ...); 1001 const char *fmt, ...);
1006extern void drm_sysfs_device_remove(dev_t dev); 1002extern void drm_sysfs_device_remove(dev_t dev);
1007 1003
1008
1009/* Inline replacements for DRM_IOREMAP macros */ 1004/* Inline replacements for DRM_IOREMAP macros */
1010static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) 1005static __inline__ void drm_core_ioremap(struct drm_map *map,
1006 struct drm_device *dev)
1011{ 1007{
1012 map->handle = drm_ioremap( map->offset, map->size, dev ); 1008 map->handle = drm_ioremap(map->offset, map->size, dev);
1013} 1009}
1014 1010
1015static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) 1011static __inline__ void drm_core_ioremap_nocache(struct drm_map *map,
1012 struct drm_device *dev)
1016{ 1013{
1017 map->handle = drm_ioremap_nocache(map->offset, map->size, dev); 1014 map->handle = drm_ioremap_nocache(map->offset, map->size, dev);
1018} 1015}
1019 1016
1020static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) 1017static __inline__ void drm_core_ioremapfree(struct drm_map *map,
1018 struct drm_device *dev)
1021{ 1019{
1022 if ( map->handle && map->size ) 1020 if (map->handle && map->size)
1023 drm_ioremapfree( map->handle, map->size, dev ); 1021 drm_ioremapfree(map->handle, map->size, dev);
1024} 1022}
1025 1023
1026static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token) 1024static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev,
1025 unsigned int token)
1027{ 1026{
1028 drm_map_list_t *_entry; 1027 drm_map_list_t *_entry;
1029 list_for_each_entry(_entry, &dev->maplist->head, head) 1028 list_for_each_entry(_entry, &dev->maplist->head, head)
1030 if (_entry->user_token == token) 1029 if (_entry->user_token == token)
1031 return _entry->map; 1030 return _entry->map;
1032 return NULL; 1031 return NULL;
1033} 1032}
1034 1033
1035static __inline__ int drm_device_is_agp(drm_device_t *dev) 1034static __inline__ int drm_device_is_agp(drm_device_t * dev)
1036{ 1035{
1037 if ( dev->driver->device_is_agp != NULL ) { 1036 if (dev->driver->device_is_agp != NULL) {
1038 int err = (*dev->driver->device_is_agp)( dev ); 1037 int err = (*dev->driver->device_is_agp) (dev);
1039 1038
1040 if (err != 2) { 1039 if (err != 2) {
1041 return err; 1040 return err;
1042 } 1041 }
@@ -1045,7 +1044,7 @@ static __inline__ int drm_device_is_agp(drm_device_t *dev)
1045 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1044 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1046} 1045}
1047 1046
1048static __inline__ int drm_device_is_pcie(drm_device_t *dev) 1047static __inline__ int drm_device_is_pcie(drm_device_t * dev)
1049{ 1048{
1050 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1049 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1051} 1050}
@@ -1080,12 +1079,12 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area);
1080 1079
1081/*@}*/ 1080/*@}*/
1082 1081
1083extern unsigned long drm_core_get_map_ofs(drm_map_t *map); 1082extern unsigned long drm_core_get_map_ofs(drm_map_t * map);
1084extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1083extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
1085 1084
1086#ifndef pci_pretty_name 1085#ifndef pci_pretty_name
1087#define pci_pretty_name(dev) "" 1086#define pci_pretty_name(dev) ""
1088#endif 1087#endif
1089 1088
1090#endif /* __KERNEL__ */ 1089#endif /* __KERNEL__ */
1091#endif 1090#endif