aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-streams.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-12-07 21:30:17 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:38:29 -0500
commit6ecd86dcc838fa446ec86334a9fe0c1e415e3514 (patch)
treedf04619a856f7adaa5cfed62df396a2aa2375c67 /drivers/media/video/cx18/cx18-streams.c
parent66c2a6b0bc0b394d215768610d96f44cf97052ac (diff)
V4L/DVB (9802): cx18: Add module parameters for finer control over buffer allocations
cx18: Add module parameters for finer control over buffer allocations. User now has the option of setting smaller buffers to get lower latency transfers from the encoder. User can also now set the number of buffers used for a stream explicitly. 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.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 6b0b7f751f20..d2690ccdf327 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -111,7 +111,6 @@ static void cx18_stream_init(struct cx18 *cx, int type)
111{ 111{
112 struct cx18_stream *s = &cx->streams[type]; 112 struct cx18_stream *s = &cx->streams[type];
113 struct video_device *dev = s->v4l2dev; 113 struct video_device *dev = s->v4l2dev;
114 u32 max_size = cx->options.megabytes[type] * 1024 * 1024;
115 114
116 /* we need to keep v4l2dev, so restore it afterwards */ 115 /* we need to keep v4l2dev, so restore it afterwards */
117 memset(s, 0, sizeof(*s)); 116 memset(s, 0, sizeof(*s));
@@ -124,9 +123,9 @@ static void cx18_stream_init(struct cx18 *cx, int type)
124 s->handle = CX18_INVALID_TASK_HANDLE; 123 s->handle = CX18_INVALID_TASK_HANDLE;
125 124
126 s->dma = cx18_stream_info[type].dma; 125 s->dma = cx18_stream_info[type].dma;
126 s->buffers = cx->stream_buffers[type];
127 s->buf_size = cx->stream_buf_size[type]; 127 s->buf_size = cx->stream_buf_size[type];
128 if (s->buf_size) 128
129 s->buffers = max_size / s->buf_size;
130 mutex_init(&s->qlock); 129 mutex_init(&s->qlock);
131 init_waitqueue_head(&s->waitq); 130 init_waitqueue_head(&s->waitq);
132 s->id = -1; 131 s->id = -1;
@@ -162,7 +161,7 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
162 /* User explicitly selected 0 buffers for these streams, so don't 161 /* User explicitly selected 0 buffers for these streams, so don't
163 create them. */ 162 create them. */
164 if (cx18_stream_info[type].dma != PCI_DMA_NONE && 163 if (cx18_stream_info[type].dma != PCI_DMA_NONE &&
165 cx->options.megabytes[type] == 0) { 164 cx->stream_buffers[type] == 0) {
166 CX18_INFO("Disabled %s device\n", cx18_stream_info[type].name); 165 CX18_INFO("Disabled %s device\n", cx18_stream_info[type].name);
167 return 0; 166 return 0;
168 } 167 }
@@ -262,8 +261,9 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
262 261
263 switch (vfl_type) { 262 switch (vfl_type) {
264 case VFL_TYPE_GRABBER: 263 case VFL_TYPE_GRABBER:
265 CX18_INFO("Registered device video%d for %s (%d MB)\n", 264 CX18_INFO("Registered device video%d for %s (%d x %d kB)\n",
266 num, s->name, cx->options.megabytes[type]); 265 num, s->name, cx->stream_buffers[type],
266 cx->stream_buf_size[type]/1024);
267 break; 267 break;
268 268
269 case VFL_TYPE_RADIO: 269 case VFL_TYPE_RADIO:
@@ -272,10 +272,11 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
272 break; 272 break;
273 273
274 case VFL_TYPE_VBI: 274 case VFL_TYPE_VBI:
275 if (cx->options.megabytes[type]) 275 if (cx->stream_buffers[type])
276 CX18_INFO("Registered device vbi%d for %s (%d MB)\n", 276 CX18_INFO("Registered device vbi%d for %s "
277 num, 277 "(%d x %d bytes)\n",
278 s->name, cx->options.megabytes[type]); 278 num, s->name, cx->stream_buffers[type],
279 cx->stream_buf_size[type]);
279 else 280 else
280 CX18_INFO("Registered device vbi%d for %s\n", 281 CX18_INFO("Registered device vbi%d for %s\n",
281 num, s->name); 282 num, s->name);