diff options
author | anholt <anholt@FreeBSD.org> | 2002-04-29 18:18:42 +0000 |
---|---|---|
committer | anholt <anholt@FreeBSD.org> | 2002-04-29 18:18:42 +0000 |
commit | f449944be8fd359010c95701a1a74b2685ea4467 (patch) | |
tree | 82f1baf5974fa0ac643272b9373e05eb7b3d67ef | |
parent | 38d2985e9b4d507e97a7aab9a2c08d5410b080b3 (diff) | |
download | FreeBSD-src-f449944be8fd359010c95701a1a74b2685ea4467.zip FreeBSD-src-f449944be8fd359010c95701a1a74b2685ea4467.tar.gz |
More diff reduction: Shuffle around some header code as was done in
drmcommand-0-0-1-branch of DRI CVS, more return code cleanup, and remove some
gratuitous ifdefs.
Approved by: des
-rw-r--r-- | sys/dev/drm/drm.h | 73 | ||||
-rw-r--r-- | sys/dev/drm/drmP.h | 95 | ||||
-rw-r--r-- | sys/dev/drm/drm_bufs.h | 46 | ||||
-rw-r--r-- | sys/dev/drm/drm_drv.h | 18 | ||||
-rw-r--r-- | sys/dev/drm/drm_fops.h | 1 | ||||
-rw-r--r-- | sys/dev/drm/drm_os_freebsd.h | 73 | ||||
-rw-r--r-- | sys/dev/drm/i810_drm.h | 12 | ||||
-rw-r--r-- | sys/dev/drm/mga_dma.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/mga_drm.h | 11 | ||||
-rw-r--r-- | sys/dev/drm/mga_drv.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/mga_state.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/mga_warp.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/r128_cce.c | 6 | ||||
-rw-r--r-- | sys/dev/drm/r128_drm.h | 18 | ||||
-rw-r--r-- | sys/dev/drm/r128_drv.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/r128_state.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/radeon_cp.c | 11 | ||||
-rw-r--r-- | sys/dev/drm/radeon_drm.h | 17 | ||||
-rw-r--r-- | sys/dev/drm/radeon_drv.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/radeon_state.c | 1 | ||||
-rw-r--r-- | sys/dev/drm/sis_drm.h | 10 |
21 files changed, 160 insertions, 239 deletions
diff --git a/sys/dev/drm/drm.h b/sys/dev/drm/drm.h index c0fa7af..5f33bb5 100644 --- a/sys/dev/drm/drm.h +++ b/sys/dev/drm/drm.h @@ -101,13 +101,6 @@ typedef struct drm_tex_region { unsigned int age; } drm_tex_region_t; -/* Seperate include files for the i810/mga/r128 specific structures */ -#include "dev/drm/mga_drm.h" -#include "dev/drm/i810_drm.h" -#include "dev/drm/r128_drm.h" -#include "dev/drm/radeon_drm.h" -#include "dev/drm/sis_drm.h" - typedef struct drm_version { int version_major; /* Major version */ int version_minor; /* Minor version */ @@ -428,70 +421,4 @@ typedef struct drm_scatter_gather { #define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) -/* MGA specific ioctls */ -#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) -#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) -#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) -#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) -#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) -#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) -#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) - -/* i810 specific ioctls */ -#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) -#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) -#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) -#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) -#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) -#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) -#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) -#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) -#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) - -/* Rage 128 specific ioctls */ -#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) -#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) -#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) -#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) -#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) -#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) -#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) -#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) -#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) -#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) -#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) -#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) -#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) - -/* Radeon specific ioctls */ -#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) -#define DRM_IOCTL_RADEON_CP_START DRM_IO( 0x41) -#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( 0x42, drm_radeon_cp_stop_t) -#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( 0x43) -#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_RADEON_RESET DRM_IO( 0x45) -#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t) -#define DRM_IOCTL_RADEON_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) -#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) -#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) -#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) -#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) -#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) - -/* SiS specific ioctls */ - -#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) -#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) -#define SIS_IOCTL_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) -#define SIS_IOCTL_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) -#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) -#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) -#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) -#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) - #endif diff --git a/sys/dev/drm/drmP.h b/sys/dev/drm/drmP.h index 00b0eb9..d84c8bd 100644 --- a/sys/dev/drm/drmP.h +++ b/sys/dev/drm/drmP.h @@ -116,12 +116,6 @@ typedef struct drm_file drm_file_t; #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)( (map)->offset, (map)->size ) @@ -145,9 +139,7 @@ typedef struct drm_file drm_file_t; (_map) = (_dev)->context_sareas[_ctx]; \ } while(0) -#ifdef __linux__ typedef int drm_ioctl_t( DRM_OS_IOCTL ); -#endif /* __linux__ */ typedef struct drm_pci_list { u16 vendor; @@ -155,12 +147,7 @@ typedef struct drm_pci_list { } drm_pci_list_t; typedef struct drm_ioctl_desc { -#ifdef __linux__ drm_ioctl_t *func; -#endif /* __linux__ */ -#ifdef __FreeBSD__ - d_ioctl_t *func; -#endif /* __FreeBSD__ */ int auth_needed; int root_only; } drm_ioctl_desc_t; @@ -455,17 +442,19 @@ struct drm_device { int flags; /* Flags to open(2) */ int writable; /* Opened with FWRITE */ #endif /* __FreeBSD__ */ +#ifdef __linux__ struct proc_dir_entry *root; /* Root for this device's entries */ +#endif /* __linux__ */ /* Locks */ + DRM_OS_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ #ifdef __linux__ - spinlock_t count_lock; /* For inuse, open_count, buf_use */ struct semaphore struct_sem; /* For others */ #endif /* __linux__ */ #ifdef __FreeBSD__ - DRM_OS_SPINTYPE count_lock; /* For inuse, open_count, buf_use */ struct lock dev_lock; /* For others */ #endif /* __FreeBSD__ */ + /* Usage Counters */ int open_count; /* Outstanding files open */ atomic_t ioctl_count; /* Outstanding IOCTLs pending */ @@ -578,18 +567,20 @@ struct drm_device { sigset_t sigmask; }; +/* ================================================================ + * Internal function definitions + */ + 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, - drm_magic_t magic); -extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); - /* Driver support (drm_drv.h) */ extern int DRM(version)( DRM_OS_IOCTL ); -extern int DRM(write_string)(drm_device_t *dev, const char *s); +extern int DRM(ioctl)( DRM_OS_IOCTL ); +extern int DRM(lock)( DRM_OS_IOCTL ); +extern int DRM(unlock)( DRM_OS_IOCTL ); +extern int DRM(write_string)(drm_device_t *dev, const char *s); /* Memory management support (drm_memory.h) */ extern void DRM(mem_init)(void); @@ -612,6 +603,23 @@ extern int DRM(bind_agp)(agp_memory *handle, unsigned int start); extern int DRM(unbind_agp)(agp_memory *handle); #endif + /* Misc. IOCTL support (drm_ioctl.h) */ +extern int DRM(irq_busid)( DRM_OS_IOCTL ); +extern int DRM(getunique)( DRM_OS_IOCTL ); +extern int DRM(setunique)( DRM_OS_IOCTL ); +extern int DRM(getmap)( DRM_OS_IOCTL ); +extern int DRM(getclient)( DRM_OS_IOCTL ); +extern int DRM(getstats)( DRM_OS_IOCTL ); + + /* Context IOCTL support (drm_context.h) */ +extern int DRM(resctx)( DRM_OS_IOCTL ); +extern int DRM(addctx)( DRM_OS_IOCTL ); +extern int DRM(modctx)( DRM_OS_IOCTL ); +extern int DRM(getctx)( DRM_OS_IOCTL ); +extern int DRM(switchctx)( DRM_OS_IOCTL ); +extern int DRM(newctx)( DRM_OS_IOCTL ); +extern int DRM(rmctx)( DRM_OS_IOCTL ); + extern int DRM(context_switch)(drm_device_t *dev, int old, int new); extern int DRM(context_switch_complete)(drm_device_t *dev, int new); @@ -622,7 +630,24 @@ extern void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ); extern int DRM(ctxbitmap_next)( drm_device_t *dev ); #endif +extern int DRM(setsareactx)( DRM_OS_IOCTL ); +extern int DRM(getsareactx)( DRM_OS_IOCTL ); + + /* Drawable IOCTL support (drm_drawable.h) */ +extern int DRM(adddraw)( DRM_OS_IOCTL ); +extern int DRM(rmdraw)( DRM_OS_IOCTL ); + + /* Authentication IOCTL support (drm_auth.h) */ +extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, + drm_magic_t magic); +extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); +extern int DRM(getmagic)( DRM_OS_IOCTL ); +extern int DRM(authmagic)( DRM_OS_IOCTL ); + /* Locking IOCTL support (drm_lock.h) */ +extern int DRM(block)( DRM_OS_IOCTL ); +extern int DRM(unblock)( DRM_OS_IOCTL ); +extern int DRM(finish)( DRM_OS_IOCTL ); extern int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context); extern int DRM(lock_transfer)(drm_device_t *dev, @@ -639,8 +664,17 @@ extern int DRM(notifier)(void *priv); /* Buffer management support (drm_bufs.h) */ extern int DRM(order)( unsigned long size ); +extern int DRM(addmap)( DRM_OS_IOCTL ); +extern int DRM(rmmap)( DRM_OS_IOCTL ); #if __HAVE_DMA +extern int DRM(addbufs)( DRM_OS_IOCTL ); +extern int DRM(infobufs)( DRM_OS_IOCTL ); +extern int DRM(markbufs)( DRM_OS_IOCTL ); +extern int DRM(freebufs)( DRM_OS_IOCTL ); +extern int DRM(mapbufs)( DRM_OS_IOCTL ); +extern int DRM(control)( DRM_OS_IOCTL ); + /* DMA support (drm_dma.h) */ extern int DRM(dma_setup)(drm_device_t *dev); extern void DRM(dma_takedown)(drm_device_t *dev); @@ -686,6 +720,14 @@ extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); #if __REALLY_HAVE_AGP /* AGP/GART support (drm_agpsupport.h) */ +extern int DRM(agp_acquire)( DRM_OS_IOCTL ); +extern int DRM(agp_release)( DRM_OS_IOCTL ); +extern int DRM(agp_enable)( DRM_OS_IOCTL ); +extern int DRM(agp_info)( DRM_OS_IOCTL ); +extern int DRM(agp_alloc)( DRM_OS_IOCTL ); +extern int DRM(agp_free)( DRM_OS_IOCTL ); +extern int DRM(agp_unbind)( DRM_OS_IOCTL ); +extern int DRM(agp_bind)( DRM_OS_IOCTL ); extern drm_agp_head_t *DRM(agp_init)(void); extern void DRM(agp_uninit)(void); extern void DRM(agp_do_release)(void); @@ -695,18 +737,11 @@ extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start); extern int DRM(agp_unbind_memory)(agp_memory *handle); #endif - /* Proc support (drm_proc.h) */ -extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, - int minor, - struct proc_dir_entry *root, - struct proc_dir_entry **dev_root); -extern int DRM(proc_cleanup)(int minor, - struct proc_dir_entry *root, - struct proc_dir_entry *dev_root); - #if __HAVE_SG /* Scatter Gather Support (drm_scatter.h) */ extern void DRM(sg_cleanup)(drm_sg_mem_t *entry); +extern int DRM(sg_alloc)( DRM_OS_IOCTL ); +extern int DRM(sg_free)( DRM_OS_IOCTL ); #endif #if __REALLY_HAVE_SG diff --git a/sys/dev/drm/drm_bufs.h b/sys/dev/drm/drm_bufs.h index 80308aa..1524e9d 100644 --- a/sys/dev/drm/drm_bufs.h +++ b/sys/dev/drm/drm_bufs.h @@ -65,6 +65,16 @@ #endif #endif +#if __REALLY_HAVE_AGP +int DRM(addbufs_agp)( DRM_OS_IOCTL ); +#endif +#if __HAVE_PCI_DMA +int DRM(addbufs_pci)( DRM_OS_IOCTL ); +#endif +#if __REALLY_HAVE_SG +int DRM(addbufs_sg)( DRM_OS_IOCTL ); +#endif + /* * Compute order. Can be made faster. */ @@ -136,21 +146,6 @@ int DRM(addmap)( DRM_OS_IOCTL ) map->mtrr = -1; map->handle = 0; -#ifdef __FreeBSD__ - TAILQ_FOREACH(list, dev->maplist, link) { - drm_map_t *entry = list->map; - if ( (entry->offset >= map->offset - && (entry->offset) < (map->offset + map->size) ) - || ((entry->offset + entry->size) >= map->offset - && (entry->offset + entry->size) < (map->offset + map->size) ) - || ((entry->offset < map->offset) - && (entry->offset + entry->size) >= (map->offset + map->size) ) ) - DRM_DEBUG("map collission: add(0x%lx-0x%lx), current(0x%lx-0x%lx)\n", - entry->offset, entry->offset + entry->size - 1, - map->offset, map->offset + map->size - 1); - } -#endif /* __FreeBSD__ */ - switch ( map->type ) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: @@ -973,31 +968,16 @@ int DRM(addbufs)( DRM_OS_IOCTL ) #if __REALLY_HAVE_AGP if ( request.flags & _DRM_AGP_BUFFER ) -#ifdef __linux__ - return DRM(addbufs_agp)( inode, filp, cmd, data ); -#endif /* __linux__ */ -#ifdef __FreeBSD__ - return DRM(addbufs_agp)( kdev, cmd, data, flags, p ); -#endif /* __FreeBSD__ */ + return DRM(addbufs_agp)( IOCTL_ARGS_PASS ); else #endif #if __REALLY_HAVE_SG if ( request.flags & _DRM_SG_BUFFER ) -#ifdef __linux__ - return DRM(addbufs_sg)( inode, filp, cmd, data ); -#endif /* __linux__ */ -#ifdef __FreeBSD__ - return DRM(addbufs_sg)( kdev, cmd, data, flags, p ); -#endif /* __FreeBSD__ */ + return DRM(addbufs_sg)( IOCTL_ARGS_PASS ); else #endif #if __HAVE_PCI_DMA -#ifdef __linux__ - return DRM(addbufs_pci)( inode, filp, cmd, data ); -#endif /* __linux__ */ -#ifdef __FreeBSD__ - return DRM(addbufs_pci)( kdev, cmd, data, flags, p ); -#endif /* __FreeBSD__ */ + return DRM(addbufs_pci)( IOCTL_ARGS_PASS ); #else return DRM_OS_ERR(EINVAL); #endif diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index 5381f8f..9524499 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -1176,12 +1176,7 @@ int DRM(ioctl)( DRM_OS_IOCTL ) DRM_OS_DEVICE; int retcode = 0; drm_ioctl_desc_t *ioctl; -#ifdef __linux__ drm_ioctl_t *func; -#endif /* __linux__ */ -#ifdef __FreeBSD__ - d_ioctl_t *func; -#endif /* __FreeBSD__ */ int nr = DRM_IOCTL_NR(cmd); DRM_OS_PRIV; @@ -1227,12 +1222,7 @@ int DRM(ioctl)( DRM_OS_IOCTL ) || ( ioctl->auth_needed && !priv->authenticated ) ) { retcode = DRM_OS_ERR(EACCES); } else { -#ifdef __linux__ - retcode = func( inode, filp, cmd, data ); -#endif /* __linux__ */ -#ifdef __FreeBSD__ - retcode = func( kdev, cmd, data, flags, p ); -#endif /* __FreeBSD__ */ + retcode = func( IOCTL_ARGS_PASS ); } } @@ -1291,7 +1281,7 @@ int DRM(lock)( DRM_OS_IOCTL ) #endif /* __linux__ */ if ( !dev->lock.hw_lock ) { /* Device has been unregistered */ - ret = EINTR; + ret = DRM_OS_ERR(EINTR); break; } if ( DRM(lock_take)( &dev->lock.hw_lock->lock, @@ -1306,7 +1296,7 @@ int DRM(lock)( DRM_OS_IOCTL ) #ifdef __linux__ schedule(); if ( signal_pending( current ) ) { - ret = ERESTARTSYS; + ret = DRM_OS_ERR(ERESTARTSYS); break; } #endif /* __linux__ */ @@ -1366,7 +1356,7 @@ int DRM(lock)( DRM_OS_IOCTL ) atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]); #endif - return DRM_OS_ERR(ret); + return ret; } diff --git a/sys/dev/drm/drm_fops.h b/sys/dev/drm/drm_fops.h index 0ee345b..2a38773 100644 --- a/sys/dev/drm/drm_fops.h +++ b/sys/dev/drm/drm_fops.h @@ -117,7 +117,6 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p, up(&dev->struct_sem); #endif /* __linux__ */ #ifdef __FreeBSD__ - /* FIXME: linux mallocs and bzeros here */ priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); if (priv) { priv->refs++; diff --git a/sys/dev/drm/drm_os_freebsd.h b/sys/dev/drm/drm_os_freebsd.h index cbe715a..491c5c0 100644 --- a/sys/dev/drm/drm_os_freebsd.h +++ b/sys/dev/drm/drm_os_freebsd.h @@ -75,6 +75,7 @@ #endif #define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_OS_STRUCTPROC *p +#define IOCTL_ARGS_PASS kdev, cmd, data, flags, p #define DRM_OS_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, DRM_OS_CURPROC) #define DRM_OS_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, DRM_OS_CURPROC) #define DRM_OS_CHECKSUSER suser(p) @@ -291,9 +292,6 @@ find_first_zero_bit(volatile unsigned long *p, int max) /* Internal functions */ /* drm_drv.h */ -extern d_ioctl_t DRM(ioctl); -extern d_ioctl_t DRM(lock); -extern d_ioctl_t DRM(unlock); extern d_open_t DRM(open); extern d_close_t DRM(close); extern d_read_t DRM(read); @@ -305,78 +303,9 @@ extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_OS_STRUCTPROC *p); -/* Misc. IOCTL support (drm_ioctl.h) */ -extern d_ioctl_t DRM(irq_busid); -extern d_ioctl_t DRM(getunique); -extern d_ioctl_t DRM(setunique); -extern d_ioctl_t DRM(getmap); -extern d_ioctl_t DRM(getclient); -extern d_ioctl_t DRM(getstats); - -/* Context IOCTL support (drm_context.h) */ -extern d_ioctl_t DRM(resctx); -extern d_ioctl_t DRM(addctx); -extern d_ioctl_t DRM(modctx); -extern d_ioctl_t DRM(getctx); -extern d_ioctl_t DRM(switchctx); -extern d_ioctl_t DRM(newctx); -extern d_ioctl_t DRM(rmctx); -extern d_ioctl_t DRM(setsareactx); -extern d_ioctl_t DRM(getsareactx); - -/* Drawable IOCTL support (drm_drawable.h) */ -extern d_ioctl_t DRM(adddraw); -extern d_ioctl_t DRM(rmdraw); - -/* Authentication IOCTL support (drm_auth.h) */ -extern d_ioctl_t DRM(getmagic); -extern d_ioctl_t DRM(authmagic); - -/* Locking IOCTL support (drm_lock.h) */ -extern d_ioctl_t DRM(block); -extern d_ioctl_t DRM(unblock); -extern d_ioctl_t DRM(finish); - -/* Buffer management support (drm_bufs.h) */ -extern d_ioctl_t DRM(addmap); -extern d_ioctl_t DRM(rmmap); -#if __HAVE_DMA -extern d_ioctl_t DRM(addbufs_agp); -extern d_ioctl_t DRM(addbufs_pci); -extern d_ioctl_t DRM(addbufs_sg); -extern d_ioctl_t DRM(addbufs); -extern d_ioctl_t DRM(infobufs); -extern d_ioctl_t DRM(markbufs); -extern d_ioctl_t DRM(freebufs); -extern d_ioctl_t DRM(mapbufs); -#endif - /* Memory management support (drm_memory.h) */ extern int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS; -/* DMA support (drm_dma.h) */ -#if __HAVE_DMA_IRQ -extern d_ioctl_t DRM(control); -#endif - -/* AGP/GART support (drm_agpsupport.h) */ -#if __REALLY_HAVE_AGP -extern d_ioctl_t DRM(agp_acquire); -extern d_ioctl_t DRM(agp_release); -extern d_ioctl_t DRM(agp_enable); -extern d_ioctl_t DRM(agp_info); -extern d_ioctl_t DRM(agp_alloc); -extern d_ioctl_t DRM(agp_free); -extern d_ioctl_t DRM(agp_unbind); -extern d_ioctl_t DRM(agp_bind); -#endif - -/* Scatter Gather Support (drm_scatter.h) */ -#if __HAVE_SG -extern d_ioctl_t DRM(sg_alloc); -extern d_ioctl_t DRM(sg_free); -#endif - /* SysCtl Support (drm_sysctl.h) */ extern int DRM(sysctl_init)(drm_device_t *dev); extern int DRM(sysctl_cleanup)(drm_device_t *dev); diff --git a/sys/dev/drm/i810_drm.h b/sys/dev/drm/i810_drm.h index 4a26b74..9f404c8 100644 --- a/sys/dev/drm/i810_drm.h +++ b/sys/dev/drm/i810_drm.h @@ -168,6 +168,17 @@ typedef struct _drm_i810_sarea { } drm_i810_sarea_t; +/* i810 specific ioctls */ +#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) +#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) +#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) +#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) +#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) +#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) +#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) +#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) +#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) + typedef struct _drm_i810_clear { int clear_color; int clear_depth; @@ -175,7 +186,6 @@ typedef struct _drm_i810_clear { } drm_i810_clear_t; - /* These may be placeholders if we have more cliprects than * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to * false, indicating that the buffer will be dispatched again with a diff --git a/sys/dev/drm/mga_dma.c b/sys/dev/drm/mga_dma.c index 7dab88c..83bbfe9 100644 --- a/sys/dev/drm/mga_dma.c +++ b/sys/dev/drm/mga_dma.c @@ -38,6 +38,7 @@ #define __NO_VERSION__ #include "dev/drm/mga.h" #include "dev/drm/drmP.h" +#include "dev/drm/mga_drm.h" #include "dev/drm/mga_drv.h" #ifdef __linux__ diff --git a/sys/dev/drm/mga_drm.h b/sys/dev/drm/mga_drm.h index 25bb66a..50dc398 100644 --- a/sys/dev/drm/mga_drm.h +++ b/sys/dev/drm/mga_drm.h @@ -223,6 +223,17 @@ typedef struct _drm_mga_sarea { int ctxOwner; } drm_mga_sarea_t; +/* MGA specific ioctls */ +#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) +#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) +#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) +#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) +#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) +#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) +#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) + /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmMga.h) diff --git a/sys/dev/drm/mga_drv.c b/sys/dev/drm/mga_drv.c index d781f6e..98a3567 100644 --- a/sys/dev/drm/mga_drv.c +++ b/sys/dev/drm/mga_drv.c @@ -43,6 +43,7 @@ #include "dev/drm/mga.h" #include "dev/drm/drmP.h" +#include "dev/drm/mga_drm.h" #include "dev/drm/mga_drv.h" #define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." diff --git a/sys/dev/drm/mga_state.c b/sys/dev/drm/mga_state.c index 8f468a0..2d6454a 100644 --- a/sys/dev/drm/mga_state.c +++ b/sys/dev/drm/mga_state.c @@ -37,6 +37,7 @@ #define __NO_VERSION__ #include "dev/drm/mga.h" #include "dev/drm/drmP.h" +#include "dev/drm/mga_drm.h" #include "dev/drm/mga_drv.h" #include "dev/drm/drm.h" diff --git a/sys/dev/drm/mga_warp.c b/sys/dev/drm/mga_warp.c index a9830b4..7e94b6a 100644 --- a/sys/dev/drm/mga_warp.c +++ b/sys/dev/drm/mga_warp.c @@ -32,6 +32,7 @@ #define __NO_VERSION__ #include "dev/drm/mga.h" #include "dev/drm/drmP.h" +#include "dev/drm/mga_drm.h" #include "dev/drm/mga_drv.h" #include "dev/drm/mga_ucode.h" diff --git a/sys/dev/drm/r128_cce.c b/sys/dev/drm/r128_cce.c index aba0294..50e44eb 100644 --- a/sys/dev/drm/r128_cce.c +++ b/sys/dev/drm/r128_cce.c @@ -33,6 +33,7 @@ #define __NO_VERSION__ #include "dev/drm/r128.h" #include "dev/drm/drmP.h" +#include "dev/drm/r128_drm.h" #include "dev/drm/r128_drv.h" #ifdef __linux__ @@ -163,12 +164,7 @@ int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) int i, ret; ret = r128_do_wait_for_fifo( dev_priv, 64 ); -#ifdef __linux__ - if ( ret < 0 ) return ret; -#endif /* __linux__ */ -#ifdef __FreeBSD__ if ( ret ) return ret; -#endif /* __FreeBSD__ */ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { diff --git a/sys/dev/drm/r128_drm.h b/sys/dev/drm/r128_drm.h index 9f50635..dc53ea0 100644 --- a/sys/dev/drm/r128_drm.h +++ b/sys/dev/drm/r128_drm.h @@ -172,6 +172,24 @@ typedef struct drm_r128_sarea { /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmR128.h) */ + +/* Rage 128 specific ioctls */ +#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) +#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) +#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) +#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) +#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) +#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) +#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) +#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) +#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) +#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) +#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) +#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) + typedef struct drm_r128_init { enum { R128_INIT_CCE = 0x01, diff --git a/sys/dev/drm/r128_drv.c b/sys/dev/drm/r128_drv.c index f79237f..9361d0b 100644 --- a/sys/dev/drm/r128_drv.c +++ b/sys/dev/drm/r128_drv.c @@ -43,6 +43,7 @@ #include "dev/drm/r128.h" #include "dev/drm/drmP.h" +#include "dev/drm/r128_drm.h" #include "dev/drm/r128_drv.h" #if __REALLY_HAVE_SG #include "ati_pcigart.h" diff --git a/sys/dev/drm/r128_state.c b/sys/dev/drm/r128_state.c index 762bb3a..ac086be 100644 --- a/sys/dev/drm/r128_state.c +++ b/sys/dev/drm/r128_state.c @@ -36,6 +36,7 @@ #include "dev/drm/r128.h" #include "dev/drm/drmP.h" +#include "dev/drm/r128_drm.h" #include "dev/drm/r128_drv.h" #include "dev/drm/drm.h" diff --git a/sys/dev/drm/radeon_cp.c b/sys/dev/drm/radeon_cp.c index 821d8e4..f5b72ca 100644 --- a/sys/dev/drm/radeon_cp.c +++ b/sys/dev/drm/radeon_cp.c @@ -32,6 +32,7 @@ #include "dev/drm/radeon.h" #include "dev/drm/drmP.h" +#include "dev/drm/radeon_drm.h" #include "dev/drm/radeon_drv.h" #ifdef __linux__ @@ -398,12 +399,7 @@ static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) int i, ret; ret = radeon_do_wait_for_fifo( dev_priv, 64 ); -#ifdef __linux__ - if ( ret < 0 ) return ret; -#endif /* __linux__ */ -#ifdef __FreeBSD__ if ( ret ) return ret; -#endif /* __FreeBSD__ */ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { if ( !(RADEON_READ( RADEON_RBBM_STATUS ) & RADEON_RBBM_ACTIVE) ) { @@ -1110,12 +1106,7 @@ int radeon_cp_stop( DRM_OS_IOCTL ) */ if ( stop.idle ) { ret = radeon_do_cp_idle( dev_priv ); -#ifdef __linux__ - if ( ret < 0 ) return ret; -#endif /* __linux__ */ -#ifdef __FreeBSD__ if ( ret ) return ret; -#endif /* __FreeBSD__ */ } /* Finally, we can turn off the CP. If the engine isn't idle, diff --git a/sys/dev/drm/radeon_drm.h b/sys/dev/drm/radeon_drm.h index 698b9a2..14b64e5 100644 --- a/sys/dev/drm/radeon_drm.h +++ b/sys/dev/drm/radeon_drm.h @@ -233,6 +233,23 @@ typedef struct { /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmRadeon.h) */ + +/* Radeon specific ioctls */ +#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) +#define DRM_IOCTL_RADEON_CP_START DRM_IO( 0x41) +#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( 0x42, drm_radeon_cp_stop_t) +#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( 0x43) +#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_RADEON_RESET DRM_IO( 0x45) +#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t) +#define DRM_IOCTL_RADEON_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) +#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) +#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) +#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) +#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) +#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) + typedef struct drm_radeon_init { enum { RADEON_INIT_CP = 0x01, diff --git a/sys/dev/drm/radeon_drv.c b/sys/dev/drm/radeon_drv.c index 15a5563..25f6f2f 100644 --- a/sys/dev/drm/radeon_drv.c +++ b/sys/dev/drm/radeon_drv.c @@ -42,6 +42,7 @@ #include "dev/drm/radeon.h" #include "dev/drm/drmP.h" +#include "dev/drm/radeon_drm.h" #include "dev/drm/radeon_drv.h" #if __REALLY_HAVE_SG #include "ati_pcigart.h" diff --git a/sys/dev/drm/radeon_state.c b/sys/dev/drm/radeon_state.c index f1ac9ed..0b2a1cb 100644 --- a/sys/dev/drm/radeon_state.c +++ b/sys/dev/drm/radeon_state.c @@ -35,6 +35,7 @@ #endif /* __linux__ */ #include "dev/drm/radeon.h" #include "dev/drm/drmP.h" +#include "dev/drm/radeon_drm.h" #include "dev/drm/radeon_drv.h" #include "dev/drm/drm.h" diff --git a/sys/dev/drm/sis_drm.h b/sys/dev/drm/sis_drm.h index dad43bc..76a3ba3 100644 --- a/sys/dev/drm/sis_drm.h +++ b/sys/dev/drm/sis_drm.h @@ -5,6 +5,16 @@ #ifndef _sis_drm_public_h_ #define _sis_drm_public_h_ +/* SiS specific ioctls */ +#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) +#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) +#define SIS_IOCTL_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) +#define SIS_IOCTL_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) +#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) +#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) +#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) +#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) + typedef struct { int context; unsigned int offset; |