diff options
author | anholt <anholt@FreeBSD.org> | 2003-03-09 02:08:30 +0000 |
---|---|---|
committer | anholt <anholt@FreeBSD.org> | 2003-03-09 02:08:30 +0000 |
commit | ccdf4ef2d9288d035e56820efb0e79db6acf5ba8 (patch) | |
tree | ef9d3b03548e9f28bd5c265be746871660c0c16a /sys/dev/drm/drm_context.h | |
parent | 0b60094f80a8137660b368df0b80fb0179b92d04 (diff) | |
download | FreeBSD-src-ccdf4ef2d9288d035e56820efb0e79db6acf5ba8.zip FreeBSD-src-ccdf4ef2d9288d035e56820efb0e79db6acf5ba8.tar.gz |
Update the DRM to latest from DRI CVS. This is approximately the version
included in XFree86 4.3, but includes some fixes. Notable changes include
Radeon 8500-9100 support, PCI Radeon/Rage 128 support, transform & lighting
support for Radeons, and vblank syncing support for r128, radeon, and mga.
The gamma driver was removed due to lack of any users.
Diffstat (limited to 'sys/dev/drm/drm_context.h')
-rw-r--r-- | sys/dev/drm/drm_context.h | 266 |
1 files changed, 106 insertions, 160 deletions
diff --git a/sys/dev/drm/drm_context.h b/sys/dev/drm/drm_context.h index ec70483..a46fecd 100644 --- a/sys/dev/drm/drm_context.h +++ b/sys/dev/drm/drm_context.h @@ -27,11 +27,9 @@ * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * Gareth Hughes <gareth@valinux.com> - * * $FreeBSD$ */ -#define __NO_VERSION__ #include "dev/drm/drmP.h" #if __HAVE_CTX_BITMAP @@ -46,10 +44,10 @@ void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ) if ( !dev->ctx_bitmap ) goto failed; if ( ctx_handle < DRM_MAX_CTXBITMAP ) { - DRM_OS_LOCK; + DRM_LOCK; clear_bit( ctx_handle, dev->ctx_bitmap ); dev->context_sareas[ctx_handle] = NULL; - DRM_OS_UNLOCK; + DRM_UNLOCK; return; } failed: @@ -64,7 +62,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev ) if(!dev->ctx_bitmap) return -1; - DRM_OS_LOCK; + DRM_LOCK; bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); if ( bit < DRM_MAX_CTXBITMAP ) { set_bit( bit, dev->ctx_bitmap ); @@ -72,7 +70,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev ) if((bit+1) > dev->max_context) { dev->max_context = (bit+1); if(dev->context_sareas) { - drm_map_t **ctx_sareas; + drm_local_map_t **ctx_sareas; ctx_sareas = DRM(realloc)(dev->context_sareas, (dev->max_context - 1) * @@ -82,7 +80,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev ) DRM_MEM_MAPS); if(!ctx_sareas) { clear_bit(bit, dev->ctx_bitmap); - DRM_OS_UNLOCK; + DRM_UNLOCK; return -1; } dev->context_sareas = ctx_sareas; @@ -95,16 +93,16 @@ int DRM(ctxbitmap_next)( drm_device_t *dev ) DRM_MEM_MAPS); if(!dev->context_sareas) { clear_bit(bit, dev->ctx_bitmap); - DRM_OS_UNLOCK; + DRM_UNLOCK; return -1; } dev->context_sareas[bit] = NULL; } } - DRM_OS_UNLOCK; + DRM_UNLOCK; return bit; } - DRM_OS_UNLOCK; + DRM_UNLOCK; return -1; } @@ -113,17 +111,17 @@ int DRM(ctxbitmap_init)( drm_device_t *dev ) int i; int temp; - DRM_OS_LOCK; - dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE, + DRM_LOCK; + dev->ctx_bitmap = (atomic_t *) DRM(alloc)( PAGE_SIZE, DRM_MEM_CTXBITMAP ); if ( dev->ctx_bitmap == NULL ) { - DRM_OS_UNLOCK; - return DRM_OS_ERR(ENOMEM); + DRM_UNLOCK; + return DRM_ERR(ENOMEM); } memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); dev->context_sareas = NULL; dev->max_context = -1; - DRM_OS_UNLOCK; + DRM_UNLOCK; for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { temp = DRM(ctxbitmap_next)( dev ); @@ -135,96 +133,71 @@ int DRM(ctxbitmap_init)( drm_device_t *dev ) void DRM(ctxbitmap_cleanup)( drm_device_t *dev ) { - DRM_OS_LOCK; + DRM_LOCK; if( dev->context_sareas ) DRM(free)( dev->context_sareas, sizeof(*dev->context_sareas) * dev->max_context, DRM_MEM_MAPS ); DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP ); - DRM_OS_UNLOCK; + DRM_UNLOCK; } /* ================================================================ * Per Context SAREA Support */ -int DRM(getsareactx)( DRM_OS_IOCTL ) +int DRM(getsareactx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_priv_map_t request; - drm_map_t *map; + drm_local_map_t *map; - DRM_OS_KRNFROMUSR( request, (drm_ctx_priv_map_t *)data, + DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data, sizeof(request) ); - DRM_OS_LOCK; + DRM_LOCK; if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { - DRM_OS_UNLOCK; - return DRM_OS_ERR(EINVAL); + DRM_UNLOCK; + return DRM_ERR(EINVAL); } map = dev->context_sareas[request.ctx_id]; - DRM_OS_UNLOCK; + DRM_UNLOCK; request.handle = map->handle; - DRM_OS_KRNTOUSR( (drm_ctx_priv_map_t *)data, request, sizeof(request) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_priv_map_t *)data, request, sizeof(request) ); return 0; } -int DRM(setsareactx)( DRM_OS_IOCTL ) +int DRM(setsareactx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_priv_map_t request; - drm_map_t *map = NULL; -#ifdef __linux__ - drm_map_list_t *r_list = NULL; - struct list_head *list; -#endif /* __linux__ */ -#ifdef __FreeBSD__ + drm_local_map_t *map = NULL; drm_map_list_entry_t *list; -#endif /* __FreeBSD__ */ - DRM_OS_KRNFROMUSR( request, (drm_ctx_priv_map_t *)data, + DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data, sizeof(request) ); - DRM_OS_LOCK; -#ifdef __linux__ - list_for_each(list, &dev->maplist->head) { - r_list = (drm_map_list_t *)list; - if(r_list->map && - r_list->map->handle == request.handle) - goto found; - } -#endif /* __linux__ */ -#ifdef __FreeBSD__ + DRM_LOCK; TAILQ_FOREACH(list, dev->maplist, link) { map=list->map; - if(map->handle == request.handle) - goto found; + if(map->handle == request.handle) { + if (dev->max_context < 0) + goto bad; + if (request.ctx_id >= (unsigned) dev->max_context) + goto bad; + dev->context_sareas[request.ctx_id] = map; + DRM_UNLOCK; + return 0; + } } -#endif /* __FreeBSD__ */ bad: - DRM_OS_UNLOCK; - return DRM_OS_ERR(EINVAL); - -found: -#ifdef __linux__ - map = r_list->map; -#endif /* __linux__ */ -#ifdef __FreeBSD__ - map = list->map; -#endif /* __FreeBSD__ */ - if (!map) goto bad; - if (dev->max_context < 0) - goto bad; - if (request.ctx_id >= (unsigned) dev->max_context) - goto bad; - dev->context_sareas[request.ctx_id] = map; - DRM_OS_UNLOCK; - return 0; + DRM_UNLOCK; + return DRM_ERR(EINVAL); } /* ================================================================ @@ -237,7 +210,7 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new ) if ( test_and_set_bit( 0, &dev->context_flag ) ) { DRM_ERROR( "Reentering -- FIXME\n" ); - return DRM_OS_ERR(EBUSY); + return DRM_ERR(EBUSY); } #if __HAVE_DMA_HISTOGRAM @@ -279,41 +252,41 @@ int DRM(context_switch_complete)( drm_device_t *dev, int new ) #endif clear_bit( 0, &dev->context_flag ); - DRM_OS_WAKEUP( &dev->context_wait ); + DRM_WAKEUP( (void *)&dev->context_wait ); return 0; } -int DRM(resctx)( DRM_OS_IOCTL ) +int DRM(resctx)( DRM_IOCTL_ARGS ) { drm_ctx_res_t res; drm_ctx_t ctx; int i; - DRM_OS_KRNFROMUSR( res, (drm_ctx_res_t *)data, sizeof(res) ); + DRM_COPY_FROM_USER_IOCTL( res, (drm_ctx_res_t *)data, sizeof(res) ); if ( res.count >= DRM_RESERVED_CONTEXTS ) { memset( &ctx, 0, sizeof(ctx) ); for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { ctx.handle = i; - if ( DRM_OS_COPYTOUSR( &res.contexts[i], + if ( DRM_COPY_TO_USER( &res.contexts[i], &i, sizeof(i) ) ) - return DRM_OS_ERR(EFAULT); + return DRM_ERR(EFAULT); } } res.count = DRM_RESERVED_CONTEXTS; - DRM_OS_KRNTOUSR( (drm_ctx_res_t *)data, res, sizeof(res) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_res_t *)data, res, sizeof(res) ); return 0; } -int DRM(addctx)( DRM_OS_IOCTL ) +int DRM(addctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); ctx.handle = DRM(ctxbitmap_next)( dev ); if ( ctx.handle == DRM_KERNEL_CONTEXT ) { @@ -324,51 +297,51 @@ int DRM(addctx)( DRM_OS_IOCTL ) if ( ctx.handle == -1 ) { DRM_DEBUG( "Not enough free contexts.\n" ); /* Should this return -EBUSY instead? */ - return DRM_OS_ERR(ENOMEM); + return DRM_ERR(ENOMEM); } - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(modctx)( DRM_OS_IOCTL ) +int DRM(modctx)( DRM_IOCTL_ARGS ) { /* This does nothing */ return 0; } -int DRM(getctx)( DRM_OS_IOCTL ) +int DRM(getctx)( DRM_IOCTL_ARGS ) { drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); /* This is 0, because we don't handle any context flags */ ctx.flags = 0; - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(switchctx)( DRM_OS_IOCTL ) +int DRM(switchctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG( "%d\n", ctx.handle ); return DRM(context_switch)( dev, dev->last_context, ctx.handle ); } -int DRM(newctx)( DRM_OS_IOCTL ) +int DRM(newctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG( "%d\n", ctx.handle ); DRM(context_switch_complete)( dev, ctx.handle ); @@ -376,19 +349,14 @@ int DRM(newctx)( DRM_OS_IOCTL ) return 0; } -int DRM(rmctx)( DRM_OS_IOCTL ) +int DRM(rmctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG( "%d\n", ctx.handle ); -#ifdef __linux__ - if ( ctx.handle == DRM_KERNEL_CONTEXT + 1 ) { - priv->remove_auth_on_close = 1; - } -#endif /* __linux__ */ if ( ctx.handle != DRM_KERNEL_CONTEXT ) { DRM(ctxbitmap_free)( dev, ctx.handle ); } @@ -415,7 +383,7 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new) if (test_and_set_bit(0, &dev->context_flag)) { DRM_ERROR("Reentering -- FIXME\n"); - return DRM_OS_ERR(EBUSY); + return DRM_ERR(EBUSY); } #if __HAVE_DMA_HISTOGRAM @@ -426,7 +394,7 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new) if (new >= dev->queue_count) { clear_bit(0, &dev->context_flag); - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); } if (new == dev->last_context) { @@ -439,7 +407,7 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new) if (atomic_read(&q->use_count) == 1) { atomic_dec(&q->use_count); clear_bit(0, &dev->context_flag); - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); } if (DRM(flags) & DRM_FLAG_NOCTX) { @@ -478,7 +446,7 @@ int DRM(context_switch_complete)(drm_device_t *dev, int new) #endif clear_bit(0, &dev->context_flag); - DRM_OS_WAKEUP_INT(&dev->context_wait); + DRM_WAKEUP_INT(&dev->context_wait); return 0; } @@ -504,16 +472,9 @@ static int DRM(init_queue)(drm_device_t *dev, drm_queue_t *q, drm_ctx_t *ctx) atomic_set(&q->total_flushed, 0); atomic_set(&q->total_locks, 0); -#ifdef __linux__ - init_waitqueue_head(&q->write_queue); - init_waitqueue_head(&q->read_queue); - init_waitqueue_head(&q->flush_queue); -#endif /* __linux__ */ -#ifdef __FreeBSD__ q->write_queue = 0; q->read_queue = 0; q->flush_queue = 0; -#endif /* __FreeBSD__ */ q->flags = ctx->flags; @@ -549,7 +510,7 @@ static int DRM(alloc_queue)(drm_device_t *dev) atomic_dec(&dev->queuelist[i]->use_count); } /* Allocate a new queue */ - DRM_OS_LOCK; + DRM_LOCK; queue = gamma_alloc(sizeof(*queue), DRM_MEM_QUEUES); memset(queue, 0, sizeof(*queue)); @@ -567,19 +528,19 @@ static int DRM(alloc_queue)(drm_device_t *dev) newslots, DRM_MEM_QUEUES); if (!dev->queuelist) { - DRM_OS_UNLOCK; + DRM_UNLOCK; DRM_DEBUG("out of memory\n"); - return DRM_OS_ERR(ENOMEM); + return DRM_ERR(ENOMEM); } } dev->queuelist[dev->queue_count-1] = queue; - DRM_OS_UNLOCK; + DRM_UNLOCK; DRM_DEBUG("%d (new)\n", dev->queue_count - 1); return dev->queue_count - 1; } -int DRM(resctx)( DRM_OS_IOCTL ) +int DRM(resctx)( DRM_IOCTL_ARGS ) { drm_ctx_res_t res; drm_ctx_t ctx; @@ -587,31 +548,31 @@ int DRM(resctx)( DRM_OS_IOCTL ) DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - DRM_OS_KRNFROMUSR( res, (drm_ctx_res_t *)data, sizeof(res) ); + DRM_COPY_FROM_USER_IOCTL( res, (drm_ctx_res_t *)data, sizeof(res) ); if (res.count >= DRM_RESERVED_CONTEXTS) { memset(&ctx, 0, sizeof(ctx)); for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { ctx.handle = i; - if (DRM_OS_COPYTOUSR(&res.contexts[i], + if (DRM_COPY_TO_USER(&res.contexts[i], &i, sizeof(i))) - return DRM_OS_ERR(EFAULT); + return DRM_ERR(EFAULT); } } res.count = DRM_RESERVED_CONTEXTS; - DRM_OS_KRNTOUSR( (drm_ctx_res_t *)data, res, sizeof(res) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_res_t *)data, res, sizeof(res) ); return 0; } -int DRM(addctx)( DRM_OS_IOCTL ) +int DRM(addctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); if ((ctx.handle = DRM(alloc_queue)(dev)) == DRM_KERNEL_CONTEXT) { /* Init kernel's context and get a new one. */ @@ -621,35 +582,35 @@ int DRM(addctx)( DRM_OS_IOCTL ) DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx); DRM_DEBUG("%d\n", ctx.handle); - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(modctx)( DRM_OS_IOCTL ) +int DRM(modctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; drm_queue_t *q; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); if (ctx.handle < 0 || ctx.handle >= dev->queue_count) - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); q = dev->queuelist[ctx.handle]; atomic_inc(&q->use_count); if (atomic_read(&q->use_count) == 1) { /* No longer in use */ atomic_dec(&q->use_count); - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); } if (DRM_BUFCOUNT(&q->waitlist)) { atomic_dec(&q->use_count); - return DRM_OS_ERR(EBUSY); + return DRM_ERR(EBUSY); } q->flags = ctx.flags; @@ -658,52 +619,52 @@ int DRM(modctx)( DRM_OS_IOCTL ) return 0; } -int DRM(getctx)( DRM_OS_IOCTL ) +int DRM(getctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; drm_queue_t *q; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); if (ctx.handle >= dev->queue_count) - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); q = dev->queuelist[ctx.handle]; atomic_inc(&q->use_count); if (atomic_read(&q->use_count) == 1) { /* No longer in use */ atomic_dec(&q->use_count); - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); } ctx.flags = q->flags; atomic_dec(&q->use_count); - DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) ); + DRM_COPY_TO_USER_IOCTL( (drm_ctx_t *)data, ctx, sizeof(ctx) ); return 0; } -int DRM(switchctx)( DRM_OS_IOCTL ) +int DRM(switchctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); return DRM(context_switch)(dev, dev->last_context, ctx.handle); } -int DRM(newctx)( DRM_OS_IOCTL ) +int DRM(newctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); DRM(context_switch_complete)(dev, ctx.handle); @@ -711,25 +672,25 @@ int DRM(newctx)( DRM_OS_IOCTL ) return 0; } -int DRM(rmctx)( DRM_OS_IOCTL ) +int DRM(rmctx)( DRM_IOCTL_ARGS ) { - DRM_OS_DEVICE; + DRM_DEVICE; drm_ctx_t ctx; drm_queue_t *q; drm_buf_t *buf; - DRM_OS_KRNFROMUSR( ctx, (drm_ctx_t *)data, sizeof(ctx) ); + DRM_COPY_FROM_USER_IOCTL( ctx, (drm_ctx_t *)data, sizeof(ctx) ); DRM_DEBUG("%d\n", ctx.handle); - if (ctx.handle >= dev->queue_count) return DRM_OS_ERR(EINVAL); + if (ctx.handle >= dev->queue_count) return DRM_ERR(EINVAL); q = dev->queuelist[ctx.handle]; atomic_inc(&q->use_count); if (atomic_read(&q->use_count) == 1) { /* No longer in use */ atomic_dec(&q->use_count); - return DRM_OS_ERR(EINVAL); + return DRM_ERR(EINVAL); } atomic_inc(&q->finalization); /* Mark queue in finalization state */ @@ -737,20 +698,11 @@ int DRM(rmctx)( DRM_OS_IOCTL ) finalization) */ while (test_and_set_bit(0, &dev->interrupt_flag)) { -#ifdef __linux__ - schedule(); - if (signal_pending(current)) { - clear_bit(0, &dev->interrupt_flag); - return DRM_OS_ERR(EINTR); - } -#endif /* __linux__ */ -#ifdef __FreeBSD__ static int never; int retcode; retcode = tsleep(&never, PZERO|PCATCH, "never", 1); if (retcode) return retcode; -#endif /* __FreeBSD__ */ } /* Remove queued buffers */ while ((buf = DRM(waitlist_get)(&q->waitlist))) { @@ -759,15 +711,9 @@ int DRM(rmctx)( DRM_OS_IOCTL ) clear_bit(0, &dev->interrupt_flag); /* Wakeup blocked processes */ -#ifdef __linux__ - wake_up_interruptible(&q->read_queue); - wake_up_interruptible(&q->write_queue); -#endif /* __linux__ */ -#ifdef __FreeBSD__ wakeup( &q->block_read ); wakeup( &q->block_write ); -#endif /* __FreeBSD__ */ - DRM_OS_WAKEUP_INT( &q->flush_queue ); + DRM_WAKEUP_INT( &q->flush_queue ); /* Finalization over. Queue is made available when both use_count and finalization become 0, which won't |