diff options
author | Dave Airlie <airlied@linux.ie> | 2004-08-10 11:03:40 +0000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2004-08-10 11:03:40 +0000 |
commit | eaf62674bea31156c892643906a7822801385856 (patch) | |
tree | f542e2df8396d4bb6f303760a392d9343c3da439 | |
parent | e19873654926c7717fbd0929a8164658a33e4519 (diff) |
remove HAVE_DMA_FREELIST
-rw-r--r-- | linux-core/drmP.h | 8 | ||||
-rw-r--r-- | linux-core/drm_bufs.c | 57 | ||||
-rw-r--r-- | linux-core/drm_dma.c | 23 | ||||
-rw-r--r-- | linux/drmP.h | 8 | ||||
-rw-r--r-- | linux/drm_bufs.h | 57 | ||||
-rw-r--r-- | linux/drm_dma.h | 23 | ||||
-rw-r--r-- | linux/gamma.h | 2 | ||||
-rw-r--r-- | linux/gamma_dma.c | 3 |
8 files changed, 93 insertions, 88 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 95a79c8e..d50bb2d9 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -105,9 +105,6 @@ #ifndef __HAVE_IRQ #define __HAVE_IRQ 0 #endif -#ifndef __HAVE_DMA_FREELIST -#define __HAVE_DMA_FREELIST 0 -#endif #define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ defined(CONFIG_AGP_MODULE))) @@ -590,7 +587,10 @@ struct drm_driver_fn { int (*kernel_context_switch)(struct drm_device *dev, int old, int new); int (*kernel_context_switch_unlock)(struct drm_device *dev); int (*dma_schedule)(struct drm_device *dev, int locked); - int (*waitlist_destroy)(drm_waitlist_t *bl); + int (*waitlist_destroy)(drm_waitlist_t *bl); + int (*freelist_create)(drm_freelist_t *bl, int count); + int (*freelist_put)(struct drm_device *dev, drm_freelist_t *bl, drm_buf_t *buf); + int (*freelist_destroy)(drm_freelist_t *bl); }; /** * DRM device structure. diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c index 3c0d5717..d3d0b83c 100644 --- a/linux-core/drm_bufs.c +++ b/linux-core/drm_bufs.c @@ -304,7 +304,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, * * Frees any pages and buffers associated with the given entry. */ -static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) +static void DRM(cleanup_buf_error)(drm_device_t *dev, drm_buf_entry_t *entry) { int i; @@ -337,9 +337,8 @@ static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) sizeof(*entry->buflist), DRM_MEM_BUFS); -#if __HAVE_DMA_FREELIST - DRM(freelist_destroy)(&entry->freelist); -#endif + if (dev->fn_tbl.freelist_destroy) + dev->fn_tbl.freelist_destroy(&entry->freelist); entry->buf_count = 0; } @@ -468,7 +467,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, if(!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -492,7 +491,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, DRM_MEM_BUFS ); if(!temp_buflist) { /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -509,12 +508,14 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); -#if __HAVE_DMA_FREELIST - DRM(freelist_create)( &entry->freelist, entry->buf_count ); - for ( i = 0 ; i < entry->buf_count ; i++ ) { - DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + if (dev->fn_tbl.freelist_create) + { + dev->fn_tbl.freelist_create( &entry->freelist, entry->buf_count); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dev->fn_tbl.freelist_put( dev, &entry->freelist, &entry->buflist[i] ); + } } -#endif + up( &dev->struct_sem ); request.count = entry->buf_count; @@ -653,7 +654,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); DRM(free)( temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), @@ -694,7 +695,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); DRM(free)( temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), @@ -718,7 +719,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, DRM_MEM_BUFS ); if (!temp_buflist) { /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); DRM(free)( temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), @@ -748,12 +749,14 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, dma->page_count += entry->seg_count << page_order; dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); -#if __HAVE_DMA_FREELIST - DRM(freelist_create)( &entry->freelist, entry->buf_count ); - for ( i = 0 ; i < entry->buf_count ; i++ ) { - DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + if (dev->fn_tbl.freelist_create) + { + dev->fn_tbl.freelist_create( &entry->freelist, entry->buf_count); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dev->fn_tbl.freelist_put( dev, &entry->freelist, &entry->buflist[i] ); + } } -#endif + up( &dev->struct_sem ); request.count = entry->buf_count; @@ -877,7 +880,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, if(!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -902,7 +905,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, DRM_MEM_BUFS ); if(!temp_buflist) { /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -919,12 +922,14 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); -#if __HAVE_DMA_FREELIST - DRM(freelist_create)( &entry->freelist, entry->buf_count ); - for ( i = 0 ; i < entry->buf_count ; i++ ) { - DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + if (dev->fn_tbl.freelist_create) + { + dev->fn_tbl.freelist_create( &entry->freelist, entry->buf_count); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dev->fn_tbl.freelist_put( dev, &entry->freelist, &entry->buflist[i] ); + } } -#endif + up( &dev->struct_sem ); request.count = entry->buf_count; diff --git a/linux-core/drm_dma.c b/linux-core/drm_dma.c index 04467342..811d768d 100644 --- a/linux-core/drm_dma.c +++ b/linux-core/drm_dma.c @@ -117,9 +117,9 @@ void DRM(dma_takedown)(drm_device_t *dev) dma->bufs[i].buf_count * sizeof(*dma->bufs[0].buflist), DRM_MEM_BUFS); -#if __HAVE_DMA_FREELIST - DRM(freelist_destroy)(&dma->bufs[i].freelist); -#endif + + if (dev->fn_tbl.freelist_destroy) + dev->fn_tbl.freelist_destroy(&dma->bufs[i].freelist); } } @@ -159,16 +159,13 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) if ( __HAVE_DMA_WAITQUEUE && waitqueue_active(&buf->dma_wait)) { wake_up_interruptible(&buf->dma_wait); } -#if __HAVE_DMA_FREELIST - else { - drm_device_dma_t *dma = dev->dma; - /* If processes are waiting, the last one - to wake will put the buffer on the free - list. If no processes are waiting, we - put the buffer on the freelist here. */ - DRM(freelist_put)(dev, &dma->bufs[buf->order].freelist, buf); - } -#endif + /* If processes are waiting, the last one + to wake will put the buffer on the free + list. If no processes are waiting, we + put the buffer on the freelist here. */ + else if (dev->fn_tbl.freelist_put) + dev->fn_tbl.freelist_put(dev, &dev->dma->bufs[buf->order].freelist, buf); + } #if !__HAVE_DMA_RECLAIM diff --git a/linux/drmP.h b/linux/drmP.h index 95a79c8e..d50bb2d9 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -105,9 +105,6 @@ #ifndef __HAVE_IRQ #define __HAVE_IRQ 0 #endif -#ifndef __HAVE_DMA_FREELIST -#define __HAVE_DMA_FREELIST 0 -#endif #define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ defined(CONFIG_AGP_MODULE))) @@ -590,7 +587,10 @@ struct drm_driver_fn { int (*kernel_context_switch)(struct drm_device *dev, int old, int new); int (*kernel_context_switch_unlock)(struct drm_device *dev); int (*dma_schedule)(struct drm_device *dev, int locked); - int (*waitlist_destroy)(drm_waitlist_t *bl); + int (*waitlist_destroy)(drm_waitlist_t *bl); + int (*freelist_create)(drm_freelist_t *bl, int count); + int (*freelist_put)(struct drm_device *dev, drm_freelist_t *bl, drm_buf_t *buf); + int (*freelist_destroy)(drm_freelist_t *bl); }; /** * DRM device structure. diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h index 3c0d5717..d3d0b83c 100644 --- a/linux/drm_bufs.h +++ b/linux/drm_bufs.h @@ -304,7 +304,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, * * Frees any pages and buffers associated with the given entry. */ -static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) +static void DRM(cleanup_buf_error)(drm_device_t *dev, drm_buf_entry_t *entry) { int i; @@ -337,9 +337,8 @@ static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) sizeof(*entry->buflist), DRM_MEM_BUFS); -#if __HAVE_DMA_FREELIST - DRM(freelist_destroy)(&entry->freelist); -#endif + if (dev->fn_tbl.freelist_destroy) + dev->fn_tbl.freelist_destroy(&entry->freelist); entry->buf_count = 0; } @@ -468,7 +467,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, if(!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -492,7 +491,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, DRM_MEM_BUFS ); if(!temp_buflist) { /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -509,12 +508,14 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); -#if __HAVE_DMA_FREELIST - DRM(freelist_create)( &entry->freelist, entry->buf_count ); - for ( i = 0 ; i < entry->buf_count ; i++ ) { - DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + if (dev->fn_tbl.freelist_create) + { + dev->fn_tbl.freelist_create( &entry->freelist, entry->buf_count); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dev->fn_tbl.freelist_put( dev, &entry->freelist, &entry->buflist[i] ); + } } -#endif + up( &dev->struct_sem ); request.count = entry->buf_count; @@ -653,7 +654,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); DRM(free)( temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), @@ -694,7 +695,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); DRM(free)( temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), @@ -718,7 +719,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, DRM_MEM_BUFS ); if (!temp_buflist) { /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); DRM(free)( temp_pagelist, (dma->page_count + (count << page_order)) * sizeof(*dma->pagelist), @@ -748,12 +749,14 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, dma->page_count += entry->seg_count << page_order; dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); -#if __HAVE_DMA_FREELIST - DRM(freelist_create)( &entry->freelist, entry->buf_count ); - for ( i = 0 ; i < entry->buf_count ; i++ ) { - DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + if (dev->fn_tbl.freelist_create) + { + dev->fn_tbl.freelist_create( &entry->freelist, entry->buf_count); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dev->fn_tbl.freelist_put( dev, &entry->freelist, &entry->buflist[i] ); + } } -#endif + up( &dev->struct_sem ); request.count = entry->buf_count; @@ -877,7 +880,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, if(!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -902,7 +905,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, DRM_MEM_BUFS ); if(!temp_buflist) { /* Free the entry because it isn't valid */ - DRM(cleanup_buf_error)(entry); + DRM(cleanup_buf_error)(dev,entry); up( &dev->struct_sem ); atomic_dec( &dev->buf_alloc ); return -ENOMEM; @@ -919,12 +922,14 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); -#if __HAVE_DMA_FREELIST - DRM(freelist_create)( &entry->freelist, entry->buf_count ); - for ( i = 0 ; i < entry->buf_count ; i++ ) { - DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + if (dev->fn_tbl.freelist_create) + { + dev->fn_tbl.freelist_create( &entry->freelist, entry->buf_count); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dev->fn_tbl.freelist_put( dev, &entry->freelist, &entry->buflist[i] ); + } } -#endif + up( &dev->struct_sem ); request.count = entry->buf_count; diff --git a/linux/drm_dma.h b/linux/drm_dma.h index 04467342..811d768d 100644 --- a/linux/drm_dma.h +++ b/linux/drm_dma.h @@ -117,9 +117,9 @@ void DRM(dma_takedown)(drm_device_t *dev) dma->bufs[i].buf_count * sizeof(*dma->bufs[0].buflist), DRM_MEM_BUFS); -#if __HAVE_DMA_FREELIST - DRM(freelist_destroy)(&dma->bufs[i].freelist); -#endif + + if (dev->fn_tbl.freelist_destroy) + dev->fn_tbl.freelist_destroy(&dma->bufs[i].freelist); } } @@ -159,16 +159,13 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) if ( __HAVE_DMA_WAITQUEUE && waitqueue_active(&buf->dma_wait)) { wake_up_interruptible(&buf->dma_wait); } -#if __HAVE_DMA_FREELIST - else { - drm_device_dma_t *dma = dev->dma; - /* If processes are waiting, the last one - to wake will put the buffer on the free - list. If no processes are waiting, we - put the buffer on the freelist here. */ - DRM(freelist_put)(dev, &dma->bufs[buf->order].freelist, buf); - } -#endif + /* If processes are waiting, the last one + to wake will put the buffer on the free + list. If no processes are waiting, we + put the buffer on the freelist here. */ + else if (dev->fn_tbl.freelist_put) + dev->fn_tbl.freelist_put(dev, &dev->dma->bufs[buf->order].freelist, buf); + } #if !__HAVE_DMA_RECLAIM diff --git a/linux/gamma.h b/linux/gamma.h index b7c4e8a0..c30e70ea 100644 --- a/linux/gamma.h +++ b/linux/gamma.h @@ -74,8 +74,6 @@ #define __HAVE_MULTIPLE_DMA_QUEUES 1 #define __HAVE_DMA_WAITQUEUE 1 -#define __HAVE_DMA_FREELIST 1 - #define __HAVE_IRQ 1 #define __HAVE_IRQ_BH 1 diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c index c7150421..0167e43a 100644 --- a/linux/gamma_dma.c +++ b/linux/gamma_dma.c @@ -952,4 +952,7 @@ void gamma_driver_register_fns(drm_device_t *dev) dev->fn_tbl.dma_flush_unblock = gamma_flush_unblock; dev->fn_tbl.dma_schedule = gamma_dma_schedule; dev->fn_tbl.waitlist_destroy = gamma_waitlist_destroy; + dev->fn_tbl.freelist_create = gamma_freelist_create; + dev->fn_tbl.freelist_put = gamma_freelist_put; + dev->fn_tbl.freelist_destroy = gamma_freelist_destroy; } |