Attached is a patch that fixes the q_full.bytesused < 0 problem for the
cx18 driver.

I noticed a dramatic perceptual improvement in watching TV with

$ mplayer /dev/video1

and MythTV appears to be happy with the fix as well.  I did get the
"select() timeout" log message twice in a row (so ~10 seconds) when I
tuned to a snowy channel. But the driver and MythTV recovered from that
situation without my intervention, and has not repeated the symptom
since.

-Andy



--- cx18-03d4d8d84c4f/linux/drivers/media/video/cx18/cx18-queue.h.orig	2008-03-05 21:30:45.000000000 -0500
+++ cx18-03d4d8d84c4f/linux/drivers/media/video/cx18/cx18-queue.h	2008-03-05 21:36:18.000000000 -0500
@@ -46,7 +46,7 @@ void cx18_enqueue(struct cx18_stream *s,
 struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q);
 int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from, struct cx18_queue *steal,
 		    struct cx18_queue *to, int needed_bytes);
-struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id);
+struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, u32 n);
 void cx18_flush_queues(struct cx18_stream *s);
 
 /* cx18_stream utility functions */
--- cx18-03d4d8d84c4f/linux/drivers/media/video/cx18/cx18-queue.c.orig	2008-03-05 21:49:04.000000000 -0500
+++ cx18-03d4d8d84c4f/linux/drivers/media/video/cx18/cx18-queue.c	2008-03-05 21:52:42.000000000 -0500
@@ -87,7 +87,7 @@ struct cx18_buffer *cx18_dequeue(struct 
 	return buf;
 }
 
-struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id)
+struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, u32 n)
 {
 	struct cx18 *cx = s->cx;
 	struct list_head *p;
@@ -97,6 +97,7 @@ struct cx18_buffer *cx18_queue_find_buf(
 
 		if (buf->id != id)
 			continue;
+		buf->bytesused = n;
 		/* the transport buffers are handled differently,
 		   so there is no need to move them to the full queue */
 		if (s->type == CX18_ENC_STREAM_TYPE_TS && s->v4l2dev == NULL)
--- cx18-03d4d8d84c4f/linux/drivers/media/video/cx18/cx18-irq.c.orig	2008-03-05 20:25:13.000000000 -0500
+++ cx18-03d4d8d84c4f/linux/drivers/media/video/cx18/cx18-irq.c	2008-03-05 21:50:31.000000000 -0500
@@ -59,9 +59,8 @@ static void epu_dma_done(struct cx18 *cx
 	if (mb->args[2] != 1)
 		CX18_WARN("Ack struct = %d for %s\n",
 			mb->args[2], s->name);
-	buf = cx18_queue_find_buf(s, read_enc(off));
+	buf = cx18_queue_find_buf(s, read_enc(off), read_enc(off + 4));
 	if (buf) {
-		buf->bytesused = read_enc(off + 4);
 		cx18_buf_sync_for_cpu(s, buf);
 		if (s->type == CX18_ENC_STREAM_TYPE_TS && s->v4l2dev == NULL) {
 			/* process the buffer here */
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to