blob: 57c4306f4cb4e922b67772279c5d227e224a93db [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
Dave Airlieb5e89ed2005-09-25 14:28:13 +10002 * \file drm_lock.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * IOCTLs for locking
Dave Airlieb5e89ed2005-09-25 14:28:13 +10004 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com>
7 */
8
9/*
10 * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
11 *
12 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
13 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
14 * All Rights Reserved.
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation
19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 * and/or sell copies of the Software, and to permit persons to whom the
21 * Software is furnished to do so, subject to the following conditions:
22 *
23 * The above copyright notice and this permission notice (including the next
24 * paragraph) shall be included in all copies or substantial portions of the
25 * Software.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
31 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33 * OTHER DEALINGS IN THE SOFTWARE.
34 */
35
36#include "drmP.h"
37
Dave Airliec94f7022005-07-07 21:03:38 +100038static int drm_notifier(void *priv);
39
Dave Airlieb5e89ed2005-09-25 14:28:13 +100040/**
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 * Lock ioctl.
42 *
43 * \param inode device inode.
Eric Anholt6c340ea2007-08-25 20:23:09 +100044 * \param file_priv DRM file private.
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 * \param cmd command.
46 * \param arg user argument, pointing to a drm_lock structure.
47 * \return zero on success or negative number on failure.
48 *
49 * Add the current task to the lock wait queue, and attempt to take to lock.
50 */
Eric Anholt6c340ea2007-08-25 20:23:09 +100051int drm_lock(struct inode *inode, struct drm_file *file_priv,
Dave Airlieb5e89ed2005-09-25 14:28:13 +100052 unsigned int cmd, unsigned long arg)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053{
Eric Anholt6c340ea2007-08-25 20:23:09 +100054 struct drm_device *dev = file_priv->head->dev;
Dave Airlieb5e89ed2005-09-25 14:28:13 +100055 DECLARE_WAITQUEUE(entry, current);
Dave Airliec60ce622007-07-11 15:27:12 +100056 struct drm_lock lock;
Dave Airlieb5e89ed2005-09-25 14:28:13 +100057 int ret = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Eric Anholt6c340ea2007-08-25 20:23:09 +100059 ++file_priv->lock_count;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Dave Airliec60ce622007-07-11 15:27:12 +100061 if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 return -EFAULT;
63
Dave Airlieb5e89ed2005-09-25 14:28:13 +100064 if (lock.context == DRM_KERNEL_CONTEXT) {
65 DRM_ERROR("Process %d using kernel context %d\n",
66 current->pid, lock.context);
67 return -EINVAL;
68 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Dave Airlieb5e89ed2005-09-25 14:28:13 +100070 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
71 lock.context, current->pid,
72 dev->lock.hw_lock->lock, lock.flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
74 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
Dave Airlieb5e89ed2005-09-25 14:28:13 +100075 if (lock.context < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 return -EINVAL;
77
Dave Airlieb5e89ed2005-09-25 14:28:13 +100078 add_wait_queue(&dev->lock.lock_queue, &entry);
Thomas Hellstrom040ac322007-03-23 13:28:33 +110079 spin_lock(&dev->lock.spinlock);
80 dev->lock.user_waiters++;
81 spin_unlock(&dev->lock.spinlock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 for (;;) {
83 __set_current_state(TASK_INTERRUPTIBLE);
Dave Airlieb5e89ed2005-09-25 14:28:13 +100084 if (!dev->lock.hw_lock) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 /* Device has been unregistered */
86 ret = -EINTR;
87 break;
88 }
Thomas Hellstrom040ac322007-03-23 13:28:33 +110089 if (drm_lock_take(&dev->lock, lock.context)) {
Eric Anholt6c340ea2007-08-25 20:23:09 +100090 dev->lock.file_priv = file_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 dev->lock.lock_time = jiffies;
Dave Airlieb5e89ed2005-09-25 14:28:13 +100092 atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
93 break; /* Got lock */
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 }
Dave Airlieb5e89ed2005-09-25 14:28:13 +100095
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 /* Contention */
97 schedule();
Dave Airlieb5e89ed2005-09-25 14:28:13 +100098 if (signal_pending(current)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 ret = -ERESTARTSYS;
100 break;
101 }
102 }
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100103 spin_lock(&dev->lock.spinlock);
104 dev->lock.user_waiters--;
105 spin_unlock(&dev->lock.spinlock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 __set_current_state(TASK_RUNNING);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000107 remove_wait_queue(&dev->lock.lock_queue, &entry);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100109 DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" );
110 if (ret) return ret;
Dave Airlied985c102006-01-02 21:32:48 +1100111
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000112 sigemptyset(&dev->sigmask);
113 sigaddset(&dev->sigmask, SIGSTOP);
114 sigaddset(&dev->sigmask, SIGTSTP);
115 sigaddset(&dev->sigmask, SIGTTIN);
116 sigaddset(&dev->sigmask, SIGTTOU);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 dev->sigdata.context = lock.context;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000118 dev->sigdata.lock = dev->lock.hw_lock;
119 block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
120
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY))
122 dev->driver->dma_ready(dev);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000123
Dave Airlied985c102006-01-02 21:32:48 +1100124 if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) {
125 if (dev->driver->dma_quiescent(dev)) {
Dave Airliecf65f162005-11-24 21:41:14 +1100126 DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context);
Eric Anholt20caafa2007-08-25 19:22:43 +1000127 return -EBUSY;
Dave Airlied985c102006-01-02 21:32:48 +1100128 }
129 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000131 if (dev->driver->kernel_context_switch &&
132 dev->last_context != lock.context) {
133 dev->driver->kernel_context_switch(dev, dev->last_context,
134 lock.context);
135 }
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100136
Dave Airlied985c102006-01-02 21:32:48 +1100137 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138}
139
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000140/**
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 * Unlock ioctl.
142 *
143 * \param inode device inode.
Eric Anholt6c340ea2007-08-25 20:23:09 +1000144 * \param file_priv DRM file private.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 * \param cmd command.
146 * \param arg user argument, pointing to a drm_lock structure.
147 * \return zero on success or negative number on failure.
148 *
149 * Transfer and free the lock.
150 */
Eric Anholt6c340ea2007-08-25 20:23:09 +1000151int drm_unlock(struct inode *inode, struct drm_file *file_priv,
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000152 unsigned int cmd, unsigned long arg)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153{
Eric Anholt6c340ea2007-08-25 20:23:09 +1000154 struct drm_device *dev = file_priv->head->dev;
Dave Airliec60ce622007-07-11 15:27:12 +1000155 struct drm_lock lock;
Dave Airlie5c2df2b2006-10-24 11:36:59 -0700156 unsigned long irqflags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Dave Airliec60ce622007-07-11 15:27:12 +1000158 if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 return -EFAULT;
160
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000161 if (lock.context == DRM_KERNEL_CONTEXT) {
162 DRM_ERROR("Process %d using kernel context %d\n",
163 current->pid, lock.context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 return -EINVAL;
165 }
166
=?utf-8?q?Michel_D=C3=A4nzer?=2e54a002006-10-24 23:08:16 +1000167 spin_lock_irqsave(&dev->tasklet_lock, irqflags);
168
169 if (dev->locked_tasklet_func) {
170 dev->locked_tasklet_func(dev);
171
172 dev->locked_tasklet_func = NULL;
173 }
174
175 spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
176
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000177 atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
179 /* kernel_context_switch isn't used by any of the x86 drm
180 * modules but is required by the Sparc driver.
181 */
182 if (dev->driver->kernel_context_switch_unlock)
Dave Airlie0c4dd902006-12-19 17:49:44 +1100183 dev->driver->kernel_context_switch_unlock(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 else {
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100185 if (drm_lock_free(&dev->lock,lock.context)) {
186 /* FIXME: Should really bail out here. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 }
188 }
189
190 unblock_all_signals();
191 return 0;
192}
193
194/**
195 * Take the heavyweight lock.
196 *
197 * \param lock lock pointer.
198 * \param context locking context.
199 * \return one if the lock is held, or zero otherwise.
200 *
201 * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction.
202 */
Dave Airlie55910512007-07-11 16:53:40 +1000203int drm_lock_take(struct drm_lock_data *lock_data,
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100204 unsigned int context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205{
206 unsigned int old, new, prev;
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100207 volatile unsigned int *lock = &lock_data->hw_lock->lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100209 spin_lock(&lock_data->spinlock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 do {
211 old = *lock;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000212 if (old & _DRM_LOCK_HELD)
213 new = old | _DRM_LOCK_CONT;
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100214 else {
215 new = context | _DRM_LOCK_HELD |
216 ((lock_data->user_waiters + lock_data->kernel_waiters > 1) ?
217 _DRM_LOCK_CONT : 0);
218 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 prev = cmpxchg(lock, old, new);
220 } while (prev != old);
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100221 spin_unlock(&lock_data->spinlock);
222
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 if (_DRM_LOCKING_CONTEXT(old) == context) {
224 if (old & _DRM_LOCK_HELD) {
225 if (context != DRM_KERNEL_CONTEXT) {
226 DRM_ERROR("%d holds heavyweight lock\n",
227 context);
228 }
229 return 0;
230 }
231 }
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100232
233 if ((_DRM_LOCKING_CONTEXT(new)) == context && (new & _DRM_LOCK_HELD)) {
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000234 /* Have lock */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 return 1;
236 }
237 return 0;
238}
239
240/**
241 * This takes a lock forcibly and hands it to context. Should ONLY be used
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000242 * inside *_unlock to give lock to kernel before calling *_dma_schedule.
243 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 * \param dev DRM device.
245 * \param lock lock pointer.
246 * \param context locking context.
247 * \return always one.
248 *
249 * Resets the lock file pointer.
250 * Marks the lock as held by the given context, via the \p cmpxchg instruction.
251 */
Dave Airlie55910512007-07-11 16:53:40 +1000252static int drm_lock_transfer(struct drm_lock_data *lock_data,
Dave Airliec94f7022005-07-07 21:03:38 +1000253 unsigned int context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254{
255 unsigned int old, new, prev;
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100256 volatile unsigned int *lock = &lock_data->hw_lock->lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257
Eric Anholt6c340ea2007-08-25 20:23:09 +1000258 lock_data->file_priv = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 do {
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000260 old = *lock;
261 new = context | _DRM_LOCK_HELD;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 prev = cmpxchg(lock, old, new);
263 } while (prev != old);
264 return 1;
265}
266
267/**
268 * Free lock.
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000269 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 * \param dev DRM device.
271 * \param lock lock.
272 * \param context context.
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000273 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 * Resets the lock file pointer.
275 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
276 * waiting on the lock queue.
277 */
Dave Airlie55910512007-07-11 16:53:40 +1000278int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279{
280 unsigned int old, new, prev;
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100281 volatile unsigned int *lock = &lock_data->hw_lock->lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100283 spin_lock(&lock_data->spinlock);
284 if (lock_data->kernel_waiters != 0) {
285 drm_lock_transfer(lock_data, 0);
286 lock_data->idle_has_lock = 1;
287 spin_unlock(&lock_data->spinlock);
288 return 1;
289 }
290 spin_unlock(&lock_data->spinlock);
291
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 do {
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000293 old = *lock;
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100294 new = _DRM_LOCKING_CONTEXT(old);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 prev = cmpxchg(lock, old, new);
296 } while (prev != old);
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100297
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
299 DRM_ERROR("%d freed heavyweight lock held by %d\n",
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000300 context, _DRM_LOCKING_CONTEXT(old));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 return 1;
302 }
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100303 wake_up_interruptible(&lock_data->lock_queue);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 return 0;
305}
306
307/**
308 * If we get here, it means that the process has called DRM_IOCTL_LOCK
309 * without calling DRM_IOCTL_UNLOCK.
310 *
311 * If the lock is not held, then let the signal proceed as usual. If the lock
312 * is held, then set the contended flag and keep the signal blocked.
313 *
314 * \param priv pointer to a drm_sigdata structure.
315 * \return one if the signal should be delivered normally, or zero if the
316 * signal should be blocked.
317 */
Dave Airliec94f7022005-07-07 21:03:38 +1000318static int drm_notifier(void *priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319{
Dave Airlie55910512007-07-11 16:53:40 +1000320 struct drm_sigdata *s = (struct drm_sigdata *) priv;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000321 unsigned int old, new, prev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000323 /* Allow signal delivery if lock isn't held */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock)
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000325 || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context)
326 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000328 /* Otherwise, set flag to force call to
329 drmUnlock */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 do {
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000331 old = s->lock->lock;
332 new = old | _DRM_LOCK_CONT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333 prev = cmpxchg(&s->lock->lock, old, new);
334 } while (prev != old);
335 return 0;
336}
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100337
338/**
339 * This function returns immediately and takes the hw lock
340 * with the kernel context if it is free, otherwise it gets the highest priority when and if
341 * it is eventually released.
342 *
343 * This guarantees that the kernel will _eventually_ have the lock _unless_ it is held
344 * by a blocked process. (In the latter case an explicit wait for the hardware lock would cause
345 * a deadlock, which is why the "idlelock" was invented).
346 *
347 * This should be sufficient to wait for GPU idle without
348 * having to worry about starvation.
349 */
350
Dave Airlie55910512007-07-11 16:53:40 +1000351void drm_idlelock_take(struct drm_lock_data *lock_data)
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100352{
353 int ret = 0;
354
355 spin_lock(&lock_data->spinlock);
356 lock_data->kernel_waiters++;
357 if (!lock_data->idle_has_lock) {
358
359 spin_unlock(&lock_data->spinlock);
360 ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT);
361 spin_lock(&lock_data->spinlock);
362
363 if (ret == 1)
364 lock_data->idle_has_lock = 1;
365 }
366 spin_unlock(&lock_data->spinlock);
367}
368EXPORT_SYMBOL(drm_idlelock_take);
369
Dave Airlie55910512007-07-11 16:53:40 +1000370void drm_idlelock_release(struct drm_lock_data *lock_data)
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100371{
372 unsigned int old, prev;
373 volatile unsigned int *lock = &lock_data->hw_lock->lock;
374
375 spin_lock(&lock_data->spinlock);
376 if (--lock_data->kernel_waiters == 0) {
377 if (lock_data->idle_has_lock) {
378 do {
379 old = *lock;
380 prev = cmpxchg(lock, old, DRM_KERNEL_CONTEXT);
381 } while (prev != old);
382 wake_up_interruptible(&lock_data->lock_queue);
383 lock_data->idle_has_lock = 0;
384 }
385 }
386 spin_unlock(&lock_data->spinlock);
387}
388EXPORT_SYMBOL(drm_idlelock_release);
389
390
Eric Anholt6c340ea2007-08-25 20:23:09 +1000391int drm_i_have_hw_lock(struct drm_file *file_priv)
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100392{
393 DRM_DEVICE;
394
Eric Anholt6c340ea2007-08-25 20:23:09 +1000395 return (file_priv->lock_count && dev->lock.hw_lock &&
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100396 _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
Eric Anholt6c340ea2007-08-25 20:23:09 +1000397 dev->lock.file_priv == file_priv);
Thomas Hellstrom040ac322007-03-23 13:28:33 +1100398}
399
400EXPORT_SYMBOL(drm_i_have_hw_lock);