From e34b5601912ce4b611d429304d5271fcf6f9f457 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 5 Jan 2005 17:44:43 +0000 Subject: VIA update: Release video futexes when context is destroyed (This was previously done by the X server). Added New Unichrome Pro VIDEO DMA commands to the verifier. Added Quiescent heavyweight lock mode. --- shared-core/via_mm.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'shared-core/via_mm.c') diff --git a/shared-core/via_mm.c b/shared-core/via_mm.c index 5199f6c9..5940de70 100644 --- a/shared-core/via_mm.c +++ b/shared-core/via_mm.c @@ -130,8 +130,12 @@ int via_init_context(struct drm_device *dev, int context) } int via_final_context(struct drm_device *dev, int context) -{ - int i; +{ + int i; + volatile int *lock; + drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; + drm_via_sarea_t *sAPriv = dev_priv->sarea_priv; + for (i = 0; i < MAX_CONTEXT; i++) if (global_ppriv[i].used && (global_ppriv[i].context == context)) @@ -166,6 +170,22 @@ int via_final_context(struct drm_device *dev, int context) global_ppriv[i].used = 0; } + + /* + * Release futex locks. + */ + + for (i=0; i < VIA_NR_XVMC_LOCKS; ++i) { + lock = XVMCLOCKPTR(sAPriv, i); + if ( (_DRM_LOCKING_CONTEXT( *lock ) == i) && + (_DRM_LOCK_IS_HELD( *lock ))) { + if ( *lock & _DRM_LOCK_CONT) { + DRM_WAKEUP( &(dev_priv->decoder_queue[i])); + } + *lock &= ~( _DRM_LOCK_HELD | _DRM_LOCK_CONT ); + } + } + #if defined(__linux__) /* Linux specific until context tracking code gets ported to BSD */ /* Last context, perform cleanup */ -- cgit v1.2.3