[linux-dvb] SAA7146 DMA buffer overflow

Ingo Schneider mail at ingo-schneider.de
Tue Feb 14 21:55:35 CET 2006


Hello !

I hava a problem that I loose TS packets due to overruns of the SAA 7146 
DMA buffer when the system is under I/O load (e.g. backup).

I modified the budget-core.c to give warning when the buffer is nearly 
full to verify that this is really the cause (see code below).
The simplest thing would be to increase the buffer size. The current 
size = 1024 TS packets, about 192k.

I would tend to increase this buffer to about 1 or 2 megabytes to stop 
getting those TS continuity errors,
is there a reason why this buffer was chosen to be so small ? Spec of 
SAA7146 says it can handle 4 megabytes for DMA.

Also, there is a special handling for BUDGET_FS_ACTIVY which has a 
different buffer "layout" - why is this ?

My system configuration:
KT266A chipset MSI K7T266).
Two Terratec Cinergy 1200 DVB-C (SAA7146 / TDA10021).

Regards,
Ingo Schneider.



--- budget-core.c.old   2006-02-12 17:00:34.000000000 +0100
+++ budget-core.c       2006-02-14 09:16:25.000000000 +0100
@@ -141,6 +141,7 @@
        u8 *mem = (u8 *) (budget->grabbing);
        u32 olddma = budget->ttbp;
        u32 newdma = saa7146_read(budget->dev, PCI_VDP3);
+        int count = 0;
 
        /* nearest lower position divisible by 188 */
        newdma -= newdma % 188;
@@ -155,9 +156,15 @@
 
        if (newdma > olddma) {  /* no wraparound, dump olddma..newdma */
                dvb_dmx_swfilter_packets(&budget->demux, mem + olddma, 
(newdma - olddma) / 188);
+                count = (newdma - olddma) / 188;
        } else {                /* wraparound, dump olddma..buflen and 
0..newdma */
                dvb_dmx_swfilter_packets(&budget->demux, mem + olddma, 
(TS_BUFLEN - olddma) / 188);
                dvb_dmx_swfilter_packets(&budget->demux, mem, newdma / 188);
+               count = (TS_BUFLEN - olddma) / 188 + newdma / 188;
+       }
+
+       if (count > 1000) {
+               printk("ttpci vpeirq: buffer warning %d\n", count);
        }
 }




More information about the linux-dvb mailing list