aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-streams.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-08-23 17:36:50 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:53 -0400
commit3b5df8ea40ac533c62b8e5f9f173d985665fc752 (patch)
tree444d0324ac1d87e6ba379ccb97a743797d951f18 /drivers/media/video/cx18/cx18-streams.c
parentd3c5e7075508a6874d1a53d0a409b0bbbe3a9fbe (diff)
V4L/DVB (8774): cx18: Have CX23418 release buffers at end of capture.
cx18: Have CX23418 release buffers at end of capture. The CX23418 reuses task handles so we need to have it release the buffers associated with a task handle at the end of a capture. If we don't, buffer ids used for one type of stream in the driver (MPEG, TS, PCM), could be used for another type of stream by the CX23418, if a previously used handle is assigned to a different type of stream. The driver would drop valid buffers when this happened. 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.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 53c5852bba37..4d5b446895cb 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -488,7 +488,14 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
488 /* begin_capture */ 488 /* begin_capture */
489 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) { 489 if (cx18_vapi(cx, CX18_CPU_CAPTURE_START, 1, s->handle)) {
490 CX18_DEBUG_WARN("Error starting capture!\n"); 490 CX18_DEBUG_WARN("Error starting capture!\n");
491 /* Ensure we're really not capturing before releasing MDLs */
492 if (s->type == CX18_ENC_STREAM_TYPE_MPG)
493 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 2, s->handle, 1);
494 else
495 cx18_vapi(cx, CX18_CPU_CAPTURE_STOP, 1, s->handle);
496 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
491 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); 497 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
498 /* FIXME - clean-up DSP0_INT mask, i_flags, s_flags, etc. */
492 return -EINVAL; 499 return -EINVAL;
493 } 500 }
494 501
@@ -540,6 +547,9 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
540 CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n"); 547 CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n");
541 } 548 }
542 549
550 /* Tell the CX23418 it can't use our buffers anymore */
551 cx18_vapi(cx, CX18_CPU_DE_RELEASE_MDL, 1, s->handle);
552
543 if (s->type != CX18_ENC_STREAM_TYPE_TS) 553 if (s->type != CX18_ENC_STREAM_TYPE_TS)
544 atomic_dec(&cx->ana_capturing); 554 atomic_dec(&cx->ana_capturing);
545 atomic_dec(&cx->tot_capturing); 555 atomic_dec(&cx->tot_capturing);