aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-08-19 04:32:33 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:05:41 -0400
commit313e91e824c0c595dec3740c0c87f55eea6bdb3f (patch)
tree5e92f0e39e117c724550e0e7c8008717d287740b /drivers/media/video/ivtv
parent2ce55b606b29c6ab0c8583772f6807b49cc89372 (diff)
V4L/DVB (6054): ivtv: specify some stream sizes in kB instead of MB
Some streams (PCM, VBI decoding) do not need that much memory, so specify the allocated memory in kB instead of MB to limit memory usage. E.g. 1 MB is overkill for the VBI decoding stream, 64 kB is enough. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c18
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h8
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c14
3 files changed, 21 insertions, 19 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 8086c62e7545..3591518ed358 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -208,7 +208,7 @@ MODULE_PARM_DESC(enc_vbi_buffers,
208 "Encoder VBI Buffers (in MB)\n" 208 "Encoder VBI Buffers (in MB)\n"
209 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_ENC_VBI_BUFFERS)); 209 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_ENC_VBI_BUFFERS));
210MODULE_PARM_DESC(enc_pcm_buffers, 210MODULE_PARM_DESC(enc_pcm_buffers,
211 "Encoder PCM buffers (in MB)\n" 211 "Encoder PCM buffers (in kB)\n"
212 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_ENC_PCM_BUFFERS)); 212 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_ENC_PCM_BUFFERS));
213MODULE_PARM_DESC(dec_mpg_buffers, 213MODULE_PARM_DESC(dec_mpg_buffers,
214 "Decoder MPG buffers (in MB)\n" 214 "Decoder MPG buffers (in MB)\n"
@@ -217,7 +217,7 @@ MODULE_PARM_DESC(dec_yuv_buffers,
217 "Decoder YUV buffers (in MB)\n" 217 "Decoder YUV buffers (in MB)\n"
218 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_DEC_YUV_BUFFERS)); 218 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_DEC_YUV_BUFFERS));
219MODULE_PARM_DESC(dec_vbi_buffers, 219MODULE_PARM_DESC(dec_vbi_buffers,
220 "Decoder VBI buffers (in MB)\n" 220 "Decoder VBI buffers (in kB)\n"
221 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_DEC_VBI_BUFFERS)); 221 "\t\t\tDefault: " __stringify(IVTV_DEFAULT_DEC_VBI_BUFFERS));
222MODULE_PARM_DESC(newi2c, 222MODULE_PARM_DESC(newi2c,
223 "Use new I2C implementation\n" 223 "Use new I2C implementation\n"
@@ -547,13 +547,13 @@ static void ivtv_process_options(struct ivtv *itv)
547 const char *chipname; 547 const char *chipname;
548 int i, j; 548 int i, j;
549 549
550 itv->options.megabytes[IVTV_ENC_STREAM_TYPE_MPG] = enc_mpg_buffers; 550 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_MPG] = enc_mpg_buffers * 1024;
551 itv->options.megabytes[IVTV_ENC_STREAM_TYPE_YUV] = enc_yuv_buffers; 551 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_YUV] = enc_yuv_buffers * 1024;
552 itv->options.megabytes[IVTV_ENC_STREAM_TYPE_VBI] = enc_vbi_buffers; 552 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_VBI] = enc_vbi_buffers * 1024;
553 itv->options.megabytes[IVTV_ENC_STREAM_TYPE_PCM] = enc_pcm_buffers; 553 itv->options.kilobytes[IVTV_ENC_STREAM_TYPE_PCM] = enc_pcm_buffers;
554 itv->options.megabytes[IVTV_DEC_STREAM_TYPE_MPG] = dec_mpg_buffers; 554 itv->options.kilobytes[IVTV_DEC_STREAM_TYPE_MPG] = dec_mpg_buffers * 1024;
555 itv->options.megabytes[IVTV_DEC_STREAM_TYPE_YUV] = dec_yuv_buffers; 555 itv->options.kilobytes[IVTV_DEC_STREAM_TYPE_YUV] = dec_yuv_buffers * 1024;
556 itv->options.megabytes[IVTV_DEC_STREAM_TYPE_VBI] = dec_vbi_buffers; 556 itv->options.kilobytes[IVTV_DEC_STREAM_TYPE_VBI] = dec_vbi_buffers;
557 itv->options.cardtype = cardtype[itv->num]; 557 itv->options.cardtype = cardtype[itv->num];
558 itv->options.tuner = tuner[itv->num]; 558 itv->options.tuner = tuner[itv->num];
559 itv->options.radio = radio[itv->num]; 559 itv->options.radio = radio[itv->num];
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index e80f9f65a905..783fb4449b0e 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -186,10 +186,12 @@ extern const u32 yuv_offset[4];
186#define IVTV_DEFAULT_ENC_MPG_BUFFERS 4 186#define IVTV_DEFAULT_ENC_MPG_BUFFERS 4
187#define IVTV_DEFAULT_ENC_YUV_BUFFERS 2 187#define IVTV_DEFAULT_ENC_YUV_BUFFERS 2
188#define IVTV_DEFAULT_ENC_VBI_BUFFERS 1 188#define IVTV_DEFAULT_ENC_VBI_BUFFERS 1
189#define IVTV_DEFAULT_ENC_PCM_BUFFERS 1 189/* Exception: size in kB for this stream (MB is overkill) */
190#define IVTV_DEFAULT_ENC_PCM_BUFFERS 320
190#define IVTV_DEFAULT_DEC_MPG_BUFFERS 1 191#define IVTV_DEFAULT_DEC_MPG_BUFFERS 1
191#define IVTV_DEFAULT_DEC_YUV_BUFFERS 1 192#define IVTV_DEFAULT_DEC_YUV_BUFFERS 1
192#define IVTV_DEFAULT_DEC_VBI_BUFFERS 1 193/* Exception: size in kB for this stream (MB is way overkill) */
194#define IVTV_DEFAULT_DEC_VBI_BUFFERS 64
193 195
194/* ======================================================================== */ 196/* ======================================================================== */
195/* ========================== END USER SETTABLE DMA VARIABLES ============= */ 197/* ========================== END USER SETTABLE DMA VARIABLES ============= */
@@ -321,7 +323,7 @@ extern int ivtv_debug;
321 323
322 324
323struct ivtv_options { 325struct ivtv_options {
324 int megabytes[IVTV_MAX_STREAMS]; /* Size in megabytes of each stream */ 326 int kilobytes[IVTV_MAX_STREAMS]; /* Size in kilobytes of each stream */
325 int cardtype; /* force card type on load */ 327 int cardtype; /* force card type on load */
326 int tuner; /* set tuner on load */ 328 int tuner; /* set tuner on load */
327 int radio; /* enable/disable radio */ 329 int radio; /* enable/disable radio */
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 2e632014c90d..fab5c51b1519 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -150,7 +150,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type)
150 s->dma = ivtv_stream_info[type].dma; 150 s->dma = ivtv_stream_info[type].dma;
151 s->buf_size = itv->stream_buf_size[type]; 151 s->buf_size = itv->stream_buf_size[type];
152 if (s->buf_size) 152 if (s->buf_size)
153 s->buffers = itv->options.megabytes[type] * 1024 * 1024 / s->buf_size; 153 s->buffers = (itv->options.kilobytes[type] * 1024 + s->buf_size - 1) / s->buf_size;
154 spin_lock_init(&s->qlock); 154 spin_lock_init(&s->qlock);
155 init_waitqueue_head(&s->waitq); 155 init_waitqueue_head(&s->waitq);
156 s->id = -1; 156 s->id = -1;
@@ -192,7 +192,7 @@ static int ivtv_reg_dev(struct ivtv *itv, int type)
192 /* User explicitly selected 0 buffers for these streams, so don't 192 /* User explicitly selected 0 buffers for these streams, so don't
193 create them. */ 193 create them. */
194 if (minor >= 0 && ivtv_stream_info[type].dma != PCI_DMA_NONE && 194 if (minor >= 0 && ivtv_stream_info[type].dma != PCI_DMA_NONE &&
195 itv->options.megabytes[type] == 0) { 195 itv->options.kilobytes[type] == 0) {
196 IVTV_INFO("Disabled %s device\n", ivtv_stream_info[type].name); 196 IVTV_INFO("Disabled %s device\n", ivtv_stream_info[type].name);
197 return 0; 197 return 0;
198 } 198 }
@@ -238,18 +238,18 @@ static int ivtv_reg_dev(struct ivtv *itv, int type)
238 238
239 switch (vfl_type) { 239 switch (vfl_type) {
240 case VFL_TYPE_GRABBER: 240 case VFL_TYPE_GRABBER:
241 IVTV_INFO("Registered device video%d for %s (%d MB)\n", 241 IVTV_INFO("Registered device video%d for %s (%d kB)\n",
242 s->v4l2dev->minor, s->name, itv->options.megabytes[type]); 242 s->v4l2dev->minor, s->name, itv->options.kilobytes[type]);
243 break; 243 break;
244 case VFL_TYPE_RADIO: 244 case VFL_TYPE_RADIO:
245 IVTV_INFO("Registered device radio%d for %s\n", 245 IVTV_INFO("Registered device radio%d for %s\n",
246 s->v4l2dev->minor - MINOR_VFL_TYPE_RADIO_MIN, s->name); 246 s->v4l2dev->minor - MINOR_VFL_TYPE_RADIO_MIN, s->name);
247 break; 247 break;
248 case VFL_TYPE_VBI: 248 case VFL_TYPE_VBI:
249 if (itv->options.megabytes[type]) 249 if (itv->options.kilobytes[type])
250 IVTV_INFO("Registered device vbi%d for %s (%d MB)\n", 250 IVTV_INFO("Registered device vbi%d for %s (%d kB)\n",
251 s->v4l2dev->minor - MINOR_VFL_TYPE_VBI_MIN, 251 s->v4l2dev->minor - MINOR_VFL_TYPE_VBI_MIN,
252 s->name, itv->options.megabytes[type]); 252 s->name, itv->options.kilobytes[type]);
253 else 253 else
254 IVTV_INFO("Registered device vbi%d for %s\n", 254 IVTV_INFO("Registered device vbi%d for %s\n",
255 s->v4l2dev->minor - MINOR_VFL_TYPE_VBI_MIN, s->name); 255 s->v4l2dev->minor - MINOR_VFL_TYPE_VBI_MIN, s->name);