summaryrefslogtreecommitdiff
path: root/linux-core/drm_drv.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2001-10-22 19:15:04 +0000
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2001-10-22 19:15:04 +0000
commit92ad1b60e109170e1fa7d22a4627efa7fa77aa71 (patch)
treeff97ad9ac80db45e800080adf71b7ba54fd925ef /linux-core/drm_drv.c
parent87ec138e1421f408c0fa86fa3567544dd488711e (diff)
merge kernel 2.4.13-pre6.
Diffstat (limited to 'linux-core/drm_drv.c')
-rw-r--r--linux-core/drm_drv.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 1ae3ec25..61c6cdd2 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -1027,6 +1027,25 @@ int DRM(unlock)( struct inode *inode, struct file *filp,
atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] );
+#if __HAVE_KERNEL_CTX_SWITCH
+ /* We no longer really hold it, but if we are the next
+ * agent to request it then we should just be able to
+ * take it immediately and not eat the ioctl.
+ */
+ dev->lock.pid = 0;
+ {
+ __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
+ unsigned int old, new, prev, ctx;
+
+ ctx = lock.context;
+ do {
+ old = *plock;
+ new = ctx;
+ prev = cmpxchg(plock, old, new);
+ } while (prev != old);
+ }
+ wake_up_interruptible(&dev->lock.lock_queue);
+#else
DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT );
#if __HAVE_DMA_SCHEDULE
@@ -1041,6 +1060,7 @@ int DRM(unlock)( struct inode *inode, struct file *filp,
DRM_ERROR( "\n" );
}
}
+#endif /* !__HAVE_KERNEL_CTX_SWITCH */
unblock_all_signals();
return 0;