aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-queue.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-11-15 23:38:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:38:07 -0500
commitee2d64f5ccc71b5c5191e92ea91a12b65f9ca060 (patch)
tree0f01253a1e517f9c1f705901d873ca25bb2c872f /drivers/media/video/cx18/cx18-queue.c
parentba38ee8ebe4a42ce2213802152b0b86a95dc109f (diff)
V4L/DVB (9720): cx18: Major rewrite of interrupt handling for incoming mailbox processing
A major rewrite of interrupt handling for incoming mailbox processing, to split the timing critical steps from the the deferrable steps as the sending XPU on the CX23418 will time out and overwrite our incoming mailboxes rather quickly. Setup a pool of work "order forms" for the irq handler to send jobs to the new work handler routine which uses the kernel default work queue to do the deferrable work. Started optimizing some of the cx18-io calls as they are now the low hanging fruit for recoving microseconds back from the timeline. Future optimizations will get rid of mmio read retries, mmio stats logging, and combine smaller functions in the irq path into the larger ones to save ~2 us each. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-queue.c')
-rw-r--r--drivers/media/video/cx18/cx18-queue.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c
index 174682c2582f..c5a81aed61bb 100644
--- a/drivers/media/video/cx18/cx18-queue.c
+++ b/drivers/media/video/cx18/cx18-queue.c
@@ -75,30 +75,37 @@ struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q)
75 return buf; 75 return buf;
76} 76}
77 77
78struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id, 78struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id,
79 u32 bytesused) 79 u32 bytesused)
80{ 80{
81 struct cx18 *cx = s->cx; 81 struct cx18 *cx = s->cx;
82 struct list_head *p; 82 struct list_head *p;
83 unsigned long flags = 0;
83 84
84 spin_lock(&s->qlock); 85 spin_lock_irqsave(&s->qlock, flags);
85 list_for_each(p, &s->q_free.list) { 86 list_for_each(p, &s->q_free.list) {
86 struct cx18_buffer *buf = 87 struct cx18_buffer *buf =
87 list_entry(p, struct cx18_buffer, list); 88 list_entry(p, struct cx18_buffer, list);
88 89
89 if (buf->id != id) 90 if (buf->id != id) {
91 CX18_DEBUG_HI_DMA("Skipping buffer %d searching for %d "
92 "in stream %s q_free\n", buf->id, id,
93 s->name);
90 continue; 94 continue;
95 }
91 96
92 buf->bytesused = bytesused; 97 buf->bytesused = bytesused;
93 atomic_dec(&s->q_free.buffers); 98 if (s->type != CX18_ENC_STREAM_TYPE_TS) {
94 atomic_inc(&s->q_full.buffers); 99 atomic_dec(&s->q_free.buffers);
95 s->q_full.bytesused += buf->bytesused; 100 atomic_inc(&s->q_full.buffers);
96 list_move_tail(&buf->list, &s->q_full.list); 101 s->q_full.bytesused += buf->bytesused;
102 list_move_tail(&buf->list, &s->q_full.list);
103 }
97 104
98 spin_unlock(&s->qlock); 105 spin_unlock_irqrestore(&s->qlock, flags);
99 return buf; 106 return buf;
100 } 107 }
101 spin_unlock(&s->qlock); 108 spin_unlock_irqrestore(&s->qlock, flags);
102 CX18_ERR("Cannot find buffer %d for stream %s\n", id, s->name); 109 CX18_ERR("Cannot find buffer %d for stream %s\n", id, s->name);
103 return NULL; 110 return NULL;
104} 111}