diff options
author | anholt <anholt@FreeBSD.org> | 2003-04-25 01:18:47 +0000 |
---|---|---|
committer | anholt <anholt@FreeBSD.org> | 2003-04-25 01:18:47 +0000 |
commit | 6afbdfe8ea6944a3f1856cc687cc6ea5e1d09657 (patch) | |
tree | efa3d0f59b543fa0e752db53d7ddd71f5a18e325 /sys/dev/drm/drmP.h | |
parent | a521aa5aa4b354de2cb042c0909b4830a4884051 (diff) | |
download | FreeBSD-src-6afbdfe8ea6944a3f1856cc687cc6ea5e1d09657.zip FreeBSD-src-6afbdfe8ea6944a3f1856cc687cc6ea5e1d09657.tar.gz |
Update the DRM to the latest from DRI CVS. Includes some bugfixes and removal
of the infrastructure for the gamma driver which was removed a while back.
The DRM_LINUX option is removed because the handler is now provided by the
linux compat code itself.
Diffstat (limited to 'sys/dev/drm/drmP.h')
-rw-r--r-- | sys/dev/drm/drmP.h | 284 |
1 files changed, 91 insertions, 193 deletions
diff --git a/sys/dev/drm/drmP.h b/sys/dev/drm/drmP.h index 7e6849b..83c0285 100644 --- a/sys/dev/drm/drmP.h +++ b/sys/dev/drm/drmP.h @@ -52,15 +52,6 @@ #ifndef __HAVE_DMA_IRQ #define __HAVE_DMA_IRQ 0 #endif -#ifndef __HAVE_DMA_WAITLIST -#define __HAVE_DMA_WAITLIST 0 -#endif -#ifndef __HAVE_DMA_FREELIST -#define __HAVE_DMA_FREELIST 0 -#endif -#ifndef __HAVE_DMA_HISTOGRAM -#define __HAVE_DMA_HISTOGRAM 0 -#endif #define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then also include looping detection. */ @@ -83,12 +74,8 @@ typedef struct drm_file drm_file_t; #define DRM_HASH_SIZE 16 /* Size of key hash table */ #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ #define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */ -#define DRM_LOOPING_LIMIT 5000000 -#define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */ -#define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */ #define DRM_FLAG_DEBUG 0x01 -#define DRM_FLAG_NOCTX 0x02 #define DRM_MEM_DMA 0 #define DRM_MEM_SAREA 1 @@ -96,30 +83,23 @@ typedef struct drm_file drm_file_t; #define DRM_MEM_MAGIC 3 #define DRM_MEM_IOCTLS 4 #define DRM_MEM_MAPS 5 -#define DRM_MEM_VMAS 6 -#define DRM_MEM_BUFS 7 -#define DRM_MEM_SEGS 8 -#define DRM_MEM_PAGES 9 -#define DRM_MEM_FILES 10 -#define DRM_MEM_QUEUES 11 -#define DRM_MEM_CMDS 12 -#define DRM_MEM_MAPPINGS 13 -#define DRM_MEM_BUFLISTS 14 -#define DRM_MEM_AGPLISTS 15 -#define DRM_MEM_TOTALAGP 16 -#define DRM_MEM_BOUNDAGP 17 -#define DRM_MEM_CTXBITMAP 18 -#define DRM_MEM_STUB 19 -#define DRM_MEM_SGLISTS 20 +#define DRM_MEM_BUFS 6 +#define DRM_MEM_SEGS 7 +#define DRM_MEM_PAGES 8 +#define DRM_MEM_FILES 9 +#define DRM_MEM_QUEUES 10 +#define DRM_MEM_CMDS 11 +#define DRM_MEM_MAPPINGS 12 +#define DRM_MEM_BUFLISTS 13 +#define DRM_MEM_AGPLISTS 14 +#define DRM_MEM_TOTALAGP 15 +#define DRM_MEM_BOUNDAGP 16 +#define DRM_MEM_CTXBITMAP 17 +#define DRM_MEM_STUB 18 +#define DRM_MEM_SGLISTS 19 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) - /* Backward compatibility section */ - /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */ -#ifndef _PAGE_PWT -#define _PAGE_PWT _PAGE_WT -#endif - /* Mapping helper macros */ #define DRM_IOREMAP(map) \ (map)->handle = DRM(ioremap)( dev, map ) @@ -147,22 +127,12 @@ typedef struct drm_file drm_file_t; } while(0) -typedef struct drm_pci_list { - u16 vendor; - u16 device; -} drm_pci_list_t; - typedef struct drm_ioctl_desc { - d_ioctl_t *func; + int (*func)(DRM_IOCTL_ARGS); int auth_needed; int root_only; } drm_ioctl_desc_t; -typedef struct drm_devstate { - pid_t owner; /* X server pid holding x_lock */ - -} drm_devstate_t; - typedef struct drm_magic_entry { drm_magic_t magic; struct drm_file *priv; @@ -174,12 +144,6 @@ typedef struct drm_magic_head { struct drm_magic_entry *tail; } drm_magic_head_t; -typedef struct drm_vma_entry { - struct vm_area_struct *vma; - struct drm_vma_entry *next; - pid_t pid; -} drm_vma_entry_t; - typedef struct drm_buf { int idx; /* Index into master buflist */ int total; /* Buffer size */ @@ -189,12 +153,9 @@ typedef struct drm_buf { void *address; /* Address of buffer */ unsigned long bus_address; /* Bus address of buffer */ struct drm_buf *next; /* Kernel-only: used for free list */ - __volatile__ int waiting; /* On kernel DMA queue */ __volatile__ int pending; /* On hardware DMA queue */ - wait_queue_head_t dma_wait; /* Processes waiting */ - pid_t pid; /* PID of holding process */ + DRMFILE filp; /* Unique identifier of holding process */ int context; /* Kernel queue for this buffer */ - int while_locked;/* Dispatch this buffer while locked */ enum { DRM_LIST_NONE = 0, DRM_LIST_FREE = 1, @@ -204,39 +165,10 @@ typedef struct drm_buf { DRM_LIST_RECLAIM = 5 } list; /* Which list we're on */ -#if DRM_DMA_HISTOGRAM - cycles_t time_queued; /* Queued to kernel DMA queue */ - cycles_t time_dispatched; /* Dispatched to hardware */ - cycles_t time_completed; /* Completed by hardware */ - cycles_t time_freed; /* Back on freelist */ -#endif - int dev_priv_size; /* Size of buffer private stoarge */ void *dev_private; /* Per-buffer private storage */ } drm_buf_t; -#if DRM_DMA_HISTOGRAM -#define DRM_DMA_HISTOGRAM_SLOTS 9 -#define DRM_DMA_HISTOGRAM_INITIAL 10 -#define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10) -typedef struct drm_histogram { - atomic_t total; - - atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - - atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - - atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t lacq[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t lhld[DRM_DMA_HISTOGRAM_SLOTS]; -} drm_histogram_t; -#endif - /* bufs is one longer than it has to be */ typedef struct drm_waitlist { int count; /* Number of possible buffers */ @@ -253,10 +185,8 @@ typedef struct drm_freelist { atomic_t count; /* Number of free buffers */ drm_buf_t *next; /* End pointer */ - wait_queue_head_t waiting; /* Processes waiting on free bufs */ int low_mark; /* Low water mark */ int high_mark; /* High water mark */ - atomic_t wfh; /* If waiting for high mark */ DRM_SPINTYPE lock; } drm_freelist_t; @@ -289,48 +219,14 @@ struct drm_file { struct drm_device *devXX; }; -typedef struct drm_queue { - atomic_t use_count; /* Outstanding uses (+1) */ - atomic_t finalization; /* Finalization in progress */ - atomic_t block_count; /* Count of processes waiting */ - atomic_t block_read; /* Queue blocked for reads */ - wait_queue_head_t read_queue; /* Processes waiting on block_read */ - atomic_t block_write; /* Queue blocked for writes */ - wait_queue_head_t write_queue; /* Processes waiting on block_write */ -#if 1 - atomic_t total_queued; /* Total queued statistic */ - atomic_t total_flushed;/* Total flushes statistic */ - atomic_t total_locks; /* Total locks statistics */ -#endif - drm_ctx_flags_t flags; /* Context preserving and 2D-only */ - drm_waitlist_t waitlist; /* Pending buffers */ - wait_queue_head_t flush_queue; /* Processes waiting until flush */ -} drm_queue_t; - typedef struct drm_lock_data { drm_hw_lock_t *hw_lock; /* Hardware lock */ - pid_t pid; /* PID of lock holder (0=kernel) */ + DRMFILE filp; /* Unique identifier of holding process (NULL is kernel)*/ wait_queue_head_t lock_queue; /* Queue of blocked processes */ unsigned long lock_time; /* Time of last lock in jiffies */ } drm_lock_data_t; typedef struct drm_device_dma { -#if 0 - /* Performance Counters */ - atomic_t total_prio; /* Total DRM_DMA_PRIORITY */ - atomic_t total_bytes; /* Total bytes DMA'd */ - atomic_t total_dmas; /* Total DMA buffers dispatched */ - - atomic_t total_missed_dma; /* Missed drm_do_dma */ - atomic_t total_missed_lock; /* Missed lock in drm_do_dma */ - atomic_t total_missed_free; /* Missed drm_free_this_buffer */ - atomic_t total_missed_sched;/* Missed drm_dma_schedule */ - - atomic_t total_tried; /* Tried next_buffer */ - atomic_t total_hit; /* Sent next_buffer */ - atomic_t total_lost; /* Lost interrupt */ -#endif - drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; int buf_count; drm_buf_t **buflist; /* Vector of pointers info bufs */ @@ -346,8 +242,6 @@ typedef struct drm_device_dma { /* DMA support */ drm_buf_t *this_buffer; /* Buffer being sent */ drm_buf_t *next_buffer; /* Selected buffer to send */ - drm_queue_t *next_queue; /* Queue from which buffer selected*/ - wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; #if __REALLY_HAVE_AGP @@ -381,11 +275,6 @@ typedef struct drm_sg_mem { dma_addr_t *busaddr; } drm_sg_mem_t; -typedef struct drm_sigdata { - int context; - drm_hw_lock_t *lock; -} drm_sigdata_t; - typedef struct drm_local_map { unsigned long offset; /* Physical address (0 for SAREA)*/ unsigned long size; /* Physical size (bytes) */ @@ -424,21 +313,16 @@ struct drm_device { device_t device; /* Device instance from newbus */ #endif dev_t devnode; /* Device number for mknod */ - char *devname; /* For /proc/interrupts */ - int blocked; /* Blocked due to VC switch? */ int flags; /* Flags to open(2) */ - int writable; /* Opened with FWRITE */ /* Locks */ - DRM_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ + DRM_SPINTYPE count_lock; /* For open_count, buf_use, buf_alloc */ struct lock dev_lock; /* For others */ /* Usage Counters */ int open_count; /* Outstanding files open */ - atomic_t ioctl_count; /* Outstanding IOCTLs pending */ - atomic_t vma_count; /* Outstanding vma areas open */ int buf_use; /* Buffers in use -- cannot alloc */ - atomic_t buf_alloc; /* Buffer allocation in progress */ + int buf_alloc; /* Buffer allocation in progress */ /* Performance counters */ unsigned long counters; @@ -451,19 +335,13 @@ struct drm_device { /* Memory management */ drm_map_list_t *maplist; /* Linked list of regions */ - int map_count; /* Number of mappable regions */ drm_local_map_t **context_sareas; int max_context; - drm_vma_entry_t *vmalist; /* List of vmas (for debugging) */ drm_lock_data_t lock; /* Information on hardware lock */ /* DMA queues (contexts) */ - int queue_count; /* Number of active DMA queues */ - int queue_reserved; /* Number of reserved DMA queues */ - int queue_slots; /* Actual length of queuelist */ - drm_queue_t **queuelist; /* Vector of pointers to DMA queues */ drm_device_dma_t *dma; /* Optional pointer for DMA support */ /* Context support */ @@ -477,45 +355,25 @@ struct drm_device { #endif void *irqh; /* Handle from bus_setup_intr */ atomic_t context_flag; /* Context swapping flag */ - atomic_t interrupt_flag; /* Interruption handler flag */ - atomic_t dma_flag; /* DMA dispatch flag */ struct callout timer; /* Timer for delaying ctx switch */ - wait_queue_head_t context_wait; /* Processes waiting on ctx switch */ - int last_checked; /* Last context checked for DMA */ int last_context; /* Last current context */ - unsigned long last_switch; /* jiffies at last context switch */ #if __FreeBSD_version >= 400005 struct task task; #endif #if __HAVE_VBL_IRQ wait_queue_head_t vbl_queue; /* vbl wait channel */ atomic_t vbl_received; -#if 0 /* vbl signals are untested, ntested */ +#if 0 /* vbl signals are untested */ struct drm_vbl_sig_list vbl_sig_list; DRM_SPINTYPE vbl_lock; #endif #endif - cycles_t ctx_start; - cycles_t lck_start; -#if __HAVE_DMA_HISTOGRAM - drm_histogram_t histo; -#endif - /* Callback to X server for context switch - and for heavy-handed reset. */ - char buf[DRM_BSZ]; /* Output buffer */ - char *buf_rp; /* Read pointer */ - char *buf_wp; /* Write pointer */ - char *buf_end; /* End pointer */ #ifdef __FreeBSD__ struct sigio *buf_sigio; /* Processes waiting for SIGIO */ #elif defined(__NetBSD__) pid_t buf_pgid; #endif - struct selinfo buf_sel; /* Workspace for select/poll */ - int buf_selecting;/* True if poll sleeper */ - wait_queue_head_t buf_readers; /* Processes waiting to read */ - wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ /* Sysctl support */ struct drm_sysctl_info *sysctl; @@ -526,13 +384,9 @@ struct drm_device { drm_sg_mem_t *sg; /* Scatter gather memory */ atomic_t *ctx_bitmap; void *dev_private; - drm_sigdata_t sigdata; /* For block_all_signals */ - sigset_t sigmask; }; extern int DRM(flags); -extern void DRM(parse_options)( char *s ); -extern int DRM(cpu_valid)( void ); /* Authentication (drm_auth.h) */ extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, @@ -541,7 +395,6 @@ extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); /* Driver support (drm_drv.h) */ extern int DRM(version)( DRM_IOCTL_ARGS ); -extern int DRM(write_string)(drm_device_t *dev, const char *s); /* Memory management support (drm_memory.h) */ extern void DRM(mem_init)(void); @@ -582,11 +435,6 @@ extern int DRM(lock_transfer)(drm_device_t *dev, extern int DRM(lock_free)(drm_device_t *dev, __volatile__ unsigned int *lock, unsigned int context); -extern int DRM(flush_unblock)(drm_device_t *dev, int context, - drm_lock_flags_t flags); -extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context, - drm_lock_flags_t flags); -extern int DRM(notifier)(void *priv); /* Buffer management support (drm_bufs.h) */ extern int DRM(order)( unsigned long size ); @@ -596,16 +444,7 @@ extern int DRM(order)( unsigned long size ); extern int DRM(dma_setup)(drm_device_t *dev); extern void DRM(dma_takedown)(drm_device_t *dev); extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); -extern void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid); -#if __HAVE_OLD_DMA -/* GH: This is a dirty hack for now... - */ -extern void DRM(clear_next_buffer)(drm_device_t *dev); -extern int DRM(select_queue)(drm_device_t *dev, - void (*wrapper)(unsigned long)); -extern int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *dma); -extern int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma); -#endif +extern void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp); #if __HAVE_DMA_IRQ extern int DRM(irq_install)( drm_device_t *dev, int irq ); extern int DRM(irq_uninstall)( drm_device_t *dev ); @@ -617,10 +456,6 @@ extern void DRM(driver_irq_uninstall)( drm_device_t *dev ); extern void DRM(dma_immediate_bh)( DRM_TASKQUEUE_ARGS ); #endif #endif -#if DRM_DMA_HISTOGRAM -extern int DRM(histogram_slot)(unsigned long count); -extern void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf); -#endif /* Buffer list support (drm_lists.h) */ #if __HAVE_DMA_WAITLIST @@ -629,13 +464,6 @@ extern int DRM(waitlist_destroy)(drm_waitlist_t *bl); extern int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf); extern drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl); #endif -#if __HAVE_DMA_FREELIST -extern int DRM(freelist_create)(drm_freelist_t *bl, int count); -extern int DRM(freelist_destroy)(drm_freelist_t *bl); -extern int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, - drm_buf_t *buf); -extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); -#endif #endif /* __HAVE_DMA */ #if __HAVE_VBL_IRQ extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq); @@ -668,5 +496,75 @@ extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev, dma_addr_t bus_addr); #endif +/* Locking IOCTL support (drm_drv.h) */ +extern int DRM(lock)(DRM_IOCTL_ARGS); +extern int DRM(unlock)(DRM_IOCTL_ARGS); + +/* Misc. IOCTL support (drm_ioctl.h) */ +extern int DRM(irq_busid)(DRM_IOCTL_ARGS); +extern int DRM(getunique)(DRM_IOCTL_ARGS); +extern int DRM(setunique)(DRM_IOCTL_ARGS); +extern int DRM(getmap)(DRM_IOCTL_ARGS); +extern int DRM(getclient)(DRM_IOCTL_ARGS); +extern int DRM(getstats)(DRM_IOCTL_ARGS); +extern int DRM(noop)(DRM_IOCTL_ARGS); + +/* Context IOCTL support (drm_context.h) */ +extern int DRM(resctx)(DRM_IOCTL_ARGS); +extern int DRM(addctx)(DRM_IOCTL_ARGS); +extern int DRM(modctx)(DRM_IOCTL_ARGS); +extern int DRM(getctx)(DRM_IOCTL_ARGS); +extern int DRM(switchctx)(DRM_IOCTL_ARGS); +extern int DRM(newctx)(DRM_IOCTL_ARGS); +extern int DRM(rmctx)(DRM_IOCTL_ARGS); +extern int DRM(setsareactx)(DRM_IOCTL_ARGS); +extern int DRM(getsareactx)(DRM_IOCTL_ARGS); + +/* Drawable IOCTL support (drm_drawable.h) */ +extern int DRM(adddraw)(DRM_IOCTL_ARGS); +extern int DRM(rmdraw)(DRM_IOCTL_ARGS); + +/* Authentication IOCTL support (drm_auth.h) */ +extern int DRM(getmagic)(DRM_IOCTL_ARGS); +extern int DRM(authmagic)(DRM_IOCTL_ARGS); + +/* Buffer management support (drm_bufs.h) */ +extern int DRM(addmap)(DRM_IOCTL_ARGS); +extern int DRM(rmmap)(DRM_IOCTL_ARGS); +#if __HAVE_DMA +extern int DRM(addbufs)(DRM_IOCTL_ARGS); +extern int DRM(infobufs)(DRM_IOCTL_ARGS); +extern int DRM(markbufs)(DRM_IOCTL_ARGS); +extern int DRM(freebufs)(DRM_IOCTL_ARGS); +extern int DRM(mapbufs)(DRM_IOCTL_ARGS); +#endif + +/* DMA support (drm_dma.h) */ +#if __HAVE_DMA +extern int DRM(control)(DRM_IOCTL_ARGS); +#endif +#if __HAVE_VBL_IRQ +extern int DRM(wait_vblank)(DRM_IOCTL_ARGS); +#endif + +/* AGP/GART support (drm_agpsupport.h) */ +#if __REALLY_HAVE_AGP +extern int DRM(agp_acquire)(DRM_IOCTL_ARGS); +extern int DRM(agp_release)(DRM_IOCTL_ARGS); +extern int DRM(agp_enable)(DRM_IOCTL_ARGS); +extern int DRM(agp_info)(DRM_IOCTL_ARGS); +extern int DRM(agp_alloc)(DRM_IOCTL_ARGS); +extern int DRM(agp_free)(DRM_IOCTL_ARGS); +extern int DRM(agp_unbind)(DRM_IOCTL_ARGS); +extern int DRM(agp_bind)(DRM_IOCTL_ARGS); +#endif + +/* Scatter Gather Support (drm_scatter.h) */ +#if __HAVE_SG +extern int DRM(sg_alloc)(DRM_IOCTL_ARGS); +extern int DRM(sg_free)(DRM_IOCTL_ARGS); +#endif + + #endif /* __KERNEL__ */ #endif /* _DRM_P_H_ */ |