summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-04-24 19:09:55 +0000
committerEric Anholt <anholt@freebsd.org>2003-04-24 19:09:55 +0000
commita147df879b3b850612222759c14f4142d2406e74 (patch)
treeaea9241e04e3cefbe123228568bbe3b07d41e9eb
parentd6a82ff9c160acbb7db5bee2cde45818d1e8548e (diff)
Remove more gamma DMA infrastructure. Most of this code was copied straight
from linux, so it could be added back if some driver needed it in the future.
-rw-r--r--bsd-core/drmP.h48
-rw-r--r--bsd-core/drm_bufs.c36
-rw-r--r--bsd-core/drm_context.c2
-rw-r--r--bsd-core/drm_dma.c22
-rw-r--r--bsd-core/drm_drv.c39
-rw-r--r--bsd-core/drm_ioctl.c2
-rw-r--r--bsd-core/drm_sysctl.c51
-rw-r--r--bsd/drmP.h48
-rw-r--r--bsd/drm_bufs.h36
-rw-r--r--bsd/drm_context.h2
-rw-r--r--bsd/drm_dma.h22
-rw-r--r--bsd/drm_drv.h39
-rw-r--r--bsd/drm_ioctl.h2
-rw-r--r--bsd/drm_sysctl.h51
14 files changed, 6 insertions, 394 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 9b8dd57e..28594f76 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -52,12 +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
#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then
also include looping detection. */
@@ -159,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 */
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,
@@ -194,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;
@@ -230,24 +219,6 @@ 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 */
DRMFILE filp; /* Unique identifier of holding process (NULL is kernel)*/
@@ -271,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
@@ -366,7 +335,6 @@ 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;
@@ -374,10 +342,6 @@ struct drm_device {
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 */
@@ -391,13 +355,8 @@ 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
@@ -505,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);
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index 05e5eec9..af9e76f1 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -310,10 +310,6 @@ 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
-
entry->buf_count = 0;
}
}
@@ -390,9 +386,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
buf->bus_address = agp_offset + offset;
buf->address = (void *)(agp_offset + offset);
buf->next = NULL;
- buf->waiting = 0;
buf->pending = 0;
- buf->dma_wait = 0;
buf->filp = NULL;
buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
@@ -435,12 +429,6 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
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] );
- }
-#endif
DRM_UNLOCK;
request->count = entry->buf_count;
@@ -476,9 +464,8 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
order = DRM(order)(request->size);
size = 1 << order;
- DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n",
- request->count, request->size, size,
- order, dev->queue_count );
+ DRM_DEBUG( "count=%d, size=%d (%d), order=%d\n",
+ request->count, request->size, size, order );
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
return DRM_ERR(EINVAL);
@@ -561,9 +548,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
buf->offset = (dma->byte_count + byte_count + offset);
buf->address = (void *)(page + offset);
buf->next = NULL;
- buf->waiting = 0;
buf->pending = 0;
- buf->dma_wait = 0;
buf->filp = NULL;
DRM_DEBUG( "buffer %d @ %p\n",
entry->buf_count, buf->address );
@@ -593,12 +578,6 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
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] );
- }
-#endif
DRM_UNLOCK;
request->count = entry->buf_count;
@@ -681,9 +660,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
buf->bus_address = agp_offset + offset;
buf->address = (void *)(agp_offset + offset + dev->sg->handle);
buf->next = NULL;
- buf->waiting = 0;
buf->pending = 0;
- buf->dma_wait = 0;
buf->filp = NULL;
buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
@@ -732,12 +709,6 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
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] );
- }
-#endif
DRM_UNLOCK;
request->count = entry->buf_count;
@@ -763,9 +734,6 @@ int DRM(addbufs)( DRM_IOCTL_ARGS )
if (request.count < 0 || request.count > 4096)
return DRM_ERR(EINVAL);
- if (dev->queue_count)
- return DRM_ERR(EBUSY); /* Not while in use */
-
DRM_SPINLOCK(&dev->count_lock);
if (dev->buf_use) {
DRM_SPINUNLOCK(&dev->count_lock);
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c
index 2293a806..dabf5ca9 100644
--- a/bsd-core/drm_context.c
+++ b/bsd-core/drm_context.c
@@ -226,7 +226,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new )
int DRM(context_switch_complete)( drm_device_t *dev, int new )
{
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
- dev->last_switch = jiffies;
if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) {
DRM_ERROR( "Lock isn't held after context switch\n" );
@@ -236,7 +235,6 @@ int DRM(context_switch_complete)( drm_device_t *dev, int new )
when the kernel holds the lock, release
that lock here. */
clear_bit( 0, &dev->context_flag );
- DRM_WAKEUP( (void *)&dev->context_wait );
return 0;
}
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 27ce05e3..238dca3e 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -98,9 +98,6 @@ 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
}
}
@@ -124,25 +121,9 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
{
if (!buf) return;
- buf->waiting = 0;
buf->pending = 0;
buf->filp = NULL;
buf->used = 0;
-
- if ( buf->dma_wait ) {
- wakeup( (void *)&buf->dma_wait );
- buf->dma_wait = 0;
- }
-#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 !__HAVE_DMA_RECLAIM
@@ -191,11 +172,8 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
dev->context_flag = 0;
- dev->interrupt_flag = 0;
- dev->dma_flag = 0;
dev->dma->next_buffer = NULL;
- dev->dma->next_queue = NULL;
dev->dma->this_buffer = NULL;
#if __HAVE_DMA_IRQ_BH
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index f1184906..828f774b 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -62,9 +62,6 @@
#ifndef __HAVE_DMA_QUEUE
#define __HAVE_DMA_QUEUE 0
#endif
-#ifndef __HAVE_MULTIPLE_DMA_QUEUES
-#define __HAVE_MULTIPLE_DMA_QUEUES 0
-#endif
#ifndef __HAVE_DMA_SCHEDULE
#define __HAVE_DMA_SCHEDULE 0
#endif
@@ -478,27 +475,17 @@ static int DRM(setup)( drm_device_t *dev )
if(dev->maplist == NULL) return DRM_ERR(ENOMEM);
memset(dev->maplist, 0, sizeof(*dev->maplist));
TAILQ_INIT(dev->maplist);
- dev->map_count = 0;
dev->lock.hw_lock = NULL;
dev->lock.lock_queue = 0;
- dev->queue_count = 0;
- dev->queue_reserved = 0;
- dev->queue_slots = 0;
- dev->queuelist = NULL;
dev->irq = 0;
dev->context_flag = 0;
- dev->interrupt_flag = 0;
- dev->dma_flag = 0;
dev->last_context = 0;
- dev->last_switch = 0;
- dev->last_checked = 0;
#if __FreeBSD_version >= 500000
callout_init( &dev->timer, 1 );
#else
callout_init( &dev->timer );
#endif
- dev->context_wait = 0;
#ifdef __FreeBSD__
dev->buf_sigio = NULL;
@@ -633,25 +620,6 @@ static int DRM(takedown)( drm_device_t *dev )
dev->maplist = NULL;
}
-#if __HAVE_DMA_QUEUE || __HAVE_MULTIPLE_DMA_QUEUES
- if ( dev->queuelist ) {
- for ( i = 0 ; i < dev->queue_count ; i++ ) {
- DRM(waitlist_destroy)( &dev->queuelist[i]->waitlist );
- if ( dev->queuelist[i] ) {
- DRM(free)( dev->queuelist[i],
- sizeof(*dev->queuelist[0]),
- DRM_MEM_QUEUES );
- dev->queuelist[i] = NULL;
- }
- }
- DRM(free)( dev->queuelist,
- dev->queue_slots * sizeof(*dev->queuelist),
- DRM_MEM_QUEUES );
- dev->queuelist = NULL;
- }
- dev->queue_count = 0;
-#endif
-
#if __HAVE_DMA
DRM(dma_takedown)( dev );
#endif
@@ -1075,9 +1043,6 @@ int DRM(lock)( DRM_IOCTL_ARGS )
DRM_DEVICE;
drm_lock_t lock;
int ret = 0;
-#if __HAVE_MULTIPLE_DMA_QUEUES
- drm_queue_t *q;
-#endif
DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) );
@@ -1094,10 +1059,6 @@ int DRM(lock)( DRM_IOCTL_ARGS )
#if __HAVE_DMA_QUEUE
if ( lock.context < 0 )
return DRM_ERR(EINVAL);
-#elif __HAVE_MULTIPLE_DMA_QUEUES
- if ( lock.context < 0 || lock.context >= dev->queue_count )
- return DRM_ERR(EINVAL);
- q = dev->queuelist[lock.context];
#endif
if ( !ret ) {
diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c
index 1e2771e9..3e4f8908 100644
--- a/bsd-core/drm_ioctl.c
+++ b/bsd-core/drm_ioctl.c
@@ -139,7 +139,7 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
idx = map.offset;
DRM_LOCK;
- if (idx < 0 || idx >= dev->map_count) {
+ if (idx < 0) {
DRM_UNLOCK;
return DRM_ERR(EINVAL);
}
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c
index 90922462..dd4ef1f9 100644
--- a/bsd-core/drm_sysctl.c
+++ b/bsd-core/drm_sysctl.c
@@ -9,7 +9,6 @@
static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS;
static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS;
static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS;
-static int DRM(queues_info)DRM_SYSCTL_HANDLER_ARGS;
static int DRM(bufs_info)DRM_SYSCTL_HANDLER_ARGS;
struct DRM(sysctl_list) {
@@ -20,7 +19,6 @@ struct DRM(sysctl_list) {
{ "mem", DRM(mem_info) },
{ "vm", DRM(vm_info) },
{ "clients", DRM(clients_info) },
- { "queues", DRM(queues_info) },
{ "bufs", DRM(bufs_info) },
};
#define DRM_SYSCTL_ENTRIES (sizeof(DRM(sysctl_list))/sizeof(DRM(sysctl_list)[0]))
@@ -164,55 +162,6 @@ static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
}
-static int DRM(_queues_info)DRM_SYSCTL_HANDLER_ARGS
-{
- drm_device_t *dev = arg1;
- int i;
- drm_queue_t *q;
- char buf[128];
- int error;
-
- DRM_SYSCTL_PRINT(" ctx/flags use fin"
- " blk/rw/rwf wait flushed queued"
- " locks\n\n");
- for (i = 0; i < dev->queue_count; i++) {
- q = dev->queuelist[i];
- atomic_inc(&q->use_count);
- DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count),
- "%5d/0x%03x %5d %5d"
- " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
- i,
- q->flags,
- atomic_read(&q->use_count),
- atomic_read(&q->finalization),
- atomic_read(&q->block_count),
- atomic_read(&q->block_read) ? 'r' : '-',
- atomic_read(&q->block_write) ? 'w' : '-',
- q->read_queue ? 'r':'-',
- q->write_queue ? 'w':'-',
- q->flush_queue ? 'f':'-',
- (int)DRM_BUFCOUNT(&q->waitlist),
- atomic_read(&q->total_flushed),
- atomic_read(&q->total_queued),
- atomic_read(&q->total_locks));
- atomic_dec(&q->use_count);
- }
-
- SYSCTL_OUT(req, "", 1);
- return 0;
-}
-
-static int DRM(queues_info) DRM_SYSCTL_HANDLER_ARGS
-{
- drm_device_t *dev = arg1;
- int ret;
-
- DRM_LOCK;
- ret = DRM(_queues_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
- return ret;
-}
-
/* drm_bufs_info is called whenever a process reads
hw.dri.0.bufs. */
diff --git a/bsd/drmP.h b/bsd/drmP.h
index 9b8dd57e..28594f76 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -52,12 +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
#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then
also include looping detection. */
@@ -159,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 */
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,
@@ -194,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;
@@ -230,24 +219,6 @@ 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 */
DRMFILE filp; /* Unique identifier of holding process (NULL is kernel)*/
@@ -271,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
@@ -366,7 +335,6 @@ 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;
@@ -374,10 +342,6 @@ struct drm_device {
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 */
@@ -391,13 +355,8 @@ 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
@@ -505,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);
diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h
index 05e5eec9..af9e76f1 100644
--- a/bsd/drm_bufs.h
+++ b/bsd/drm_bufs.h
@@ -310,10 +310,6 @@ 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
-
entry->buf_count = 0;
}
}
@@ -390,9 +386,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
buf->bus_address = agp_offset + offset;
buf->address = (void *)(agp_offset + offset);
buf->next = NULL;
- buf->waiting = 0;
buf->pending = 0;
- buf->dma_wait = 0;
buf->filp = NULL;
buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
@@ -435,12 +429,6 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
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] );
- }
-#endif
DRM_UNLOCK;
request->count = entry->buf_count;
@@ -476,9 +464,8 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
order = DRM(order)(request->size);
size = 1 << order;
- DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n",
- request->count, request->size, size,
- order, dev->queue_count );
+ DRM_DEBUG( "count=%d, size=%d (%d), order=%d\n",
+ request->count, request->size, size, order );
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
return DRM_ERR(EINVAL);
@@ -561,9 +548,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
buf->offset = (dma->byte_count + byte_count + offset);
buf->address = (void *)(page + offset);
buf->next = NULL;
- buf->waiting = 0;
buf->pending = 0;
- buf->dma_wait = 0;
buf->filp = NULL;
DRM_DEBUG( "buffer %d @ %p\n",
entry->buf_count, buf->address );
@@ -593,12 +578,6 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
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] );
- }
-#endif
DRM_UNLOCK;
request->count = entry->buf_count;
@@ -681,9 +660,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
buf->bus_address = agp_offset + offset;
buf->address = (void *)(agp_offset + offset + dev->sg->handle);
buf->next = NULL;
- buf->waiting = 0;
buf->pending = 0;
- buf->dma_wait = 0;
buf->filp = NULL;
buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
@@ -732,12 +709,6 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
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] );
- }
-#endif
DRM_UNLOCK;
request->count = entry->buf_count;
@@ -763,9 +734,6 @@ int DRM(addbufs)( DRM_IOCTL_ARGS )
if (request.count < 0 || request.count > 4096)
return DRM_ERR(EINVAL);
- if (dev->queue_count)
- return DRM_ERR(EBUSY); /* Not while in use */
-
DRM_SPINLOCK(&dev->count_lock);
if (dev->buf_use) {
DRM_SPINUNLOCK(&dev->count_lock);
diff --git a/bsd/drm_context.h b/bsd/drm_context.h
index 2293a806..dabf5ca9 100644
--- a/bsd/drm_context.h
+++ b/bsd/drm_context.h
@@ -226,7 +226,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new )
int DRM(context_switch_complete)( drm_device_t *dev, int new )
{
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
- dev->last_switch = jiffies;
if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) {
DRM_ERROR( "Lock isn't held after context switch\n" );
@@ -236,7 +235,6 @@ int DRM(context_switch_complete)( drm_device_t *dev, int new )
when the kernel holds the lock, release
that lock here. */
clear_bit( 0, &dev->context_flag );
- DRM_WAKEUP( (void *)&dev->context_wait );
return 0;
}
diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h
index 27ce05e3..238dca3e 100644
--- a/bsd/drm_dma.h
+++ b/bsd/drm_dma.h
@@ -98,9 +98,6 @@ 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
}
}
@@ -124,25 +121,9 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf)
{
if (!buf) return;
- buf->waiting = 0;
buf->pending = 0;
buf->filp = NULL;
buf->used = 0;
-
- if ( buf->dma_wait ) {
- wakeup( (void *)&buf->dma_wait );
- buf->dma_wait = 0;
- }
-#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 !__HAVE_DMA_RECLAIM
@@ -191,11 +172,8 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
dev->context_flag = 0;
- dev->interrupt_flag = 0;
- dev->dma_flag = 0;
dev->dma->next_buffer = NULL;
- dev->dma->next_queue = NULL;
dev->dma->this_buffer = NULL;
#if __HAVE_DMA_IRQ_BH
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index f1184906..828f774b 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -62,9 +62,6 @@
#ifndef __HAVE_DMA_QUEUE
#define __HAVE_DMA_QUEUE 0
#endif
-#ifndef __HAVE_MULTIPLE_DMA_QUEUES
-#define __HAVE_MULTIPLE_DMA_QUEUES 0
-#endif
#ifndef __HAVE_DMA_SCHEDULE
#define __HAVE_DMA_SCHEDULE 0
#endif
@@ -478,27 +475,17 @@ static int DRM(setup)( drm_device_t *dev )
if(dev->maplist == NULL) return DRM_ERR(ENOMEM);
memset(dev->maplist, 0, sizeof(*dev->maplist));
TAILQ_INIT(dev->maplist);
- dev->map_count = 0;
dev->lock.hw_lock = NULL;
dev->lock.lock_queue = 0;
- dev->queue_count = 0;
- dev->queue_reserved = 0;
- dev->queue_slots = 0;
- dev->queuelist = NULL;
dev->irq = 0;
dev->context_flag = 0;
- dev->interrupt_flag = 0;
- dev->dma_flag = 0;
dev->last_context = 0;
- dev->last_switch = 0;
- dev->last_checked = 0;
#if __FreeBSD_version >= 500000
callout_init( &dev->timer, 1 );
#else
callout_init( &dev->timer );
#endif
- dev->context_wait = 0;
#ifdef __FreeBSD__
dev->buf_sigio = NULL;
@@ -633,25 +620,6 @@ static int DRM(takedown)( drm_device_t *dev )
dev->maplist = NULL;
}
-#if __HAVE_DMA_QUEUE || __HAVE_MULTIPLE_DMA_QUEUES
- if ( dev->queuelist ) {
- for ( i = 0 ; i < dev->queue_count ; i++ ) {
- DRM(waitlist_destroy)( &dev->queuelist[i]->waitlist );
- if ( dev->queuelist[i] ) {
- DRM(free)( dev->queuelist[i],
- sizeof(*dev->queuelist[0]),
- DRM_MEM_QUEUES );
- dev->queuelist[i] = NULL;
- }
- }
- DRM(free)( dev->queuelist,
- dev->queue_slots * sizeof(*dev->queuelist),
- DRM_MEM_QUEUES );
- dev->queuelist = NULL;
- }
- dev->queue_count = 0;
-#endif
-
#if __HAVE_DMA
DRM(dma_takedown)( dev );
#endif
@@ -1075,9 +1043,6 @@ int DRM(lock)( DRM_IOCTL_ARGS )
DRM_DEVICE;
drm_lock_t lock;
int ret = 0;
-#if __HAVE_MULTIPLE_DMA_QUEUES
- drm_queue_t *q;
-#endif
DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) );
@@ -1094,10 +1059,6 @@ int DRM(lock)( DRM_IOCTL_ARGS )
#if __HAVE_DMA_QUEUE
if ( lock.context < 0 )
return DRM_ERR(EINVAL);
-#elif __HAVE_MULTIPLE_DMA_QUEUES
- if ( lock.context < 0 || lock.context >= dev->queue_count )
- return DRM_ERR(EINVAL);
- q = dev->queuelist[lock.context];
#endif
if ( !ret ) {
diff --git a/bsd/drm_ioctl.h b/bsd/drm_ioctl.h
index 1e2771e9..3e4f8908 100644
--- a/bsd/drm_ioctl.h
+++ b/bsd/drm_ioctl.h
@@ -139,7 +139,7 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
idx = map.offset;
DRM_LOCK;
- if (idx < 0 || idx >= dev->map_count) {
+ if (idx < 0) {
DRM_UNLOCK;
return DRM_ERR(EINVAL);
}
diff --git a/bsd/drm_sysctl.h b/bsd/drm_sysctl.h
index 90922462..dd4ef1f9 100644
--- a/bsd/drm_sysctl.h
+++ b/bsd/drm_sysctl.h
@@ -9,7 +9,6 @@
static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS;
static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS;
static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS;
-static int DRM(queues_info)DRM_SYSCTL_HANDLER_ARGS;
static int DRM(bufs_info)DRM_SYSCTL_HANDLER_ARGS;
struct DRM(sysctl_list) {
@@ -20,7 +19,6 @@ struct DRM(sysctl_list) {
{ "mem", DRM(mem_info) },
{ "vm", DRM(vm_info) },
{ "clients", DRM(clients_info) },
- { "queues", DRM(queues_info) },
{ "bufs", DRM(bufs_info) },
};
#define DRM_SYSCTL_ENTRIES (sizeof(DRM(sysctl_list))/sizeof(DRM(sysctl_list)[0]))
@@ -164,55 +162,6 @@ static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
}
-static int DRM(_queues_info)DRM_SYSCTL_HANDLER_ARGS
-{
- drm_device_t *dev = arg1;
- int i;
- drm_queue_t *q;
- char buf[128];
- int error;
-
- DRM_SYSCTL_PRINT(" ctx/flags use fin"
- " blk/rw/rwf wait flushed queued"
- " locks\n\n");
- for (i = 0; i < dev->queue_count; i++) {
- q = dev->queuelist[i];
- atomic_inc(&q->use_count);
- DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count),
- "%5d/0x%03x %5d %5d"
- " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
- i,
- q->flags,
- atomic_read(&q->use_count),
- atomic_read(&q->finalization),
- atomic_read(&q->block_count),
- atomic_read(&q->block_read) ? 'r' : '-',
- atomic_read(&q->block_write) ? 'w' : '-',
- q->read_queue ? 'r':'-',
- q->write_queue ? 'w':'-',
- q->flush_queue ? 'f':'-',
- (int)DRM_BUFCOUNT(&q->waitlist),
- atomic_read(&q->total_flushed),
- atomic_read(&q->total_queued),
- atomic_read(&q->total_locks));
- atomic_dec(&q->use_count);
- }
-
- SYSCTL_OUT(req, "", 1);
- return 0;
-}
-
-static int DRM(queues_info) DRM_SYSCTL_HANDLER_ARGS
-{
- drm_device_t *dev = arg1;
- int ret;
-
- DRM_LOCK;
- ret = DRM(_queues_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
- return ret;
-}
-
/* drm_bufs_info is called whenever a process reads
hw.dri.0.bufs. */