aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-12-30 20:54:53 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:29 -0500
commitefc0b127b2e0135053680cd0118856b051450009 (patch)
treebf4028f8682ffba0170d161fdf40faba03658460 /drivers/media/video/cx18/cx18-driver.c
parent7e64dc4c4d6f5c8935fac25c7fc7aa83f9880ed7 (diff)
V4L/DVB (13902): cx18: Update MPEG Index stream buffers module option processing
Update the module options related to INDEX stream buffer allocation. A single CX2341[5678] index entry is only 24 bytes. Large buffers for the IDX stream will prevent the CX23418 from transferring index data over at all. Buffers of around 1.5 kB or 64 index entries seem to be just fine. We'll default to 63 buffers/MDLs as that is the firmware limit per stream and IDX stream buffers are not high rate. There is no reason on earth to allocate the previous 1 MB default of buffer space for the IDX stream. This is in anticipation of implementing the G_ENC_INDEX ioctl() in the cx18 driver. 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-driver.c')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 7f65a47f12e..458f5f07237 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -91,7 +91,7 @@ static int enc_pcm_bufsize = CX18_DEFAULT_ENC_PCM_BUFSIZE;
91 91
92static int enc_ts_bufs = -1; 92static int enc_ts_bufs = -1;
93static int enc_mpg_bufs = -1; 93static int enc_mpg_bufs = -1;
94static int enc_idx_bufs = -1; 94static int enc_idx_bufs = CX18_MAX_FW_MDLS_PER_STREAM;
95static int enc_yuv_bufs = -1; 95static int enc_yuv_bufs = -1;
96static int enc_vbi_bufs = -1; 96static int enc_vbi_bufs = -1;
97static int enc_pcm_bufs = -1; 97static int enc_pcm_bufs = -1;
@@ -196,14 +196,17 @@ MODULE_PARM_DESC(enc_mpg_bufs,
196 "Number of encoder MPG buffers\n" 196 "Number of encoder MPG buffers\n"
197 "\t\t\tDefault is computed from other enc_mpg_* parameters"); 197 "\t\t\tDefault is computed from other enc_mpg_* parameters");
198MODULE_PARM_DESC(enc_idx_buffers, 198MODULE_PARM_DESC(enc_idx_buffers,
199 "Encoder IDX buffer memory (MB). (enc_idx_bufs can override)\n" 199 "(Deprecated) Encoder IDX buffer memory (MB)\n"
200 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_IDX_BUFFERS)); 200 "\t\t\tIgnored, except 0 disables IDX buffer allocations\n"
201 "\t\t\tDefault: 1 [Enabled]");
201MODULE_PARM_DESC(enc_idx_bufsize, 202MODULE_PARM_DESC(enc_idx_bufsize,
202 "Size of an encoder IDX buffer (kB)\n" 203 "Size of an encoder IDX buffer (kB)\n"
203 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_IDX_BUFSIZE)); 204 "\t\t\tAllowed values are multiples of 1.5 kB rounded up\n"
205 "\t\t\t(multiples of size required for 64 index entries)\n"
206 "\t\t\tDefault: 2");
204MODULE_PARM_DESC(enc_idx_bufs, 207MODULE_PARM_DESC(enc_idx_bufs,
205 "Number of encoder IDX buffers\n" 208 "Number of encoder IDX buffers\n"
206 "\t\t\tDefault is computed from other enc_idx_* parameters"); 209 "\t\t\tDefault: " __stringify(CX18_MAX_FW_MDLS_PER_STREAM));
207MODULE_PARM_DESC(enc_yuv_buffers, 210MODULE_PARM_DESC(enc_yuv_buffers,
208 "Encoder YUV buffer memory (MB). (enc_yuv_bufs can override)\n" 211 "Encoder YUV buffer memory (MB). (enc_yuv_bufs can override)\n"
209 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_YUV_BUFFERS)); 212 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_YUV_BUFFERS));
@@ -501,7 +504,12 @@ static void cx18_process_options(struct cx18 *cx)
501 /* 504 /*
502 * YUV is a special case where the stream_buf_size needs to be 505 * YUV is a special case where the stream_buf_size needs to be
503 * an integral multiple of 33.75 kB (storage for 32 screens 506 * an integral multiple of 33.75 kB (storage for 32 screens
504 * lines to maintain alignment in case of lost buffers 507 * lines to maintain alignment in case of lost buffers).
508 *
509 * IDX is a special case where the stream_buf_size should be
510 * an integral multiple of 1.5 kB (storage for 64 index entries
511 * to maintain alignment in case of lost buffers).
512 *
505 */ 513 */
506 if (i == CX18_ENC_STREAM_TYPE_YUV) { 514 if (i == CX18_ENC_STREAM_TYPE_YUV) {
507 cx->stream_buf_size[i] *= 1024; 515 cx->stream_buf_size[i] *= 1024;
@@ -511,15 +519,24 @@ static void cx18_process_options(struct cx18 *cx)
511 if (cx->stream_buf_size[i] < CX18_UNIT_ENC_YUV_BUFSIZE) 519 if (cx->stream_buf_size[i] < CX18_UNIT_ENC_YUV_BUFSIZE)
512 cx->stream_buf_size[i] = 520 cx->stream_buf_size[i] =
513 CX18_UNIT_ENC_YUV_BUFSIZE; 521 CX18_UNIT_ENC_YUV_BUFSIZE;
522 } else if (i == CX18_ENC_STREAM_TYPE_IDX) {
523 cx->stream_buf_size[i] *= 1024;
524 cx->stream_buf_size[i] -=
525 (cx->stream_buf_size[i] % CX18_UNIT_ENC_IDX_BUFSIZE);
526
527 if (cx->stream_buf_size[i] < CX18_UNIT_ENC_IDX_BUFSIZE)
528 cx->stream_buf_size[i] =
529 CX18_UNIT_ENC_IDX_BUFSIZE;
514 } 530 }
515 /* 531 /*
516 * YUV is a special case where the stream_buf_size is 532 * YUV and IDX are special cases where the stream_buf_size is
517 * now in bytes. 533 * now in bytes.
518 * VBI is a special case where the stream_buf_size is fixed 534 * VBI is a special case where the stream_buf_size is fixed
519 * and already in bytes 535 * and already in bytes
520 */ 536 */
521 if (i == CX18_ENC_STREAM_TYPE_VBI || 537 if (i == CX18_ENC_STREAM_TYPE_VBI ||
522 i == CX18_ENC_STREAM_TYPE_YUV) { 538 i == CX18_ENC_STREAM_TYPE_YUV ||
539 i == CX18_ENC_STREAM_TYPE_IDX) {
523 if (cx->stream_buffers[i] < 0) { 540 if (cx->stream_buffers[i] < 0) {
524 cx->stream_buffers[i] = 541 cx->stream_buffers[i] =
525 cx->options.megabytes[i] * 1024 * 1024 542 cx->options.megabytes[i] * 1024 * 1024