[linux-dvb] Saa7134 Liefview Duo DVBT cardbus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Mark

Mark Nicolas wrote:
> Hi,
> I played with the ts_nr_packets and ts_bufs in the source and have put 
> bigger values in.
> That with greater values I get a better picture but there are also some 
> lines in that are damaging the picture!
> 
> i repeat that was only a 15 min playing ;-)
> 
This points into the direction i expexted. Please try the patch i attached.
It fixes 2 Bugs in the TS DMA.

Best regards
    Hartmut
-------------- next part --------------
--- video4linux/saa7134-ts.c.orig	2005-09-10 00:44:36.000000000 +0200
+++ video4linux/saa7134-ts.c	2005-09-10 22:31:23.000000000 +0200
@@ -48,17 +48,11 @@ static int buffer_activate(struct saa713
 			   struct saa7134_buf *buf,
 			   struct saa7134_buf *next)
 {
-	u32 control;
 
 	dprintk("buffer_activate [%p]",buf);
 	buf->vb.state = STATE_ACTIVE;
 	buf->top_seen = 0;
 
-        /* dma: setup channel 5 (= TS) */
-        control = SAA7134_RS_CONTROL_BURST_16 |
-                SAA7134_RS_CONTROL_ME |
-                (buf->pt->dma >> 12);
-
 	if (NULL == next)
 		next = buf;
 	if (V4L2_FIELD_TOP == buf->vb.field) {
@@ -70,8 +64,6 @@ static int buffer_activate(struct saa713
 		saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next));
 		saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf));
 	}
-	saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE);
-	saa_writel(SAA7134_RS_CONTROL(5),control);
 
 	/* start DMA */
 	saa7134_set_dmabits(dev);
@@ -86,6 +78,7 @@ static int buffer_prepare(struct videobu
 	struct saa7134_dev *dev = q->priv_data;
 	struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
 	unsigned int lines, llength, size;
+	u32 control;
 	int err;
 
 	dprintk("buffer_prepare [%p,%s]\n",buf,v4l2_field_names[field]);
@@ -117,6 +110,18 @@ static int buffer_prepare(struct videobu
 		if (err)
 			goto oops;
 	}
+
+	/* dma: setup channel 5 (= TS) */
+	control = SAA7134_RS_CONTROL_BURST_16 |
+	          SAA7134_RS_CONTROL_ME |
+	          (buf->pt->dma >> 12);
+
+	saa_writeb(SAA7134_TS_DMA0, ((lines-1)&0xff));
+	saa_writeb(SAA7134_TS_DMA1, (((lines-1)>>8)&0xff));
+	saa_writeb(SAA7134_TS_DMA2, ((((lines-1)>>16)&0x3f) | 0x00)); /* TSNOPIT=0, TSCOLAP=0 */
+	saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE);
+	saa_writel(SAA7134_RS_CONTROL(5),control);
+
 	buf->vb.state = STATE_PREPARED;
 	buf->activate = buffer_activate;
 	buf->vb.field = field;
@@ -166,11 +171,11 @@ EXPORT_SYMBOL_GPL(saa7134_ts_qops);
 /* ----------------------------------------------------------- */
 /* exported stuff                                              */
 
-static unsigned int tsbufs = 4;
+static unsigned int tsbufs = 8;
 module_param(tsbufs, int, 0444);
 MODULE_PARM_DESC(tsbufs,"number of ts buffers, range 2-32");
 
-static unsigned int ts_nr_packets = 30;
+static unsigned int ts_nr_packets = 64;
 module_param(ts_nr_packets, int, 0444);
 MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)");
 
@@ -221,11 +226,11 @@ void saa7134_irq_ts_done(struct saa7134_
 	spin_lock(&dev->slock);
 	if (dev->ts_q.curr) {
 		field = dev->ts_q.curr->vb.field;
-		if (field == V4L2_FIELD_TOP) {
-			if ((status & 0x100000) != 0x100000)
+		if (field == V4L2_FIELD_TOP) {		
+			if ((status & 0x100000) != 0x000000) 
 				goto done;
 		} else {
-			if ((status & 0x100000) != 0x000000)
+			if ((status & 0x100000) != 0x100000)
 				goto done;
 		}
 		saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux