Re: SAA7146 DMA buffer overflow

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

 



On Tue, 2006-02-14 at 21:55 +0100, Ingo Schneider wrote:
> 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.
I have a very similar problem with bt878 based dvb cards. Here the
buffer size is 128 * 1024 bytes. Increasing it reduces the problem
somewhat, but I'm unable to increase it enough before some sanity check
states that the buffer size is invalid. AFAIK the windows driver for
this particular card uses a 3mb dma buffer.

I think the reason for these buffers to be small is to prevent linux
from running out of what ever memory is used for dma. (In my experience
linux can behave very badly when some range of memory is depleted).
> 
> Also, there is a special handling for BUDGET_FS_ACTIVY which has a 
> different buffer "layout" - why is this ?
ACTIVY is a fujitsu siemens set top box. I guess it has one of these
devices embedded. Being a small device running embedded linux this could
need special buffer handling.

Regards

Sigmund
> 
> 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);
>         }
>  }
> 
> 
> _______________________________________________
> 
> linux-dvb@xxxxxxxxxxx
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


_______________________________________________

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