aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-11-10 21:28:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:52 -0500
commit1047a83844a4d894a068d94aca2d3efe54ac7a9c (patch)
treeb701e53e5db83b79f608eb6f515195d0cd403679 /drivers
parent22dce188ef3e1e058ceabe3b3072640d7568f764 (diff)
V4L/DVB (13431): cx18: Adjust an MDL's final buffer size to force encoder transfer size
The encoder was not honoring the MDL size sent in DE_SET_MDL mailbox commands. This change adjusts the size of the last buffer in an MDL, as reported to the firmware, so that the encoder will send the exact amount of bytes we specify per MDL transfer. This eliminates tearing in YUV playback when using non-default YUV buffer sizes. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx18/cx18-queue.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c
index 98cbf001f8da..f2d539f6bdf9 100644
--- a/drivers/media/video/cx18/cx18-queue.c
+++ b/drivers/media/video/cx18/cx18-queue.c
@@ -280,6 +280,7 @@ void cx18_load_queues(struct cx18_stream *s)
280 struct cx18_buffer *buf; 280 struct cx18_buffer *buf;
281 int mdl_id; 281 int mdl_id;
282 int i; 282 int i;
283 u32 partial_buf_size;
283 284
284 /* 285 /*
285 * Attach buffers to MDLs, give the MDLs ids, and add MDLs to q_free 286 * Attach buffers to MDLs, give the MDLs ids, and add MDLs to q_free
@@ -308,10 +309,24 @@ void cx18_load_queues(struct cx18_stream *s)
308 &cx->scb->cpu_mdl[mdl_id + i].length); 309 &cx->scb->cpu_mdl[mdl_id + i].length);
309 } 310 }
310 311
311 if (i == s->bufs_per_mdl) 312 if (i == s->bufs_per_mdl) {
313 /*
314 * The encoder doesn't honor s->mdl_size. So in the
315 * case of a non-integral number of buffers to meet
316 * mdl_size, we lie about the size of the last buffer
317 * in the MDL to get the encoder to really only send
318 * us mdl_size bytes per MDL transfer.
319 */
320 partial_buf_size = s->mdl_size % s->buf_size;
321 if (partial_buf_size) {
322 cx18_writel(cx, partial_buf_size,
323 &cx->scb->cpu_mdl[mdl_id + i - 1].length);
324 }
312 cx18_enqueue(s, mdl, &s->q_free); 325 cx18_enqueue(s, mdl, &s->q_free);
313 else 326 } else {
314 cx18_push(s, mdl, &s->q_idle); /* not enough buffers */ 327 /* Not enough buffers for this MDL; we won't use it */
328 cx18_push(s, mdl, &s->q_idle);
329 }
315 mdl_id += i; 330 mdl_id += i;
316 } 331 }
317} 332}