drmP.h revision 112015
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 * 4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 6 * All rights reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a 9 * copy of this software and associated documentation files (the "Software"), 10 * to deal in the Software without restriction, including without limitation 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * and/or sell copies of the Software, and to permit persons to whom the 13 * Software is furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice (including the next 16 * paragraph) shall be included in all copies or substantial portions of the 17 * Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 * OTHER DEALINGS IN THE SOFTWARE. 26 * 27 * Authors: 28 * Rickard E. (Rik) Faith <faith@valinux.com> 29 * Gareth Hughes <gareth@valinux.com> 30 * $FreeBSD: head/sys/dev/drm/drmP.h 112015 2003-03-09 02:08:30Z anholt $ 31 */ 32 33#ifndef _DRM_P_H_ 34#define _DRM_P_H_ 35 36#if defined(_KERNEL) || defined(__KERNEL__) 37 38/* DRM template customization defaults 39 */ 40#ifndef __HAVE_AGP 41#define __HAVE_AGP 0 42#endif 43#ifndef __HAVE_MTRR 44#define __HAVE_MTRR 0 45#endif 46#ifndef __HAVE_CTX_BITMAP 47#define __HAVE_CTX_BITMAP 0 48#endif 49#ifndef __HAVE_DMA 50#define __HAVE_DMA 0 51#endif 52#ifndef __HAVE_DMA_IRQ 53#define __HAVE_DMA_IRQ 0 54#endif 55#ifndef __HAVE_DMA_WAITLIST 56#define __HAVE_DMA_WAITLIST 0 57#endif 58#ifndef __HAVE_DMA_FREELIST 59#define __HAVE_DMA_FREELIST 0 60#endif 61#ifndef __HAVE_DMA_HISTOGRAM 62#define __HAVE_DMA_HISTOGRAM 0 63#endif 64 65#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then 66 also include looping detection. */ 67 68typedef struct drm_device drm_device_t; 69typedef struct drm_file drm_file_t; 70 71/* There's undoubtably more of this file to go into these OS dependent ones. */ 72 73#ifdef __FreeBSD__ 74#include "dev/drm/drm_os_freebsd.h" 75#elif defined __NetBSD__ 76#include "dev/drm/drm_os_netbsd.h" 77#endif 78 79#include "dev/drm/drm.h" 80 81/* Begin the DRM... */ 82 83#define DRM_HASH_SIZE 16 /* Size of key hash table */ 84#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ 85#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */ 86#define DRM_LOOPING_LIMIT 5000000 87#define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */ 88#define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */ 89 90#define DRM_FLAG_DEBUG 0x01 91#define DRM_FLAG_NOCTX 0x02 92 93#define DRM_MEM_DMA 0 94#define DRM_MEM_SAREA 1 95#define DRM_MEM_DRIVER 2 96#define DRM_MEM_MAGIC 3 97#define DRM_MEM_IOCTLS 4 98#define DRM_MEM_MAPS 5 99#define DRM_MEM_VMAS 6 100#define DRM_MEM_BUFS 7 101#define DRM_MEM_SEGS 8 102#define DRM_MEM_PAGES 9 103#define DRM_MEM_FILES 10 104#define DRM_MEM_QUEUES 11 105#define DRM_MEM_CMDS 12 106#define DRM_MEM_MAPPINGS 13 107#define DRM_MEM_BUFLISTS 14 108#define DRM_MEM_AGPLISTS 15 109#define DRM_MEM_TOTALAGP 16 110#define DRM_MEM_BOUNDAGP 17 111#define DRM_MEM_CTXBITMAP 18 112#define DRM_MEM_STUB 19 113#define DRM_MEM_SGLISTS 20 114 115#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) 116 117 /* Backward compatibility section */ 118 /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */ 119#ifndef _PAGE_PWT 120#define _PAGE_PWT _PAGE_WT 121#endif 122 123 /* Mapping helper macros */ 124#define DRM_IOREMAP(map) \ 125 (map)->handle = DRM(ioremap)( dev, map ) 126 127#define DRM_IOREMAP_NOCACHE(map) \ 128 (map)->handle = DRM(ioremap_nocache)( dev, map ) 129 130#define DRM_IOREMAPFREE(map) \ 131 do { \ 132 if ( (map)->handle && (map)->size ) \ 133 DRM(ioremapfree)( map ); \ 134 } while (0) 135 136 /* Internal types and structures */ 137#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 138#define DRM_MIN(a,b) ((a)<(b)?(a):(b)) 139#define DRM_MAX(a,b) ((a)>(b)?(a):(b)) 140 141#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) 142#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) 143#define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) 144 145#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ 146 (_map) = (_dev)->context_sareas[_ctx]; \ 147} while(0) 148 149 150typedef struct drm_pci_list { 151 u16 vendor; 152 u16 device; 153} drm_pci_list_t; 154 155typedef struct drm_ioctl_desc { 156 d_ioctl_t *func; 157 int auth_needed; 158 int root_only; 159} drm_ioctl_desc_t; 160 161typedef struct drm_devstate { 162 pid_t owner; /* X server pid holding x_lock */ 163 164} drm_devstate_t; 165 166typedef struct drm_magic_entry { 167 drm_magic_t magic; 168 struct drm_file *priv; 169 struct drm_magic_entry *next; 170} drm_magic_entry_t; 171 172typedef struct drm_magic_head { 173 struct drm_magic_entry *head; 174 struct drm_magic_entry *tail; 175} drm_magic_head_t; 176 177typedef struct drm_vma_entry { 178 struct vm_area_struct *vma; 179 struct drm_vma_entry *next; 180 pid_t pid; 181} drm_vma_entry_t; 182 183typedef struct drm_buf { 184 int idx; /* Index into master buflist */ 185 int total; /* Buffer size */ 186 int order; /* log-base-2(total) */ 187 int used; /* Amount of buffer in use (for DMA) */ 188 unsigned long offset; /* Byte offset (used internally) */ 189 void *address; /* Address of buffer */ 190 unsigned long bus_address; /* Bus 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 207#if DRM_DMA_HISTOGRAM 208 cycles_t time_queued; /* Queued to kernel DMA queue */ 209 cycles_t time_dispatched; /* Dispatched to hardware */ 210 cycles_t time_completed; /* Completed by hardware */ 211 cycles_t time_freed; /* Back on freelist */ 212#endif 213 214 int dev_priv_size; /* Size of buffer private stoarge */ 215 void *dev_private; /* Per-buffer private storage */ 216} drm_buf_t; 217 218#if DRM_DMA_HISTOGRAM 219#define DRM_DMA_HISTOGRAM_SLOTS 9 220#define DRM_DMA_HISTOGRAM_INITIAL 10 221#define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10) 222typedef struct drm_histogram { 223 atomic_t total; 224 225 atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS]; 226 atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; 227 atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; 228 229 atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; 230 atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; 231 232 atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS]; 233 atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS]; 234 atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS]; 235 atomic_t lacq[DRM_DMA_HISTOGRAM_SLOTS]; 236 atomic_t lhld[DRM_DMA_HISTOGRAM_SLOTS]; 237} drm_histogram_t; 238#endif 239 240 /* bufs is one longer than it has to be */ 241typedef struct drm_waitlist { 242 int count; /* Number of possible buffers */ 243 drm_buf_t **bufs; /* List of pointers to buffers */ 244 drm_buf_t **rp; /* Read pointer */ 245 drm_buf_t **wp; /* Write pointer */ 246 drm_buf_t **end; /* End pointer */ 247 DRM_SPINTYPE read_lock; 248 DRM_SPINTYPE write_lock; 249} drm_waitlist_t; 250 251typedef struct drm_freelist { 252 int initialized; /* Freelist in use */ 253 atomic_t count; /* Number of free buffers */ 254 drm_buf_t *next; /* End pointer */ 255 256 wait_queue_head_t waiting; /* Processes waiting on free bufs */ 257 int low_mark; /* Low water mark */ 258 int high_mark; /* High water mark */ 259 atomic_t wfh; /* If waiting for high mark */ 260 DRM_SPINTYPE lock; 261} drm_freelist_t; 262 263typedef struct drm_buf_entry { 264 int buf_size; 265 int buf_count; 266 drm_buf_t *buflist; 267 int seg_count; 268 int page_order; 269 unsigned long *seglist; 270 271 drm_freelist_t freelist; 272} drm_buf_entry_t; 273 274typedef struct drm_hw_lock { 275 __volatile__ unsigned int lock; 276 char padding[60]; /* Pad to cache line */ 277} drm_hw_lock_t; 278 279typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t; 280struct drm_file { 281 TAILQ_ENTRY(drm_file) link; 282 int authenticated; 283 int minor; 284 pid_t pid; 285 uid_t uid; 286 int refs; 287 drm_magic_t magic; 288 unsigned long ioctl_count; 289 struct drm_device *devXX; 290}; 291 292typedef struct drm_queue { 293 atomic_t use_count; /* Outstanding uses (+1) */ 294 atomic_t finalization; /* Finalization in progress */ 295 atomic_t block_count; /* Count of processes waiting */ 296 atomic_t block_read; /* Queue blocked for reads */ 297 wait_queue_head_t read_queue; /* Processes waiting on block_read */ 298 atomic_t block_write; /* Queue blocked for writes */ 299 wait_queue_head_t write_queue; /* Processes waiting on block_write */ 300#if 1 301 atomic_t total_queued; /* Total queued statistic */ 302 atomic_t total_flushed;/* Total flushes statistic */ 303 atomic_t total_locks; /* Total locks statistics */ 304#endif 305 drm_ctx_flags_t flags; /* Context preserving and 2D-only */ 306 drm_waitlist_t waitlist; /* Pending buffers */ 307 wait_queue_head_t flush_queue; /* Processes waiting until flush */ 308} drm_queue_t; 309 310typedef struct drm_lock_data { 311 drm_hw_lock_t *hw_lock; /* Hardware lock */ 312 pid_t pid; /* PID of lock holder (0=kernel) */ 313 wait_queue_head_t lock_queue; /* Queue of blocked processes */ 314 unsigned long lock_time; /* Time of last lock in jiffies */ 315} drm_lock_data_t; 316 317typedef struct drm_device_dma { 318#if 0 319 /* Performance Counters */ 320 atomic_t total_prio; /* Total DRM_DMA_PRIORITY */ 321 atomic_t total_bytes; /* Total bytes DMA'd */ 322 atomic_t total_dmas; /* Total DMA buffers dispatched */ 323 324 atomic_t total_missed_dma; /* Missed drm_do_dma */ 325 atomic_t total_missed_lock; /* Missed lock in drm_do_dma */ 326 atomic_t total_missed_free; /* Missed drm_free_this_buffer */ 327 atomic_t total_missed_sched;/* Missed drm_dma_schedule */ 328 329 atomic_t total_tried; /* Tried next_buffer */ 330 atomic_t total_hit; /* Sent next_buffer */ 331 atomic_t total_lost; /* Lost interrupt */ 332#endif 333 334 drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; 335 int buf_count; 336 drm_buf_t **buflist; /* Vector of pointers info bufs */ 337 int seg_count; 338 int page_count; 339 unsigned long *pagelist; 340 unsigned long byte_count; 341 enum { 342 _DRM_DMA_USE_AGP = 0x01, 343 _DRM_DMA_USE_SG = 0x02 344 } flags; 345 346 /* DMA support */ 347 drm_buf_t *this_buffer; /* Buffer being sent */ 348 drm_buf_t *next_buffer; /* Selected buffer to send */ 349 drm_queue_t *next_queue; /* Queue from which buffer selected*/ 350 wait_queue_head_t waiting; /* Processes waiting on free bufs */ 351} drm_device_dma_t; 352 353#if __REALLY_HAVE_AGP 354typedef struct drm_agp_mem { 355 void *handle; 356 unsigned long bound; /* address */ 357 int pages; 358 struct drm_agp_mem *prev; 359 struct drm_agp_mem *next; 360} drm_agp_mem_t; 361 362typedef struct drm_agp_head { 363 device_t agpdev; 364 struct agp_info info; 365 const char *chipset; 366 drm_agp_mem_t *memory; 367 unsigned long mode; 368 int enabled; 369 int acquired; 370 unsigned long base; 371 int agp_mtrr; 372 int cant_use_aperture; 373 unsigned long page_mask; 374} drm_agp_head_t; 375#endif 376 377typedef struct drm_sg_mem { 378 unsigned long handle; 379 void *virtual; 380 int pages; 381 dma_addr_t *busaddr; 382} drm_sg_mem_t; 383 384typedef struct drm_sigdata { 385 int context; 386 drm_hw_lock_t *lock; 387} drm_sigdata_t; 388 389typedef struct drm_local_map { 390 unsigned long offset; /* Physical address (0 for SAREA)*/ 391 unsigned long size; /* Physical size (bytes) */ 392 drm_map_type_t type; /* Type of memory mapped */ 393 drm_map_flags_t flags; /* Flags */ 394 void *handle; /* User-space: "Handle" to pass to mmap */ 395 /* Kernel-space: kernel-virtual address */ 396 int mtrr; /* MTRR slot used */ 397 /* Private data */ 398 bus_space_tag_t iot; 399 bus_space_handle_t ioh; 400} drm_local_map_t; 401 402typedef TAILQ_HEAD(drm_map_list, drm_map_list_entry) drm_map_list_t; 403typedef struct drm_map_list_entry { 404 TAILQ_ENTRY(drm_map_list_entry) link; 405 drm_local_map_t *map; 406} drm_map_list_entry_t; 407 408TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig); 409typedef struct drm_vbl_sig { 410 TAILQ_ENTRY(drm_vbl_sig) link; 411 unsigned int sequence; 412 int signo; 413 int pid; 414} drm_vbl_sig_t; 415 416struct drm_device { 417#ifdef __NetBSD__ 418 struct device device; /* NetBSD's softc is an extension of struct device */ 419#endif 420 const char *name; /* Simple driver name */ 421 char *unique; /* Unique identifier: e.g., busid */ 422 int unique_len; /* Length of unique field */ 423#ifdef __FreeBSD__ 424 device_t device; /* Device instance from newbus */ 425#endif 426 dev_t devnode; /* Device number for mknod */ 427 char *devname; /* For /proc/interrupts */ 428 429 int blocked; /* Blocked due to VC switch? */ 430 int flags; /* Flags to open(2) */ 431 int writable; /* Opened with FWRITE */ 432 433 /* Locks */ 434 DRM_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ 435 struct lock dev_lock; /* For others */ 436 /* Usage Counters */ 437 int open_count; /* Outstanding files open */ 438 atomic_t ioctl_count; /* Outstanding IOCTLs pending */ 439 atomic_t vma_count; /* Outstanding vma areas open */ 440 int buf_use; /* Buffers in use -- cannot alloc */ 441 atomic_t buf_alloc; /* Buffer allocation in progress */ 442 443 /* Performance counters */ 444 unsigned long counters; 445 drm_stat_type_t types[15]; 446 atomic_t counts[15]; 447 448 /* Authentication */ 449 drm_file_list_t files; 450 drm_magic_head_t magiclist[DRM_HASH_SIZE]; 451 452 /* Memory management */ 453 drm_map_list_t *maplist; /* Linked list of regions */ 454 int map_count; /* Number of mappable regions */ 455 456 drm_local_map_t **context_sareas; 457 int max_context; 458 459 drm_vma_entry_t *vmalist; /* List of vmas (for debugging) */ 460 drm_lock_data_t lock; /* Information on hardware lock */ 461 462 /* DMA queues (contexts) */ 463 int queue_count; /* Number of active DMA queues */ 464 int queue_reserved; /* Number of reserved DMA queues */ 465 int queue_slots; /* Actual length of queuelist */ 466 drm_queue_t **queuelist; /* Vector of pointers to DMA queues */ 467 drm_device_dma_t *dma; /* Optional pointer for DMA support */ 468 469 /* Context support */ 470 int irq; /* Interrupt used by board */ 471 int irqrid; /* Interrupt used by board */ 472#ifdef __FreeBSD__ 473 struct resource *irqr; /* Resource for interrupt used by board */ 474#elif defined(__NetBSD__) 475 struct pci_attach_args pa; 476 pci_intr_handle_t ih; 477#endif 478 void *irqh; /* Handle from bus_setup_intr */ 479 atomic_t context_flag; /* Context swapping flag */ 480 atomic_t interrupt_flag; /* Interruption handler flag */ 481 atomic_t dma_flag; /* DMA dispatch flag */ 482 struct callout timer; /* Timer for delaying ctx switch */ 483 wait_queue_head_t context_wait; /* Processes waiting on ctx switch */ 484 int last_checked; /* Last context checked for DMA */ 485 int last_context; /* Last current context */ 486 unsigned long last_switch; /* jiffies at last context switch */ 487#if __FreeBSD_version >= 400005 488 struct task task; 489#endif 490#if __HAVE_VBL_IRQ 491 wait_queue_head_t vbl_queue; /* vbl wait channel */ 492 atomic_t vbl_received; 493#if 0 /* vbl signals are untested, ntested */ 494 struct drm_vbl_sig_list vbl_sig_list; 495 DRM_SPINTYPE vbl_lock; 496#endif 497#endif 498 cycles_t ctx_start; 499 cycles_t lck_start; 500#if __HAVE_DMA_HISTOGRAM 501 drm_histogram_t histo; 502#endif 503 504 /* Callback to X server for context switch 505 and for heavy-handed reset. */ 506 char buf[DRM_BSZ]; /* Output buffer */ 507 char *buf_rp; /* Read pointer */ 508 char *buf_wp; /* Write pointer */ 509 char *buf_end; /* End pointer */ 510#ifdef __FreeBSD__ 511 struct sigio *buf_sigio; /* Processes waiting for SIGIO */ 512#elif defined(__NetBSD__) 513 pid_t buf_pgid; 514#endif 515 struct selinfo buf_sel; /* Workspace for select/poll */ 516 int buf_selecting;/* True if poll sleeper */ 517 wait_queue_head_t buf_readers; /* Processes waiting to read */ 518 wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ 519 520 /* Sysctl support */ 521 struct drm_sysctl_info *sysctl; 522 523#if __REALLY_HAVE_AGP 524 drm_agp_head_t *agp; 525#endif 526 drm_sg_mem_t *sg; /* Scatter gather memory */ 527 atomic_t *ctx_bitmap; 528 void *dev_private; 529 drm_sigdata_t sigdata; /* For block_all_signals */ 530 sigset_t sigmask; 531}; 532 533extern int DRM(flags); 534extern void DRM(parse_options)( char *s ); 535extern int DRM(cpu_valid)( void ); 536 537 /* Authentication (drm_auth.h) */ 538extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, 539 drm_magic_t magic); 540extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); 541 542 /* Driver support (drm_drv.h) */ 543extern int DRM(version)( DRM_IOCTL_ARGS ); 544extern int DRM(write_string)(drm_device_t *dev, const char *s); 545 546 /* Memory management support (drm_memory.h) */ 547extern void DRM(mem_init)(void); 548extern void DRM(mem_uninit)(void); 549extern void *DRM(alloc)(size_t size, int area); 550extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, 551 int area); 552extern char *DRM(strdup)(const char *s, int area); 553extern void DRM(strfree)(char *s, int area); 554extern void DRM(free)(void *pt, size_t size, int area); 555extern void *DRM(ioremap)(drm_device_t *dev, drm_local_map_t *map); 556extern void *DRM(ioremap_nocache)(drm_device_t *dev, drm_local_map_t *map); 557extern void DRM(ioremapfree)(drm_local_map_t *map); 558 559#if __REALLY_HAVE_AGP 560extern agp_memory *DRM(alloc_agp)(int pages, u32 type); 561extern int DRM(free_agp)(agp_memory *handle, int pages); 562extern int DRM(bind_agp)(agp_memory *handle, unsigned int start); 563extern int DRM(unbind_agp)(agp_memory *handle); 564#endif 565 566extern int DRM(context_switch)(drm_device_t *dev, int old, int new); 567extern int DRM(context_switch_complete)(drm_device_t *dev, int new); 568 569#if __HAVE_CTX_BITMAP 570extern int DRM(ctxbitmap_init)( drm_device_t *dev ); 571extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev ); 572extern void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ); 573extern int DRM(ctxbitmap_next)( drm_device_t *dev ); 574#endif 575 576 /* Locking IOCTL support (drm_lock.h) */ 577extern int DRM(lock_take)(__volatile__ unsigned int *lock, 578 unsigned int context); 579extern int DRM(lock_transfer)(drm_device_t *dev, 580 __volatile__ unsigned int *lock, 581 unsigned int context); 582extern int DRM(lock_free)(drm_device_t *dev, 583 __volatile__ unsigned int *lock, 584 unsigned int context); 585extern int DRM(flush_unblock)(drm_device_t *dev, int context, 586 drm_lock_flags_t flags); 587extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context, 588 drm_lock_flags_t flags); 589extern int DRM(notifier)(void *priv); 590 591 /* Buffer management support (drm_bufs.h) */ 592extern int DRM(order)( unsigned long size ); 593 594#if __HAVE_DMA 595 /* DMA support (drm_dma.h) */ 596extern int DRM(dma_setup)(drm_device_t *dev); 597extern void DRM(dma_takedown)(drm_device_t *dev); 598extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); 599extern void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid); 600#if __HAVE_OLD_DMA 601/* GH: This is a dirty hack for now... 602 */ 603extern void DRM(clear_next_buffer)(drm_device_t *dev); 604extern int DRM(select_queue)(drm_device_t *dev, 605 void (*wrapper)(unsigned long)); 606extern int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *dma); 607extern int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma); 608#endif 609#if __HAVE_DMA_IRQ 610extern int DRM(irq_install)( drm_device_t *dev, int irq ); 611extern int DRM(irq_uninstall)( drm_device_t *dev ); 612extern void DRM(dma_service)( DRM_IRQ_ARGS ); 613extern void DRM(driver_irq_preinstall)( drm_device_t *dev ); 614extern void DRM(driver_irq_postinstall)( drm_device_t *dev ); 615extern void DRM(driver_irq_uninstall)( drm_device_t *dev ); 616#if __HAVE_DMA_IRQ_BH 617extern void DRM(dma_immediate_bh)( DRM_TASKQUEUE_ARGS ); 618#endif 619#endif 620#if DRM_DMA_HISTOGRAM 621extern int DRM(histogram_slot)(unsigned long count); 622extern void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf); 623#endif 624 625 /* Buffer list support (drm_lists.h) */ 626#if __HAVE_DMA_WAITLIST 627extern int DRM(waitlist_create)(drm_waitlist_t *bl, int count); 628extern int DRM(waitlist_destroy)(drm_waitlist_t *bl); 629extern int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf); 630extern drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl); 631#endif 632#if __HAVE_DMA_FREELIST 633extern int DRM(freelist_create)(drm_freelist_t *bl, int count); 634extern int DRM(freelist_destroy)(drm_freelist_t *bl); 635extern int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, 636 drm_buf_t *buf); 637extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); 638#endif 639#endif /* __HAVE_DMA */ 640#if __HAVE_VBL_IRQ 641extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); 642extern void DRM(vbl_send_signals)( drm_device_t *dev ); 643#endif 644 645#if __REALLY_HAVE_AGP 646 /* AGP/GART support (drm_agpsupport.h) */ 647extern drm_agp_head_t *DRM(agp_init)(void); 648extern void DRM(agp_uninit)(void); 649extern void DRM(agp_do_release)(void); 650extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type); 651extern int DRM(agp_free_memory)(agp_memory *handle); 652extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start); 653extern int DRM(agp_unbind_memory)(agp_memory *handle); 654#endif 655 656#if __HAVE_SG 657 /* Scatter Gather Support (drm_scatter.h) */ 658extern void DRM(sg_cleanup)(drm_sg_mem_t *entry); 659#endif 660 661#if __REALLY_HAVE_SG 662 /* ATI PCIGART support (ati_pcigart.h) */ 663extern int DRM(ati_pcigart_init)(drm_device_t *dev, 664 unsigned long *addr, 665 dma_addr_t *bus_addr); 666extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev, 667 unsigned long addr, 668 dma_addr_t bus_addr); 669#endif 670 671#endif /* __KERNEL__ */ 672#endif /* _DRM_P_H_ */ 673