aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c33
-rw-r--r--drivers/media/video/cx18/cx18-driver.h14
2 files changed, 38 insertions, 9 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 7f65a47f12e1..458f5f072374 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
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index e3f7911a7385..ff3426206765 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -126,10 +126,22 @@
126#define CX18_625_LINE_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 576/32) 126#define CX18_625_LINE_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 576/32)
127#define CX18_525_LINE_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 480/32) 127#define CX18_525_LINE_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 480/32)
128 128
129/* IDX buffer size should be a multiple of the index entry size from the chip */
130struct cx18_enc_idx_entry {
131 __le32 length;
132 __le32 offset_low;
133 __le32 offset_high;
134 __le32 flags;
135 __le32 pts_low;
136 __le32 pts_high;
137} __attribute__ ((packed));
138#define CX18_UNIT_ENC_IDX_BUFSIZE \
139 (sizeof(struct cx18_enc_idx_entry) * V4L2_ENC_IDX_ENTRIES)
140
129/* DMA buffer, default size in kB allocated */ 141/* DMA buffer, default size in kB allocated */
130#define CX18_DEFAULT_ENC_TS_BUFSIZE 32 142#define CX18_DEFAULT_ENC_TS_BUFSIZE 32
131#define CX18_DEFAULT_ENC_MPG_BUFSIZE 32 143#define CX18_DEFAULT_ENC_MPG_BUFSIZE 32
132#define CX18_DEFAULT_ENC_IDX_BUFSIZE 32 144#define CX18_DEFAULT_ENC_IDX_BUFSIZE (CX18_UNIT_ENC_IDX_BUFSIZE * 1 / 1024 + 1)
133#define CX18_DEFAULT_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 3 / 1024 + 1) 145#define CX18_DEFAULT_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 3 / 1024 + 1)
134#define CX18_DEFAULT_ENC_PCM_BUFSIZE 4 146#define CX18_DEFAULT_ENC_PCM_BUFSIZE 4
135 147