aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-streams.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-04-13 22:08:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:44 -0400
commit40c5520f55924ba87090d0d93222baad74202559 (patch)
tree731576eb5bb3c37df60c8cc78adbfc4d18bc0dd4 /drivers/media/video/cx18/cx18-streams.c
parent5f0a3cfcfd315d87de8f80af49b114daf7137823 (diff)
V4L/DVB (11618): cx18: Convert per stream mutex locks to per queue spin locks
To avoid sleeps in providing buffers to user space and in handling incoming buffers from the capture unit, converted the per stream mutex for locking queues to 3 spin locks. There is now a spin lock per queue to increase concurrency when moving buffers around. Also simplified queue manipulations and buffer handling of incoming buffers of data from the capture unit. 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-streams.c')
-rw-r--r--drivers/media/video/cx18/cx18-streams.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index bbeb01c5cf32..e1934e9cfdc8 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -116,11 +116,13 @@ static void cx18_stream_init(struct cx18 *cx, int type)
116 s->buffers = cx->stream_buffers[type]; 116 s->buffers = cx->stream_buffers[type];
117 s->buf_size = cx->stream_buf_size[type]; 117 s->buf_size = cx->stream_buf_size[type];
118 118
119 mutex_init(&s->qlock);
120 init_waitqueue_head(&s->waitq); 119 init_waitqueue_head(&s->waitq);
121 s->id = -1; 120 s->id = -1;
121 spin_lock_init(&s->q_free.lock);
122 cx18_queue_init(&s->q_free); 122 cx18_queue_init(&s->q_free);
123 spin_lock_init(&s->q_busy.lock);
123 cx18_queue_init(&s->q_busy); 124 cx18_queue_init(&s->q_busy);
125 spin_lock_init(&s->q_full.lock);
124 cx18_queue_init(&s->q_full); 126 cx18_queue_init(&s->q_full);
125} 127}
126 128
@@ -685,13 +687,13 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
685 687
686 /* Init all the cpu_mdls for this stream */ 688 /* Init all the cpu_mdls for this stream */
687 cx18_flush_queues(s); 689 cx18_flush_queues(s);
688 mutex_lock(&s->qlock); 690 spin_lock(&s->q_free.lock);
689 list_for_each_entry(buf, &s->q_free.list, list) { 691 list_for_each_entry(buf, &s->q_free.list, list) {
690 cx18_writel(cx, buf->dma_handle, 692 cx18_writel(cx, buf->dma_handle,
691 &cx->scb->cpu_mdl[buf->id].paddr); 693 &cx->scb->cpu_mdl[buf->id].paddr);
692 cx18_writel(cx, s->buf_size, &cx->scb->cpu_mdl[buf->id].length); 694 cx18_writel(cx, s->buf_size, &cx->scb->cpu_mdl[buf->id].length);
693 } 695 }
694 mutex_unlock(&s->qlock); 696 spin_unlock(&s->q_free.lock);
695 _cx18_stream_load_fw_queue(s); 697 _cx18_stream_load_fw_queue(s);
696 698
697 /* begin_capture */ 699 /* begin_capture */