1 /* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*-
2 * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
3 * Revised: Fri Aug 20 11:31:45 1999 by faith@precisioninsight.com
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
27 * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_dma.c,v 1.8 1999/08/30 13:05:00 faith Exp $
32 #define __NO_VERSION__
34 #include "gamma_drv.h"
36 #include <linux/interrupt.h> /* For task queue support */
39 /* WARNING!!! MAGIC NUMBER!!! The number of regions already added to the
40 kernel must be specified here. Currently, the number is 2. This must
41 match the order the X server uses for instantiating register regions ,
42 or must be passed in a new ioctl. */
43 #define GAMMA_REG(reg) \
47 : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3))))
49 #define GAMMA_OFF(reg) \
58 #define GAMMA_BASE(reg) ((unsigned long)dev->maplist[GAMMA_REG(reg)]->handle)
59 #define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg))
60 #define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg)
61 #define GAMMA_READ(reg) GAMMA_DEREF(reg)
62 #define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0)
64 #define GAMMA_BROADCASTMASK 0x9378
65 #define GAMMA_COMMANDINTENABLE 0x0c48
66 #define GAMMA_DMAADDRESS 0x0028
67 #define GAMMA_DMACOUNT 0x0030
68 #define GAMMA_FILTERMODE 0x8c00
69 #define GAMMA_GCOMMANDINTFLAGS 0x0c50
70 #define GAMMA_GCOMMANDMODE 0x0c40
71 #define GAMMA_GCOMMANDSTATUS 0x0c60
72 #define GAMMA_GDELAYTIMER 0x0c38
73 #define GAMMA_GDMACONTROL 0x0060
74 #define GAMMA_GINTENABLE 0x0808
75 #define GAMMA_GINTFLAGS 0x0810
76 #define GAMMA_INFIFOSPACE 0x0018
77 #define GAMMA_OUTFIFOWORDS 0x0020
78 #define GAMMA_OUTPUTFIFO 0x2000
79 #define GAMMA_SYNC 0x8c40
80 #define GAMMA_SYNC_TAG 0x0188
82 static inline void gamma_dma_dispatch(drm_device_t
*dev
, unsigned long address
,
85 GAMMA_WRITE(GAMMA_DMAADDRESS
, virt_to_phys((void *)address
));
86 while (GAMMA_READ(GAMMA_GCOMMANDSTATUS
) != 4)
88 GAMMA_WRITE(GAMMA_DMACOUNT
, length
/ 4);
91 static inline void gamma_dma_quiescent(drm_device_t
*dev
)
93 while (GAMMA_READ(GAMMA_DMACOUNT
))
95 while (GAMMA_READ(GAMMA_INFIFOSPACE
) < 3)
97 GAMMA_WRITE(GAMMA_BROADCASTMASK
, 3);
98 GAMMA_WRITE(GAMMA_FILTERMODE
, 1 << 10);
99 GAMMA_WRITE(GAMMA_SYNC
, 0);
101 /* Read from first MX */
103 while (!GAMMA_READ(GAMMA_OUTFIFOWORDS
))
105 } while (GAMMA_READ(GAMMA_OUTPUTFIFO
) != GAMMA_SYNC_TAG
);
108 /* Read from second MX */
110 while (!GAMMA_READ(GAMMA_OUTFIFOWORDS
+ 0x10000))
112 } while (GAMMA_READ(GAMMA_OUTPUTFIFO
+ 0x10000) != GAMMA_SYNC_TAG
);
115 static inline void gamma_dma_ready(drm_device_t
*dev
)
117 while (GAMMA_READ(GAMMA_DMACOUNT
))
121 static inline int gamma_dma_is_ready(drm_device_t
*dev
)
123 return !GAMMA_READ(GAMMA_DMACOUNT
);
126 static void gamma_dma_service(int irq
, void *device
, struct pt_regs
*regs
)
128 drm_device_t
*dev
= (drm_device_t
*)device
;
129 drm_device_dma_t
*dma
= dev
->dma
;
131 atomic_inc(&dev
->total_irq
);
132 GAMMA_WRITE(GAMMA_GDELAYTIMER
, 0xc350/2); /* 0x05S */
133 GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS
, 8);
134 GAMMA_WRITE(GAMMA_GINTFLAGS
, 0x2001);
135 if (gamma_dma_is_ready(dev
)) {
136 /* Free previous buffer */
137 if (test_and_set_bit(0, &dev
->dma_flag
)) {
138 atomic_inc(&dma
->total_missed_free
);
141 if (dma
->this_buffer
) {
142 drm_free_buffer(dev
, dma
->this_buffer
);
143 dma
->this_buffer
= NULL
;
145 clear_bit(0, &dev
->dma_flag
);
147 /* Dispatch new buffer */
148 queue_task(&dev
->tq
, &tq_immediate
);
149 mark_bh(IMMEDIATE_BH
);
153 /* Only called by gamma_dma_schedule. */
154 static int gamma_do_dma(drm_device_t
*dev
, int locked
)
156 unsigned long address
;
157 unsigned long length
;
160 drm_device_dma_t
*dma
= dev
->dma
;
161 #if DRM_DMA_HISTOGRAM
162 cycles_t dma_start
, dma_stop
;
165 if (test_and_set_bit(0, &dev
->dma_flag
)) {
166 atomic_inc(&dma
->total_missed_dma
);
170 #if DRM_DMA_HISTOGRAM
171 dma_start
= get_cycles();
174 if (!dma
->next_buffer
) {
175 DRM_ERROR("No next_buffer\n");
176 clear_bit(0, &dev
->dma_flag
);
180 buf
= dma
->next_buffer
;
181 address
= (unsigned long)buf
->address
;
184 DRM_DEBUG("context %d, buffer %d (%ld bytes)\n",
185 buf
->context
, buf
->idx
, length
);
187 if (buf
->list
== DRM_LIST_RECLAIM
) {
188 drm_clear_next_buffer(dev
);
189 drm_free_buffer(dev
, buf
);
190 clear_bit(0, &dev
->dma_flag
);
195 DRM_ERROR("0 length buffer\n");
196 drm_clear_next_buffer(dev
);
197 drm_free_buffer(dev
, buf
);
198 clear_bit(0, &dev
->dma_flag
);
202 if (!gamma_dma_is_ready(dev
)) {
203 clear_bit(0, &dev
->dma_flag
);
207 if (buf
->while_locked
) {
208 if (!_DRM_LOCK_IS_HELD(dev
->lock
.hw_lock
->lock
)) {
209 DRM_ERROR("Dispatching buffer %d from pid %d"
210 " \"while locked\", but no lock held\n",
214 if (!locked
&& !drm_lock_take(&dev
->lock
.hw_lock
->lock
,
215 DRM_KERNEL_CONTEXT
)) {
216 atomic_inc(&dma
->total_missed_lock
);
217 clear_bit(0, &dev
->dma_flag
);
222 if (dev
->last_context
!= buf
->context
223 && !(dev
->queuelist
[buf
->context
]->flags
224 & _DRM_CONTEXT_PRESERVED
)) {
225 /* PRE: dev->last_context != buf->context */
226 if (drm_context_switch(dev
, dev
->last_context
, buf
->context
)) {
227 drm_clear_next_buffer(dev
);
228 drm_free_buffer(dev
, buf
);
233 /* POST: we will wait for the context
234 switch and will dispatch on a later call
235 when dev->last_context == buf->context.
236 NOTE WE HOLD THE LOCK THROUGHOUT THIS
240 drm_clear_next_buffer(dev
);
243 buf
->list
= DRM_LIST_PEND
;
244 #if DRM_DMA_HISTOGRAM
245 buf
->time_dispatched
= get_cycles();
248 gamma_dma_dispatch(dev
, address
, length
);
249 drm_free_buffer(dev
, dma
->this_buffer
);
250 dma
->this_buffer
= buf
;
252 atomic_add(length
, &dma
->total_bytes
);
253 atomic_inc(&dma
->total_dmas
);
255 if (!buf
->while_locked
&& !dev
->context_flag
&& !locked
) {
256 if (drm_lock_free(dev
, &dev
->lock
.hw_lock
->lock
,
257 DRM_KERNEL_CONTEXT
)) {
263 clear_bit(0, &dev
->dma_flag
);
265 #if DRM_DMA_HISTOGRAM
266 dma_stop
= get_cycles();
267 atomic_inc(&dev
->histo
.dma
[drm_histogram_slot(dma_stop
- dma_start
)]);
273 static void gamma_dma_schedule_timer_wrapper(unsigned long dev
)
275 gamma_dma_schedule((drm_device_t
*)dev
, 0);
278 static void gamma_dma_schedule_tq_wrapper(void *dev
)
280 gamma_dma_schedule(dev
, 0);
283 int gamma_dma_schedule(drm_device_t
*dev
, int locked
)
292 drm_device_dma_t
*dma
= dev
->dma
;
293 #if DRM_DMA_HISTOGRAM
294 cycles_t schedule_start
;
297 if (test_and_set_bit(0, &dev
->interrupt_flag
)) {
299 atomic_inc(&dma
->total_missed_sched
);
302 missed
= atomic_read(&dma
->total_missed_sched
);
304 #if DRM_DMA_HISTOGRAM
305 schedule_start
= get_cycles();
309 if (dev
->context_flag
) {
310 clear_bit(0, &dev
->interrupt_flag
);
313 if (dma
->next_buffer
) {
314 /* Unsent buffer that was previously
315 selected, but that couldn't be sent
316 because the lock could not be obtained
317 or the DMA engine wasn't ready. Try
319 atomic_inc(&dma
->total_tried
);
320 if (!(retcode
= gamma_do_dma(dev
, locked
))) {
321 atomic_inc(&dma
->total_hit
);
326 next
= drm_select_queue(dev
,
327 gamma_dma_schedule_timer_wrapper
);
329 q
= dev
->queuelist
[next
];
330 buf
= drm_waitlist_get(&q
->waitlist
);
331 dma
->next_buffer
= buf
;
333 if (buf
&& buf
->list
== DRM_LIST_RECLAIM
) {
334 drm_clear_next_buffer(dev
);
335 drm_free_buffer(dev
, buf
);
338 } while (next
>= 0 && !dma
->next_buffer
);
339 if (dma
->next_buffer
) {
340 if (!(retcode
= gamma_do_dma(dev
, locked
))) {
347 if (missed
!= atomic_read(&dma
->total_missed_sched
)) {
348 atomic_inc(&dma
->total_lost
);
349 if (gamma_dma_is_ready(dev
)) goto again
;
351 if (processed
&& gamma_dma_is_ready(dev
)) {
352 atomic_inc(&dma
->total_lost
);
358 clear_bit(0, &dev
->interrupt_flag
);
360 #if DRM_DMA_HISTOGRAM
361 atomic_inc(&dev
->histo
.schedule
[drm_histogram_slot(get_cycles()
367 static int gamma_dma_priority(drm_device_t
*dev
, drm_dma_t
*d
)
369 unsigned long address
;
370 unsigned long length
;
376 drm_buf_t
*last_buf
= NULL
;
377 drm_device_dma_t
*dma
= dev
->dma
;
378 DECLARE_WAITQUEUE(entry
, current
);
380 /* Turn off interrupt handling */
381 while (test_and_set_bit(0, &dev
->interrupt_flag
)) {
383 if (signal_pending(current
)) return -EINTR
;
385 if (!(d
->flags
& _DRM_DMA_WHILE_LOCKED
)) {
386 while (!drm_lock_take(&dev
->lock
.hw_lock
->lock
,
387 DRM_KERNEL_CONTEXT
)) {
389 if (signal_pending(current
)) {
390 clear_bit(0, &dev
->interrupt_flag
);
396 atomic_inc(&dma
->total_prio
);
398 for (i
= 0; i
< d
->send_count
; i
++) {
399 idx
= d
->send_indices
[i
];
400 if (idx
< 0 || idx
>= dma
->buf_count
) {
401 DRM_ERROR("Index %d (of %d max)\n",
402 d
->send_indices
[i
], dma
->buf_count
- 1);
405 buf
= dma
->buflist
[ idx
];
406 if (buf
->pid
!= current
->pid
) {
407 DRM_ERROR("Process %d using buffer owned by %d\n",
408 current
->pid
, buf
->pid
);
412 if (buf
->list
!= DRM_LIST_NONE
) {
413 DRM_ERROR("Process %d using %d's buffer on list %d\n",
414 current
->pid
, buf
->pid
, buf
->list
);
418 /* This isn't a race condition on
419 buf->list, since our concern is the
420 buffer reclaim during the time the
421 process closes the /dev/drm? handle, so
422 it can't also be doing DMA. */
423 buf
->list
= DRM_LIST_PRIO
;
424 buf
->used
= d
->send_sizes
[i
];
425 buf
->context
= d
->context
;
426 buf
->while_locked
= d
->flags
& _DRM_DMA_WHILE_LOCKED
;
427 address
= (unsigned long)buf
->address
;
430 DRM_ERROR("0 length buffer\n");
433 DRM_ERROR("Sending pending buffer:"
434 " buffer %d, offset %d\n",
435 d
->send_indices
[i
], i
);
440 DRM_ERROR("Sending waiting buffer:"
441 " buffer %d, offset %d\n",
442 d
->send_indices
[i
], i
);
448 if (dev
->last_context
!= buf
->context
449 && !(dev
->queuelist
[buf
->context
]->flags
450 & _DRM_CONTEXT_PRESERVED
)) {
451 add_wait_queue(&dev
->context_wait
, &entry
);
452 current
->state
= TASK_INTERRUPTIBLE
;
453 /* PRE: dev->last_context != buf->context */
454 drm_context_switch(dev
, dev
->last_context
,
456 /* POST: we will wait for the context
457 switch and will dispatch on a later call
458 when dev->last_context == buf->context.
459 NOTE WE HOLD THE LOCK THROUGHOUT THIS
462 current
->state
= TASK_RUNNING
;
463 remove_wait_queue(&dev
->context_wait
, &entry
);
464 if (signal_pending(current
)) {
468 if (dev
->last_context
!= buf
->context
) {
469 DRM_ERROR("Context mismatch: %d %d\n",
475 #if DRM_DMA_HISTOGRAM
476 buf
->time_queued
= get_cycles();
477 buf
->time_dispatched
= buf
->time_queued
;
479 gamma_dma_dispatch(dev
, address
, length
);
480 atomic_add(length
, &dma
->total_bytes
);
481 atomic_inc(&dma
->total_dmas
);
484 drm_free_buffer(dev
, last_buf
);
492 gamma_dma_ready(dev
);
493 drm_free_buffer(dev
, last_buf
);
496 if (must_free
&& !dev
->context_flag
) {
497 if (drm_lock_free(dev
, &dev
->lock
.hw_lock
->lock
,
498 DRM_KERNEL_CONTEXT
)) {
502 clear_bit(0, &dev
->interrupt_flag
);
506 static int gamma_dma_send_buffers(drm_device_t
*dev
, drm_dma_t
*d
)
508 DECLARE_WAITQUEUE(entry
, current
);
509 drm_buf_t
*last_buf
= NULL
;
511 drm_device_dma_t
*dma
= dev
->dma
;
513 if (d
->flags
& _DRM_DMA_BLOCK
) {
514 last_buf
= dma
->buflist
[d
->send_indices
[d
->send_count
-1]];
515 add_wait_queue(&last_buf
->dma_wait
, &entry
);
518 if ((retcode
= drm_dma_enqueue(dev
, d
))) {
519 if (d
->flags
& _DRM_DMA_BLOCK
)
520 remove_wait_queue(&last_buf
->dma_wait
, &entry
);
524 gamma_dma_schedule(dev
, 0);
526 if (d
->flags
& _DRM_DMA_BLOCK
) {
527 DRM_DEBUG("%d waiting\n", current
->pid
);
528 current
->state
= TASK_INTERRUPTIBLE
;
530 if (!last_buf
->waiting
531 && !last_buf
->pending
)
532 break; /* finished */
534 if (signal_pending(current
)) {
535 retcode
= -EINTR
; /* Can't restart */
539 current
->state
= TASK_RUNNING
;
540 DRM_DEBUG("%d running\n", current
->pid
);
541 remove_wait_queue(&last_buf
->dma_wait
, &entry
);
543 || (last_buf
->list
==DRM_LIST_PEND
&& !last_buf
->pending
)) {
544 if (!waitqueue_active(&last_buf
->dma_wait
)) {
545 drm_free_buffer(dev
, last_buf
);
549 DRM_ERROR("ctx%d w%d p%d c%d i%d l%d %d/%d\n",
553 DRM_WAITCOUNT(dev
, d
->context
),
563 int gamma_dma(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
566 drm_file_t
*priv
= filp
->private_data
;
567 drm_device_t
*dev
= priv
->dev
;
568 drm_device_dma_t
*dma
= dev
->dma
;
572 copy_from_user_ret(&d
, (drm_dma_t
*)arg
, sizeof(d
), -EFAULT
);
573 DRM_DEBUG("%d %d: %d send, %d req\n",
574 current
->pid
, d
.context
, d
.send_count
, d
.request_count
);
576 if (d
.context
== DRM_KERNEL_CONTEXT
|| d
.context
>= dev
->queue_slots
) {
577 DRM_ERROR("Process %d using context %d\n",
578 current
->pid
, d
.context
);
581 if (d
.send_count
< 0 || d
.send_count
> dma
->buf_count
) {
582 DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n",
583 current
->pid
, d
.send_count
, dma
->buf_count
);
586 if (d
.request_count
< 0 || d
.request_count
> dma
->buf_count
) {
587 DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
588 current
->pid
, d
.request_count
, dma
->buf_count
);
593 if (d
.flags
& _DRM_DMA_PRIORITY
)
594 retcode
= gamma_dma_priority(dev
, &d
);
596 retcode
= gamma_dma_send_buffers(dev
, &d
);
601 if (!retcode
&& d
.request_count
) {
602 retcode
= drm_dma_get_buffers(dev
, &d
);
605 DRM_DEBUG("%d returning, granted = %d\n",
606 current
->pid
, d
.granted_count
);
607 copy_to_user_ret((drm_dma_t
*)arg
, &d
, sizeof(d
), -EFAULT
);
612 int gamma_irq_install(drm_device_t
*dev
, int irq
)
616 if (!irq
) return -EINVAL
;
618 down(&dev
->struct_sem
);
620 up(&dev
->struct_sem
);
624 up(&dev
->struct_sem
);
626 DRM_DEBUG("%d\n", irq
);
628 dev
->context_flag
= 0;
629 dev
->interrupt_flag
= 0;
632 dev
->dma
->next_buffer
= NULL
;
633 dev
->dma
->next_queue
= NULL
;
634 dev
->dma
->this_buffer
= NULL
;
638 dev
->tq
.routine
= gamma_dma_schedule_tq_wrapper
;
642 /* Before installing handler */
643 GAMMA_WRITE(GAMMA_GCOMMANDMODE
, 0);
644 GAMMA_WRITE(GAMMA_GDMACONTROL
, 0);
646 /* Install handler */
647 if ((retcode
= request_irq(dev
->irq
,
652 down(&dev
->struct_sem
);
654 up(&dev
->struct_sem
);
658 /* After installing handler */
659 GAMMA_WRITE(GAMMA_GINTENABLE
, 0x2001);
660 GAMMA_WRITE(GAMMA_COMMANDINTENABLE
, 0x0008);
661 GAMMA_WRITE(GAMMA_GDELAYTIMER
, 0x39090);
666 int gamma_irq_uninstall(drm_device_t
*dev
)
670 down(&dev
->struct_sem
);
673 up(&dev
->struct_sem
);
675 if (!irq
) return -EINVAL
;
677 DRM_DEBUG("%d\n", irq
);
679 GAMMA_WRITE(GAMMA_GDELAYTIMER
, 0);
680 GAMMA_WRITE(GAMMA_COMMANDINTENABLE
, 0);
681 GAMMA_WRITE(GAMMA_GINTENABLE
, 0);
688 int gamma_control(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
691 drm_file_t
*priv
= filp
->private_data
;
692 drm_device_t
*dev
= priv
->dev
;
696 copy_from_user_ret(&ctl
, (drm_control_t
*)arg
, sizeof(ctl
), -EFAULT
);
699 case DRM_INST_HANDLER
:
700 if ((retcode
= gamma_irq_install(dev
, ctl
.irq
)))
703 case DRM_UNINST_HANDLER
:
704 if ((retcode
= gamma_irq_uninstall(dev
)))
713 int gamma_lock(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
716 drm_file_t
*priv
= filp
->private_data
;
717 drm_device_t
*dev
= priv
->dev
;
718 DECLARE_WAITQUEUE(entry
, current
);
722 #if DRM_DMA_HISTOGRAM
725 dev
->lck_start
= start
= get_cycles();
728 copy_from_user_ret(&lock
, (drm_lock_t
*)arg
, sizeof(lock
), -EFAULT
);
730 if (lock
.context
== DRM_KERNEL_CONTEXT
) {
731 DRM_ERROR("Process %d using kernel context %d\n",
732 current
->pid
, lock
.context
);
736 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
737 lock
.context
, current
->pid
, dev
->lock
.hw_lock
->lock
,
740 if (lock
.context
< 0 || lock
.context
>= dev
->queue_count
)
742 q
= dev
->queuelist
[lock
.context
];
744 ret
= drm_flush_block_and_flush(dev
, lock
.context
, lock
.flags
);
747 if (_DRM_LOCKING_CONTEXT(dev
->lock
.hw_lock
->lock
)
749 long j
= jiffies
- dev
->lock
.lock_time
;
751 if (j
> 0 && j
<= DRM_LOCK_SLICE
) {
752 /* Can't take lock if we just had it and
753 there is contention. */
754 current
->state
= TASK_INTERRUPTIBLE
;
758 add_wait_queue(&dev
->lock
.lock_queue
, &entry
);
760 if (!dev
->lock
.hw_lock
) {
761 /* Device has been unregistered */
765 if (drm_lock_take(&dev
->lock
.hw_lock
->lock
,
767 dev
->lock
.pid
= current
->pid
;
768 dev
->lock
.lock_time
= jiffies
;
769 atomic_inc(&dev
->total_locks
);
770 atomic_inc(&q
->total_locks
);
771 break; /* Got lock */
775 atomic_inc(&dev
->total_sleeps
);
776 current
->state
= TASK_INTERRUPTIBLE
;
778 if (signal_pending(current
)) {
783 current
->state
= TASK_RUNNING
;
784 remove_wait_queue(&dev
->lock
.lock_queue
, &entry
);
787 drm_flush_unblock(dev
, lock
.context
, lock
.flags
); /* cleanup phase */
790 if (lock
.flags
& _DRM_LOCK_READY
)
791 gamma_dma_ready(dev
);
792 if (lock
.flags
& _DRM_LOCK_QUIESCENT
)
793 gamma_dma_quiescent(dev
);
795 DRM_DEBUG("%d %s\n", lock
.context
, ret
? "interrupted" : "has lock");
797 #if DRM_DMA_HISTOGRAM
798 atomic_inc(&dev
->histo
.lacq
[drm_histogram_slot(get_cycles() - start
)]);