summaryrefslogtreecommitdiff
path: root/shared-core/via_mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-core/via_mm.c')
-rw-r--r--shared-core/via_mm.c24
1 files changed, 22 insertions, 2 deletions
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 */