Re: patch "budget-av: Remove polarity switching of the clock for the DVB-C cards" causes corrupt stream

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

 



Matthias Dahl wrote:
> Hi everyone.
> 
> Just wanted to ask if there is any progress on that front? Haven't heard or 
> seen any movement for quite some time now and I was wondering if that patch 
> will make it into the tree or not.

The patch was only for testing. I don't know, why your dvb card gets interrupts with the patch and didn't got interrupts
(or not enough) without the patch. I've attached two patches. They add some more debug messages. Can you please test
both patches with the buffer sizes 188, 658, 752 and 1316kb? Your syslog will be floated with message like this:

Jun 23 17:24:31 very-new-darkstar kernel: (budget-core.c:603) got 7 interrupts for the upper half of the buffer
(size=1316kb)
Jun 23 17:24:31 very-new-darkstar kernel: (budget-core.c:600) got 7 interrupts for the lower half of the buffer
(size=1316kb)

I would like to see, how many interrupts are hit during the filling of the buffer.

- Hartmut



diff -r 47a89b96e10d linux/drivers/media/dvb/ttpci/budget-core.c
--- a/linux/drivers/media/dvb/ttpci/budget-core.c	Fri Jun 22 16:41:07 2007 -0400
+++ b/linux/drivers/media/dvb/ttpci/budget-core.c	Sat Jun 23 17:45:53 2007 +0200
@@ -147,6 +147,8 @@ static int start_ts_capture(struct budge
 	}
 	saa7146_write(dev, PROT_ADDR3, budget->buffer_size);
 	saa7146_write(dev, BASE_PAGE3, budget->pt.dma | ME1 | 0x90);
+	printk("(%s:%d) init value for BASE_PAGE3: %08x, value from saa7146: %08x\n", 
+	       __FILE__, __LINE__, budget->pt.dma | ME1 | 0x90, saa7146_read(dev, BASE_PAGE3));
 
 	saa7146_write(dev, PITCH3, budget->buffer_width);
 	saa7146_write(dev, NUM_LINE_BYTE3,
@@ -574,11 +576,34 @@ void ttpci_budget_irq10_handler(struct s
 void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr)
 {
 	struct budget *budget = (struct budget *) dev->ext_priv;
+	u32 newdma;
+	u32 buffer_size;
 
 	dprintk(8, "dev: %p, budget: %p\n", dev, budget);
 
-	if (*isr & MASK_10)
+	if (*isr & MASK_10) {
+	
+		newdma = saa7146_read(budget->dev, PCI_VDP3);
+		buffer_size = budget->buffer_height * budget->buffer_width;
+		if (buffer_size < budget->buffer_size) {
+			if (newdma >= buffer_size && budget->lastdma < buffer_size) {
+				printk("(%s:%d) got %d interrupts for the lower half of the buffer (size=%dkb)\n", __FILE__, __LINE__, budget->count, budget->buffer_size / 1024);
+				budget->count = 0;
+			} else if (newdma < buffer_size && budget->lastdma >= buffer_size) {
+				printk("(%s:%d) got %d interrupts for the upper half of the buffer (size=%dkb)\n", __FILE__, __LINE__, budget->count, budget->buffer_size / 1024);
+				budget->count = 0;
+			}
+		} else {
+			if (newdma < budget->lastdma) {
+				printk("(%s:%d) got %d interrupts for the buffer (size=%dkb)\n", __FILE__, __LINE__, budget->count, budget->buffer_size / 1024);
+				budget->count = 0;
+			}
+    		}
+		budget->count++;
+		budget->lastdma = newdma;
+	
 		tasklet_schedule(&budget->vpe_tasklet);
+	}
 }
 
 void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
diff -r 47a89b96e10d linux/drivers/media/dvb/ttpci/budget.h
--- a/linux/drivers/media/dvb/ttpci/budget.h	Fri Jun 22 16:41:07 2007 -0400
+++ b/linux/drivers/media/dvb/ttpci/budget.h	Sat Jun 23 17:37:05 2007 +0200
@@ -83,6 +83,9 @@ struct budget {
 	int fe_synced;
 
 	void *priv;
+	
+	u32 lastdma;
+	u32 count;
 };
 
 #define MAKE_BUDGET_INFO(x_var,x_name,x_type) \
diff -r 47a89b96e10d linux/drivers/media/dvb/ttpci/budget-av.c
--- a/linux/drivers/media/dvb/ttpci/budget-av.c	Fri Jun 22 16:41:07 2007 -0400
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c	Sat Jun 23 17:50:36 2007 +0200
@@ -1058,7 +1058,8 @@ static void budget_av_irq(struct saa7146
 
 	dprintk(8, "dev: %p, budget_av: %p\n", dev, budget_av);
 
-	if (*isr & MASK_10)
+//	if (*isr & MASK_10)
+	if (*isr & (MASK_07|MASK_08))
 		ttpci_budget_irq10_handler(dev, isr);
 }
 
@@ -1300,7 +1301,8 @@ static struct saa7146_extension budget_e
 	.attach = budget_av_attach,
 	.detach = budget_av_detach,
 
-	.irq_mask = MASK_10,
+//	.irq_mask = MASK_10,
+	.irq_mask = MASK_07|MASK_08,
 	.irq_func = budget_av_irq,
 };
 
diff -r 47a89b96e10d linux/drivers/media/dvb/ttpci/budget-core.c
--- a/linux/drivers/media/dvb/ttpci/budget-core.c	Fri Jun 22 16:41:07 2007 -0400
+++ b/linux/drivers/media/dvb/ttpci/budget-core.c	Sat Jun 23 17:52:22 2007 +0200
@@ -52,7 +52,8 @@
 #define BUFFER_WARNING_WAIT	(30*HZ)
 
 int budget_debug;
-static int dma_buffer_size = TS_MIN_BUFSIZE_K;
+//static int dma_buffer_size = TS_MIN_BUFSIZE_K;
+static int dma_buffer_size = TS_MAX_BUFSIZE_K_DVBC;
 module_param_named(debug, budget_debug, int, 0644);
 module_param_named(bufsize, dma_buffer_size, int, 0444);
 MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off).");
@@ -67,7 +68,9 @@ static int stop_ts_capture(struct budget
 	dprintk(2, "budget: %p\n", budget);
 
 	saa7146_write(budget->dev, MC1, MASK_20);	// DMA3 off
-	SAA7146_IER_DISABLE(budget->dev, MASK_10);
+//	SAA7146_IER_DISABLE(budget->dev, MASK_10);
+	SAA7146_IER_DISABLE(budget->dev, MASK_07);	// PORT B interrupt
+	SAA7146_IER_DISABLE(budget->dev, MASK_08);	// PORT A interrupt
 	return 0;
 }
 
@@ -113,22 +116,26 @@ static int start_ts_capture(struct budge
 	case BUDGET_KNC1C_MK3:
 	case BUDGET_KNC1CP_MK3:
 		if (budget->video_port == BUDGET_VIDEO_PORTA) {
-			saa7146_write(dev, DD1_INIT, 0x06000200);
+//			saa7146_write(dev, DD1_INIT, 0x06000200);
+			saa7146_write(dev, DD1_INIT, 0x06C00200);
 			saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
 			saa7146_write(dev, BRS_CTRL, 0x00000000);
 		} else {
-			saa7146_write(dev, DD1_INIT, 0x00000600);
+//			saa7146_write(dev, DD1_INIT, 0x00000600);
+			saa7146_write(dev, DD1_INIT, 0x000006C0);
 			saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
 			saa7146_write(dev, BRS_CTRL, 0x60000000);
 		}
 		break;
 	default:
 		if (budget->video_port == BUDGET_VIDEO_PORTA) {
-			saa7146_write(dev, DD1_INIT, 0x06000200);
+//			saa7146_write(dev, DD1_INIT, 0x06000200);
+			saa7146_write(dev, DD1_INIT, 0x06C00200);
 			saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
 			saa7146_write(dev, BRS_CTRL, 0x00000000);
 		} else {
-			saa7146_write(dev, DD1_INIT, 0x02000600);
+//			saa7146_write(dev, DD1_INIT, 0x02000600);
+			saa7146_write(dev, DD1_INIT, 0x020006C0);
 			saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
 			saa7146_write(dev, BRS_CTRL, 0x60000000);
 		}
@@ -147,6 +154,8 @@ static int start_ts_capture(struct budge
 	}
 	saa7146_write(dev, PROT_ADDR3, budget->buffer_size);
 	saa7146_write(dev, BASE_PAGE3, budget->pt.dma | ME1 | 0x90);
+	printk("(%s:%d) init value for BASE_PAGE3: %08x, value from saa7146: %08x\n",
+	       __FILE__, __LINE__, budget->pt.dma | ME1 | 0x90, saa7146_read(dev, BASE_PAGE3));
 
 	saa7146_write(dev, PITCH3, budget->buffer_width);
 	saa7146_write(dev, NUM_LINE_BYTE3,
@@ -154,8 +163,15 @@ static int start_ts_capture(struct budge
 
 	saa7146_write(dev, MC2, (MASK_04 | MASK_20));
 
-	SAA7146_ISR_CLEAR(budget->dev, MASK_10);	/* VPE */
-	SAA7146_IER_ENABLE(budget->dev, MASK_10);	/* VPE */
+//	SAA7146_ISR_CLEAR(budget->dev, MASK_10);	/* VPE */
+//	SAA7146_IER_ENABLE(budget->dev, MASK_10);	/* VPE */
+	if (budget->video_port == BUDGET_VIDEO_PORTA) {
+		SAA7146_ISR_CLEAR(budget->dev, MASK_08);	/* PORT A interrupt */
+		SAA7146_IER_ENABLE(budget->dev, MASK_08);	/* PORT A interrupt */
+	} else {
+		SAA7146_ISR_CLEAR(budget->dev, MASK_07);	/* PORT B interrupt */
+		SAA7146_IER_ENABLE(budget->dev, MASK_07);	/* PORT B interrupt */
+	}
 	saa7146_write(dev, MC1, (MASK_04 | MASK_20));	/* DMA3 on */
 
 	return 0;
@@ -574,11 +590,35 @@ void ttpci_budget_irq10_handler(struct s
 void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr)
 {
 	struct budget *budget = (struct budget *) dev->ext_priv;
+	u32 newdma;
+	u32 buffer_size;
 
 	dprintk(8, "dev: %p, budget: %p\n", dev, budget);
 
-	if (*isr & MASK_10)
+//	if (*isr & MASK_10)
+	if (*isr & (MASK_07|MASK_08)) {
+	
+		newdma = saa7146_read(budget->dev, PCI_VDP3);
+		buffer_size = budget->buffer_height * budget->buffer_width;
+		if (budget->buffer_size > buffer_size) {
+			if (newdma >= buffer_size && budget->lastdma < buffer_size) {
+				printk("(%s:%d) got %d interrupts for the lower half of the buffer (size=%dkb)\n", __FILE__, __LINE__, budget->count, budget->buffer_size / 1024);
+				budget->count = 0;
+			} else if (newdma < buffer_size && budget->lastdma >= buffer_size) {
+				printk("(%s:%d) got %d interrupts for the upper half of the buffer (size=%dkb)\n", __FILE__, __LINE__, budget->count, budget->buffer_size / 1024);
+				budget->count = 0;
+			}
+		} else {
+			if (newdma < budget->lastdma) {
+				printk("(%s:%d) got %d interrupts for the buffer (size=%dkb)\n", __FILE__, __LINE__, budget->count, budget->buffer_size / 1024);
+				budget->count = 0;
+			}
+		}
+		budget->count++;
+		budget->lastdma = newdma;
+	
 		tasklet_schedule(&budget->vpe_tasklet);
+	}
 }
 
 void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
diff -r 47a89b96e10d linux/drivers/media/dvb/ttpci/budget.h
--- a/linux/drivers/media/dvb/ttpci/budget.h	Fri Jun 22 16:41:07 2007 -0400
+++ b/linux/drivers/media/dvb/ttpci/budget.h	Sat Jun 23 17:50:36 2007 +0200
@@ -83,6 +83,9 @@ struct budget {
 	int fe_synced;
 
 	void *priv;
+	
+	u32 lastdma;
+	u32 count;
 };
 
 #define MAKE_BUDGET_INFO(x_var,x_name,x_type) \
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

  Powered by Linux