public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Ringel <stefan.ringel@arcor.de>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: tm6000 calculating urb buffer
Date: Tue, 04 May 2010 21:58:12 +0200	[thread overview]
Message-ID: <4BE07C54.6000804@arcor.de> (raw)
In-Reply-To: <4BE07A6A.9000303@redhat.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Am 04.05.2010 21:50, schrieb Mauro Carvalho Chehab:
> Stefan Ringel wrote:
>
>>>> datagram from urb to videobuf
>>>>
>>>> urb           copy to     temp         copy to         1. videobuf
>>>>                          buffer                        2. audiobuf
>>>>                                                        3. vbi
>>>> 184 Packets   ------->   184 * 3072    ---------->     4. etc.
>>>> a 3072 bytes               bytes
>>>>                184 *                   3072 *
>>>>              3072 bytes              180 bytes
>>>>                                 (184 bytes - 4 bytes
>>>>                                     header )
>>> In order to receive 184 packets with 3072 bytes each, the USB code will
>>> try to allocate the next power-of-two memory block capable of receiving
>>> such data block. As: 184 * 3072 = 565248, the kernel allocator will seek
>>> for a continuous block of 1 MB, that can do DMA transfers (required by
>>> ehci driver). On a typical machine, due to memory fragmentation,
>>> in general, there aren't many of such blocks. So, this will increase the
>>> probability of not having any such large block available, causing an
>> horrible
>>> dump at kernel, plus a -ENOMEM on the driver, generally requiring a
reboot
>>> if you want to run the driver again.
>>>
>> And direct copy from urb to videobuf/alsa/vbi in 184 Bytes segments.
>>
>> urb                      1. videobuf
>>               copy to    2. audiobuf
>>                          3. vbi
>> 184 Packets   ------->   4. etc.
>> a 3072 bytes  
>>               180 Bytes (without headers)
>
> That's basically what that logic does. It preserves the header if you
select
> TM6000 format (so, no checks for the start of the block, etc), or copies
> just the data, if you select YUY2 or UYUV.
>
>> or how can I copy 180 Bytes Data from 184 Bytes block with an
>> anligment of 184 urb pipe (184 * 3072 Bytes)?
>
> A 184 x 3072 URB pipe is a big problem. We used a large pipe in the
past, and this
> won't work. For example, on a notebook I used to run some tests with 1
GB of
> ram after starting X and do anything (like opening a browser), the URB
> allocation used to fail, as there weren't any available 1MB segment at
> the DMA area. Even without starting X, after a few tests, it would
eventually
> have fragmented the memory and the driver stops working.
>
>
and 3072 * 46 = 141312 bytes and it can through 184 ! it's 1/4 smaller.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iQEcBAEBAgAGBQJL4HxUAAoJEAWtPFjxMvFGAa8H/2tnr0u9YCHUlpcltAlKggcQ
hXyZ3KiyBVe6K1cc/xEh1sMOscytJ4XS8ho9QHDh9AAObYq5J0zkXV5nBEJ2veIi
a8fn9LgtsHLbgXhLxaToXgy3GY5HW/RANh0qhBqbPY1VRcvq8wmrKMO89qBr64NI
5thzzTAV9emxc6mASIw2dksqF0IFIciDEKygbMcHNm1Y1n/b0VkBInnjpz06vUex
yKaigZRPHtIG8xnNKzcKIURfJ18T8GvpYSTipvZkqMOP6Latah6fYc6WYilMSk3n
opYXS6iPL7qZkh3nWDXNQQLC1FBKoitsYhgWlope6wabiBYTAwnCtg5LFKo11Jc=
=khUE
-----END PGP SIGNATURE-----


  reply	other threads:[~2010-05-04 19:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4BDB067E.4070501@arcor.de>
     [not found] ` <4BDB3017.9070101@arcor.de>
2010-05-04 15:38   ` tm6000 calculating urb buffer Stefan Ringel
2010-05-04 18:25     ` Mauro Carvalho Chehab
2010-05-04 19:13       ` Stefan Ringel
2010-05-04 19:50         ` Mauro Carvalho Chehab
2010-05-04 19:58           ` Stefan Ringel [this message]
2010-05-05  6:07             ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BE07C54.6000804@arcor.de \
    --to=stefan.ringel@arcor.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox