implement drm_core_check_feature and use it .. looks lots nicer
parent
7809efc8c3
commit
da6b448497
|
@ -683,6 +683,11 @@ typedef struct drm_device {
|
|||
u32 driver_features;
|
||||
} drm_device_t;
|
||||
|
||||
static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature)
|
||||
{
|
||||
return ((dev->driver_features & feature) ? 1 : 0);
|
||||
}
|
||||
|
||||
extern void DRM(driver_register_fns)(struct drm_device *dev);
|
||||
|
||||
/******************************************************************/
|
||||
|
|
|
@ -103,7 +103,7 @@ int DRM(initmap)( drm_device_t *dev, unsigned int offset, unsigned int size, int
|
|||
map->offset += dev->hose->mem_space->start;
|
||||
#endif
|
||||
#if __OS_HAS_MTRR
|
||||
if ( dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_MTRR) ) {
|
||||
if ( map->type == _DRM_FRAME_BUFFER ||
|
||||
(map->flags & _DRM_WRITE_COMBINING) ) {
|
||||
map->mtrr = mtrr_add( map->offset, map->size,
|
||||
|
@ -201,7 +201,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
|
|||
map->offset += dev->hose->mem_space->start;
|
||||
#endif
|
||||
#if __OS_HAS_MTRR
|
||||
if (dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_MTRR)) {
|
||||
if ( map->type == _DRM_FRAME_BUFFER ||
|
||||
(map->flags & _DRM_WRITE_COMBINING) ) {
|
||||
map->mtrr = mtrr_add( map->offset, map->size,
|
||||
|
@ -236,7 +236,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
|
|||
break;
|
||||
#if __OS_HAS_AGP
|
||||
case _DRM_AGP:
|
||||
if (dev->driver_features & DRIVER_USE_AGP) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
|
||||
#ifdef __alpha__
|
||||
map->offset += dev->hose->mem_space->start;
|
||||
#endif
|
||||
|
@ -611,7 +611,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
|
|||
drm_buf_t **temp_buflist;
|
||||
drm_buf_desc_t __user *argp = (void __user *)arg;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_PCI_DMA)) return -EINVAL;
|
||||
if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
||||
|
@ -841,7 +841,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
|
|||
int i;
|
||||
drm_buf_t **temp_buflist;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_SG)) return -EINVAL;
|
||||
if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ int DRM(addbufs)( struct inode *inode, struct file *filp,
|
|||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( copy_from_user( &request, (drm_buf_desc_t __user *)arg,
|
||||
|
@ -1053,7 +1053,7 @@ int DRM(infobufs)( struct inode *inode, struct file *filp,
|
|||
int i;
|
||||
int count;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1137,7 +1137,7 @@ int DRM(markbufs)( struct inode *inode, struct file *filp,
|
|||
int order;
|
||||
drm_buf_entry_t *entry;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1187,7 +1187,7 @@ int DRM(freebufs)( struct inode *inode, struct file *filp,
|
|||
int idx;
|
||||
drm_buf_t *buf;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1247,7 +1247,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
|
|||
drm_buf_map_t request;
|
||||
int i;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1264,8 +1264,8 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
|
|||
return -EFAULT;
|
||||
|
||||
if ( request.count >= dma->buf_count ) {
|
||||
if (( (dev->driver_features & DRIVER_USE_AGP) && (dma->flags & _DRM_DMA_USE_AGP)) ||
|
||||
( (dev->driver_features & DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) {
|
||||
if (( drm_core_check_feature(dev, DRIVER_USE_AGP) && (dma->flags & _DRM_DMA_USE_AGP)) ||
|
||||
( drm_core_check_feature(dev, DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) {
|
||||
drm_map_t *map = dev->agp_buffer_map;
|
||||
|
||||
if ( !map ) {
|
||||
|
|
|
@ -144,7 +144,7 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
|
|||
buf->filp = NULL;
|
||||
buf->used = 0;
|
||||
|
||||
if ( (dev->driver_features & DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) {
|
||||
wake_up_interruptible(&buf->dma_wait);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ static int DRM(setup)( drm_device_t *dev )
|
|||
dev->buf_use = 0;
|
||||
atomic_set( &dev->buf_alloc, 0 );
|
||||
|
||||
if (dev->driver_features & DRIVER_HAVE_DMA)
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
{
|
||||
i = DRM(dma_setup)( dev );
|
||||
if ( i < 0 )
|
||||
|
@ -349,7 +349,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
|
||||
#if __OS_HAS_AGP
|
||||
/* Clear AGP information */
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp ) {
|
||||
drm_agp_mem_t *entry;
|
||||
drm_agp_mem_t *nexte;
|
||||
|
||||
|
@ -400,7 +400,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
break;
|
||||
case _DRM_SCATTER_GATHER:
|
||||
/* Handle it */
|
||||
if (dev->driver_features & DRIVER_SG && dev->sg) {
|
||||
if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) {
|
||||
DRM(sg_cleanup)(dev->sg);
|
||||
dev->sg = NULL;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
}
|
||||
|
||||
|
||||
if ( (dev->driver_features & DRIVER_DMA_QUEUE) && dev->queuelist ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist ) {
|
||||
for ( i = 0 ; i < dev->queue_count ; i++ ) {
|
||||
|
||||
if ( dev->queuelist[i] ) {
|
||||
|
@ -431,7 +431,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
}
|
||||
dev->queue_count = 0;
|
||||
|
||||
if (dev->driver_features & DRIVER_HAVE_DMA)
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
DRM(dma_takedown)( dev );
|
||||
|
||||
if ( dev->lock.hw_lock ) {
|
||||
|
@ -510,16 +510,16 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
goto error_out_unreg;
|
||||
|
||||
#if __OS_HAS_AGP
|
||||
if (dev->driver_features & DRIVER_USE_AGP) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
|
||||
dev->agp = DRM(agp_init)();
|
||||
if ( (dev->driver_features & DRIVER_REQUIRE_AGP) && dev->agp == NULL ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) && dev->agp == NULL ) {
|
||||
DRM_ERROR( "Cannot initialize the agpgart module.\n" );
|
||||
retcode = -EINVAL;
|
||||
goto error_out_unreg;
|
||||
}
|
||||
|
||||
#if __OS_HAS_MTRR
|
||||
if (dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_MTRR)) {
|
||||
if (dev->agp)
|
||||
dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
|
||||
dev->agp->agp_info.aper_size*1024*1024,
|
||||
|
@ -682,7 +682,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
|
|||
|
||||
case _DRM_FRAME_BUFFER:
|
||||
#if __OS_HAS_MTRR
|
||||
if ( dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_MTRR)) {
|
||||
if ( map->mtrr >= 0 ) {
|
||||
int retcode;
|
||||
retcode = mtrr_del( map->mtrr,
|
||||
|
@ -722,7 +722,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
|
|||
|
||||
#if __OS_HAS_AGP
|
||||
#if __OS_HAS_MTRR
|
||||
if ( (dev->driver_features & DRIVER_USE_MTRR) && dev->agp && dev->agp->agp_mtrr >= 0 ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_MTRR) && dev->agp && dev->agp->agp_mtrr >= 0 ) {
|
||||
int retval;
|
||||
retval = mtrr_del( dev->agp->agp_mtrr,
|
||||
dev->agp->agp_info.aper_base,
|
||||
|
@ -730,7 +730,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
|
|||
DRM_DEBUG( "mtrr_del=%d\n", retval );
|
||||
}
|
||||
#endif
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp ) {
|
||||
DRM(agp_uninit)();
|
||||
DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
|
||||
dev->agp = NULL;
|
||||
|
@ -937,7 +937,7 @@ int DRM(release)( struct inode *inode, struct file *filp )
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->driver_features & DRIVER_HAVE_DMA)
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
{
|
||||
dev->fn_tbl.reclaim_buffers(filp);
|
||||
}
|
||||
|
@ -1100,7 +1100,7 @@ int DRM(lock)( struct inode *inode, struct file *filp,
|
|||
lock.context, current->pid,
|
||||
dev->lock.hw_lock->lock, lock.flags );
|
||||
|
||||
if (dev->driver_features & DRIVER_DMA_QUEUE)
|
||||
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
|
||||
if ( lock.context < 0 )
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int DRM(irq_by_busid)(struct inode *inode, struct file *filp,
|
|||
drm_irq_busid_t __user *argp = (void __user *)arg;
|
||||
drm_irq_busid_t p;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(&p, argp, sizeof(p)))
|
||||
|
@ -94,7 +94,7 @@ int DRM(irq_install)( drm_device_t *dev )
|
|||
int ret;
|
||||
unsigned long sh_flags=0;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ ))
|
||||
return -EINVAL;
|
||||
|
||||
if ( dev->irq == 0 )
|
||||
|
@ -121,7 +121,7 @@ int DRM(irq_install)( drm_device_t *dev )
|
|||
dev->dma->next_queue = NULL;
|
||||
dev->dma->this_buffer = NULL;
|
||||
|
||||
if (dev->driver_features & DRIVER_IRQ_VBL) {
|
||||
if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) {
|
||||
init_waitqueue_head(&dev->vbl_queue);
|
||||
|
||||
spin_lock_init( &dev->vbl_lock );
|
||||
|
@ -135,7 +135,7 @@ int DRM(irq_install)( drm_device_t *dev )
|
|||
dev->fn_tbl.irq_preinstall(dev);
|
||||
|
||||
/* Install handler */
|
||||
if (dev->driver_features & DRIVER_IRQ_SHARED)
|
||||
if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED))
|
||||
sh_flags = SA_SHIRQ;
|
||||
|
||||
ret = request_irq( dev->irq, dev->fn_tbl.irq_handler,
|
||||
|
@ -164,7 +164,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
|
|||
{
|
||||
int irq_enabled;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ ))
|
||||
return -EINVAL;
|
||||
|
||||
down( &dev->struct_sem );
|
||||
|
@ -209,14 +209,14 @@ int DRM(control)( struct inode *inode, struct file *filp,
|
|||
|
||||
switch ( ctl.func ) {
|
||||
case DRM_INST_HANDLER:
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return 0;
|
||||
if (dev->if_version < DRM_IF_VERSION(1, 2) &&
|
||||
ctl.irq != dev->irq)
|
||||
return -EINVAL;
|
||||
return DRM(irq_install)( dev );
|
||||
case DRM_UNINST_HANDLER:
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return 0;
|
||||
return DRM(irq_uninstall)( dev );
|
||||
default:
|
||||
|
@ -253,7 +253,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS )
|
|||
int ret = 0;
|
||||
unsigned int flags;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_IRQ_VBL))
|
||||
if (!drm_core_check_feature(dev, DRIVER_IRQ_VBL))
|
||||
return -EINVAL;
|
||||
|
||||
if (!dev->irq)
|
||||
|
|
|
@ -144,7 +144,7 @@ drm_follow_page (void *vaddr)
|
|||
static inline void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev)
|
||||
{
|
||||
#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
drm_map_t *map = drm_lookup_map(offset, size, dev);
|
||||
|
||||
if (map && map->type == _DRM_AGP)
|
||||
|
@ -159,7 +159,7 @@ static inline void *drm_ioremap_nocache(unsigned long offset, unsigned long size
|
|||
drm_device_t *dev)
|
||||
{
|
||||
#if __OS_HAS_AGP&& defined(VMAP_4_ARGS)
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
drm_map_t *map = drm_lookup_map(offset, size, dev);
|
||||
|
||||
if (map && map->type == _DRM_AGP)
|
||||
|
@ -178,7 +178,7 @@ static inline void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *d
|
|||
* routines for handling mappings in the AGP space. Hopefully this can be done in
|
||||
* a future revision of the interface...
|
||||
*/
|
||||
if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture
|
||||
&& ((unsigned long) pt >= VMALLOC_START && (unsigned long) pt < VMALLOC_END))
|
||||
{
|
||||
unsigned long offset;
|
||||
|
|
|
@ -73,7 +73,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
|||
|
||||
DRM_DEBUG( "%s\n", __FUNCTION__ );
|
||||
|
||||
if ( dev->driver_features & DRIVER_SG )
|
||||
if ( drm_core_check_feature(dev, DRIVER_SG ))
|
||||
return -EINVAL;
|
||||
|
||||
if ( dev->sg )
|
||||
|
@ -209,7 +209,7 @@ int DRM(sg_free)( struct inode *inode, struct file *filp,
|
|||
drm_scatter_gather_t request;
|
||||
drm_sg_mem_t *entry;
|
||||
|
||||
if ( dev->driver_features & DRIVER_SG )
|
||||
if ( drm_core_check_feature(dev, DRIVER_SG ))
|
||||
return -EINVAL;
|
||||
|
||||
if ( copy_from_user( &request,
|
||||
|
|
|
@ -206,7 +206,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
case _DRM_REGISTERS:
|
||||
case _DRM_FRAME_BUFFER:
|
||||
#if __OS_HAS_MTRR
|
||||
if ((dev->driver_features & DRIVER_USE_MTRR) && map->mtrr >= 0) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_MTRR) && map->mtrr >= 0) {
|
||||
int retcode;
|
||||
retcode = mtrr_del(map->mtrr,
|
||||
map->offset,
|
||||
|
@ -583,7 +583,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
|
|||
switch (map->type) {
|
||||
case _DRM_AGP:
|
||||
#if __OS_HAS_AGP
|
||||
if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp->cant_use_aperture) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp->cant_use_aperture) {
|
||||
/*
|
||||
* On some platforms we can't talk to bus dma address from the CPU, so for
|
||||
* memory of type DRM_AGP, we'll deal with sorting out the real physical
|
||||
|
|
|
@ -242,7 +242,7 @@ int i810_dma_cleanup(drm_device_t *dev)
|
|||
* may not have been called from userspace and after dev_private
|
||||
* is freed, it's too late.
|
||||
*/
|
||||
if ( (dev->driver_features & DRIVER_HAVE_IRQ) && dev->irq_enabled )
|
||||
if ( drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled )
|
||||
DRM(irq_uninstall)(dev);
|
||||
|
||||
if (dev->dev_private) {
|
||||
|
|
|
@ -683,6 +683,11 @@ typedef struct drm_device {
|
|||
u32 driver_features;
|
||||
} drm_device_t;
|
||||
|
||||
static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature)
|
||||
{
|
||||
return ((dev->driver_features & feature) ? 1 : 0);
|
||||
}
|
||||
|
||||
extern void DRM(driver_register_fns)(struct drm_device *dev);
|
||||
|
||||
/******************************************************************/
|
||||
|
|
|
@ -103,7 +103,7 @@ int DRM(initmap)( drm_device_t *dev, unsigned int offset, unsigned int size, int
|
|||
map->offset += dev->hose->mem_space->start;
|
||||
#endif
|
||||
#if __OS_HAS_MTRR
|
||||
if ( dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_MTRR) ) {
|
||||
if ( map->type == _DRM_FRAME_BUFFER ||
|
||||
(map->flags & _DRM_WRITE_COMBINING) ) {
|
||||
map->mtrr = mtrr_add( map->offset, map->size,
|
||||
|
@ -201,7 +201,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
|
|||
map->offset += dev->hose->mem_space->start;
|
||||
#endif
|
||||
#if __OS_HAS_MTRR
|
||||
if (dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_MTRR)) {
|
||||
if ( map->type == _DRM_FRAME_BUFFER ||
|
||||
(map->flags & _DRM_WRITE_COMBINING) ) {
|
||||
map->mtrr = mtrr_add( map->offset, map->size,
|
||||
|
@ -236,7 +236,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
|
|||
break;
|
||||
#if __OS_HAS_AGP
|
||||
case _DRM_AGP:
|
||||
if (dev->driver_features & DRIVER_USE_AGP) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
|
||||
#ifdef __alpha__
|
||||
map->offset += dev->hose->mem_space->start;
|
||||
#endif
|
||||
|
@ -611,7 +611,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
|
|||
drm_buf_t **temp_buflist;
|
||||
drm_buf_desc_t __user *argp = (void __user *)arg;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_PCI_DMA)) return -EINVAL;
|
||||
if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
||||
|
@ -841,7 +841,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
|
|||
int i;
|
||||
drm_buf_t **temp_buflist;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_SG)) return -EINVAL;
|
||||
if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ int DRM(addbufs)( struct inode *inode, struct file *filp,
|
|||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( copy_from_user( &request, (drm_buf_desc_t __user *)arg,
|
||||
|
@ -1053,7 +1053,7 @@ int DRM(infobufs)( struct inode *inode, struct file *filp,
|
|||
int i;
|
||||
int count;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1137,7 +1137,7 @@ int DRM(markbufs)( struct inode *inode, struct file *filp,
|
|||
int order;
|
||||
drm_buf_entry_t *entry;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1187,7 +1187,7 @@ int DRM(freebufs)( struct inode *inode, struct file *filp,
|
|||
int idx;
|
||||
drm_buf_t *buf;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1247,7 +1247,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
|
|||
drm_buf_map_t request;
|
||||
int i;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_DMA))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
return -EINVAL;
|
||||
|
||||
if ( !dma ) return -EINVAL;
|
||||
|
@ -1264,8 +1264,8 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
|
|||
return -EFAULT;
|
||||
|
||||
if ( request.count >= dma->buf_count ) {
|
||||
if (( (dev->driver_features & DRIVER_USE_AGP) && (dma->flags & _DRM_DMA_USE_AGP)) ||
|
||||
( (dev->driver_features & DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) {
|
||||
if (( drm_core_check_feature(dev, DRIVER_USE_AGP) && (dma->flags & _DRM_DMA_USE_AGP)) ||
|
||||
( drm_core_check_feature(dev, DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) {
|
||||
drm_map_t *map = dev->agp_buffer_map;
|
||||
|
||||
if ( !map ) {
|
||||
|
|
|
@ -144,7 +144,7 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
|
|||
buf->filp = NULL;
|
||||
buf->used = 0;
|
||||
|
||||
if ( (dev->driver_features & DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) {
|
||||
wake_up_interruptible(&buf->dma_wait);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ static int DRM(setup)( drm_device_t *dev )
|
|||
dev->buf_use = 0;
|
||||
atomic_set( &dev->buf_alloc, 0 );
|
||||
|
||||
if (dev->driver_features & DRIVER_HAVE_DMA)
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
{
|
||||
i = DRM(dma_setup)( dev );
|
||||
if ( i < 0 )
|
||||
|
@ -349,7 +349,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
|
||||
#if __OS_HAS_AGP
|
||||
/* Clear AGP information */
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp ) {
|
||||
drm_agp_mem_t *entry;
|
||||
drm_agp_mem_t *nexte;
|
||||
|
||||
|
@ -400,7 +400,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
break;
|
||||
case _DRM_SCATTER_GATHER:
|
||||
/* Handle it */
|
||||
if (dev->driver_features & DRIVER_SG && dev->sg) {
|
||||
if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) {
|
||||
DRM(sg_cleanup)(dev->sg);
|
||||
dev->sg = NULL;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
}
|
||||
|
||||
|
||||
if ( (dev->driver_features & DRIVER_DMA_QUEUE) && dev->queuelist ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist ) {
|
||||
for ( i = 0 ; i < dev->queue_count ; i++ ) {
|
||||
|
||||
if ( dev->queuelist[i] ) {
|
||||
|
@ -431,7 +431,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
}
|
||||
dev->queue_count = 0;
|
||||
|
||||
if (dev->driver_features & DRIVER_HAVE_DMA)
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
DRM(dma_takedown)( dev );
|
||||
|
||||
if ( dev->lock.hw_lock ) {
|
||||
|
@ -510,16 +510,16 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
goto error_out_unreg;
|
||||
|
||||
#if __OS_HAS_AGP
|
||||
if (dev->driver_features & DRIVER_USE_AGP) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
|
||||
dev->agp = DRM(agp_init)();
|
||||
if ( (dev->driver_features & DRIVER_REQUIRE_AGP) && dev->agp == NULL ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) && dev->agp == NULL ) {
|
||||
DRM_ERROR( "Cannot initialize the agpgart module.\n" );
|
||||
retcode = -EINVAL;
|
||||
goto error_out_unreg;
|
||||
}
|
||||
|
||||
#if __OS_HAS_MTRR
|
||||
if (dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_MTRR)) {
|
||||
if (dev->agp)
|
||||
dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
|
||||
dev->agp->agp_info.aper_size*1024*1024,
|
||||
|
@ -682,7 +682,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
|
|||
|
||||
case _DRM_FRAME_BUFFER:
|
||||
#if __OS_HAS_MTRR
|
||||
if ( dev->driver_features & DRIVER_USE_MTRR) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_MTRR)) {
|
||||
if ( map->mtrr >= 0 ) {
|
||||
int retcode;
|
||||
retcode = mtrr_del( map->mtrr,
|
||||
|
@ -722,7 +722,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
|
|||
|
||||
#if __OS_HAS_AGP
|
||||
#if __OS_HAS_MTRR
|
||||
if ( (dev->driver_features & DRIVER_USE_MTRR) && dev->agp && dev->agp->agp_mtrr >= 0 ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_MTRR) && dev->agp && dev->agp->agp_mtrr >= 0 ) {
|
||||
int retval;
|
||||
retval = mtrr_del( dev->agp->agp_mtrr,
|
||||
dev->agp->agp_info.aper_base,
|
||||
|
@ -730,7 +730,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
|
|||
DRM_DEBUG( "mtrr_del=%d\n", retval );
|
||||
}
|
||||
#endif
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp ) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp ) {
|
||||
DRM(agp_uninit)();
|
||||
DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
|
||||
dev->agp = NULL;
|
||||
|
@ -937,7 +937,7 @@ int DRM(release)( struct inode *inode, struct file *filp )
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->driver_features & DRIVER_HAVE_DMA)
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
{
|
||||
dev->fn_tbl.reclaim_buffers(filp);
|
||||
}
|
||||
|
@ -1100,7 +1100,7 @@ int DRM(lock)( struct inode *inode, struct file *filp,
|
|||
lock.context, current->pid,
|
||||
dev->lock.hw_lock->lock, lock.flags );
|
||||
|
||||
if (dev->driver_features & DRIVER_DMA_QUEUE)
|
||||
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
|
||||
if ( lock.context < 0 )
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int DRM(irq_by_busid)(struct inode *inode, struct file *filp,
|
|||
drm_irq_busid_t __user *argp = (void __user *)arg;
|
||||
drm_irq_busid_t p;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(&p, argp, sizeof(p)))
|
||||
|
@ -94,7 +94,7 @@ int DRM(irq_install)( drm_device_t *dev )
|
|||
int ret;
|
||||
unsigned long sh_flags=0;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ ))
|
||||
return -EINVAL;
|
||||
|
||||
if ( dev->irq == 0 )
|
||||
|
@ -121,7 +121,7 @@ int DRM(irq_install)( drm_device_t *dev )
|
|||
dev->dma->next_queue = NULL;
|
||||
dev->dma->this_buffer = NULL;
|
||||
|
||||
if (dev->driver_features & DRIVER_IRQ_VBL) {
|
||||
if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) {
|
||||
init_waitqueue_head(&dev->vbl_queue);
|
||||
|
||||
spin_lock_init( &dev->vbl_lock );
|
||||
|
@ -135,7 +135,7 @@ int DRM(irq_install)( drm_device_t *dev )
|
|||
dev->fn_tbl.irq_preinstall(dev);
|
||||
|
||||
/* Install handler */
|
||||
if (dev->driver_features & DRIVER_IRQ_SHARED)
|
||||
if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED))
|
||||
sh_flags = SA_SHIRQ;
|
||||
|
||||
ret = request_irq( dev->irq, dev->fn_tbl.irq_handler,
|
||||
|
@ -164,7 +164,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
|
|||
{
|
||||
int irq_enabled;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ ))
|
||||
return -EINVAL;
|
||||
|
||||
down( &dev->struct_sem );
|
||||
|
@ -209,14 +209,14 @@ int DRM(control)( struct inode *inode, struct file *filp,
|
|||
|
||||
switch ( ctl.func ) {
|
||||
case DRM_INST_HANDLER:
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return 0;
|
||||
if (dev->if_version < DRM_IF_VERSION(1, 2) &&
|
||||
ctl.irq != dev->irq)
|
||||
return -EINVAL;
|
||||
return DRM(irq_install)( dev );
|
||||
case DRM_UNINST_HANDLER:
|
||||
if (!(dev->driver_features & DRIVER_HAVE_IRQ))
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return 0;
|
||||
return DRM(irq_uninstall)( dev );
|
||||
default:
|
||||
|
@ -253,7 +253,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS )
|
|||
int ret = 0;
|
||||
unsigned int flags;
|
||||
|
||||
if (!(dev->driver_features & DRIVER_IRQ_VBL))
|
||||
if (!drm_core_check_feature(dev, DRIVER_IRQ_VBL))
|
||||
return -EINVAL;
|
||||
|
||||
if (!dev->irq)
|
||||
|
|
|
@ -144,7 +144,7 @@ drm_follow_page (void *vaddr)
|
|||
static inline void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev)
|
||||
{
|
||||
#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
drm_map_t *map = drm_lookup_map(offset, size, dev);
|
||||
|
||||
if (map && map->type == _DRM_AGP)
|
||||
|
@ -159,7 +159,7 @@ static inline void *drm_ioremap_nocache(unsigned long offset, unsigned long size
|
|||
drm_device_t *dev)
|
||||
{
|
||||
#if __OS_HAS_AGP&& defined(VMAP_4_ARGS)
|
||||
if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
if ( drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
|
||||
drm_map_t *map = drm_lookup_map(offset, size, dev);
|
||||
|
||||
if (map && map->type == _DRM_AGP)
|
||||
|
@ -178,7 +178,7 @@ static inline void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *d
|
|||
* routines for handling mappings in the AGP space. Hopefully this can be done in
|
||||
* a future revision of the interface...
|
||||
*/
|
||||
if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture
|
||||
&& ((unsigned long) pt >= VMALLOC_START && (unsigned long) pt < VMALLOC_END))
|
||||
{
|
||||
unsigned long offset;
|
||||
|
|
|
@ -73,7 +73,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
|||
|
||||
DRM_DEBUG( "%s\n", __FUNCTION__ );
|
||||
|
||||
if ( dev->driver_features & DRIVER_SG )
|
||||
if ( drm_core_check_feature(dev, DRIVER_SG ))
|
||||
return -EINVAL;
|
||||
|
||||
if ( dev->sg )
|
||||
|
@ -209,7 +209,7 @@ int DRM(sg_free)( struct inode *inode, struct file *filp,
|
|||
drm_scatter_gather_t request;
|
||||
drm_sg_mem_t *entry;
|
||||
|
||||
if ( dev->driver_features & DRIVER_SG )
|
||||
if ( drm_core_check_feature(dev, DRIVER_SG ))
|
||||
return -EINVAL;
|
||||
|
||||
if ( copy_from_user( &request,
|
||||
|
|
|
@ -206,7 +206,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
case _DRM_REGISTERS:
|
||||
case _DRM_FRAME_BUFFER:
|
||||
#if __OS_HAS_MTRR
|
||||
if ((dev->driver_features & DRIVER_USE_MTRR) && map->mtrr >= 0) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_MTRR) && map->mtrr >= 0) {
|
||||
int retcode;
|
||||
retcode = mtrr_del(map->mtrr,
|
||||
map->offset,
|
||||
|
@ -583,7 +583,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
|
|||
switch (map->type) {
|
||||
case _DRM_AGP:
|
||||
#if __OS_HAS_AGP
|
||||
if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp->cant_use_aperture) {
|
||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP) && dev->agp->cant_use_aperture) {
|
||||
/*
|
||||
* On some platforms we can't talk to bus dma address from the CPU, so for
|
||||
* memory of type DRM_AGP, we'll deal with sorting out the real physical
|
||||
|
|
|
@ -242,7 +242,7 @@ int i810_dma_cleanup(drm_device_t *dev)
|
|||
* may not have been called from userspace and after dev_private
|
||||
* is freed, it's too late.
|
||||
*/
|
||||
if ( (dev->driver_features & DRIVER_HAVE_IRQ) && dev->irq_enabled )
|
||||
if ( drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled )
|
||||
DRM(irq_uninstall)(dev);
|
||||
|
||||
if (dev->dev_private) {
|
||||
|
|
Loading…
Reference in New Issue