All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Daniel Mack <zonque@gmail.com>
Cc: tiwai@suse.de, blablack@gmail.com, alsa-devel@alsa-project.org,
	gdiffey@gmail.com, linuxaudio@showlabor.de
Subject: Re: [PATCH 1/5] ALSA: snd-usb: implement new endpoint streaming model
Date: Thu, 03 Nov 2011 17:42:32 +0100	[thread overview]
Message-ID: <4EB2C478.90609@ladisch.de> (raw)
In-Reply-To: <4EB2B186.60405@gmail.com>

Daniel Mack wrote:
> On 11/02/2011 04:49 PM, Clemens Ladisch wrote:
> > Example with queue length = 2:
> >
> > 1) startup:
> >     driver queues both capture URBs
> > 2) 1st capture URB completes:
> >     driver queues 1st playback URB and requeues 1st capture URB
> > 3) 2nd capture URB completes:
> >     driver queues 2nd playback URB and requeues 2nd capture URB
> >     (all URBs are now queued)
> > 4) 1st capture URB completes:
> >     1st playback URB is still busy
> >     (The playback URB might have been scheduled for a later frame, and
> >     even for the same frame, there is no guarantee that the completions
> >     for different endpoints happen in the same order as the queueing.)
> 
> I see. However, this really never happened in my tests so far.

This depends on how the HC drivers organize their internal data
structures.  (Most HCs have one global interrupt handler and check the
endpoint queues in the order in which the endpoints are listed in the
device's descriptors, or by number.  However, xHCI allows multiple
interrupts, so completion can arrive in random order, or even
concurrently.)

> What would be a way to fix this? Queue less capture urbs than available
> slots for playback urbs?

There is still that delay in the first playback URB (IIRC EHCI uses
10 ms), and there is no guaranteed upper bound on interrupt latencies.

Generally speaking, a playback URB can be submitted only when both
itself and the corresponding capture URB have been completed.

In my misc/ua101.c driver, I store 'free' playback URBs and capture
frame counts in FIFOs, and submit playback URBs from a tasklet that is
triggered from both completion handlers.


Regards,
Clemens

  reply	other threads:[~2011-11-03 16:41 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 12:10 [PATCH 0/5] RFC for snd-usb: rework usb endpoint logic Daniel Mack
2011-10-31 12:10 ` [PATCH 1/5] ALSA: snd-usb: implement new endpoint streaming model Daniel Mack
2011-11-01 20:57   ` Clemens Ladisch
2011-11-02  8:36     ` Daniel Mack
2011-11-02 10:26   ` Clemens Ladisch
2011-11-02 14:29     ` Daniel Mack
2011-11-02 15:49       ` Clemens Ladisch
2011-11-03 15:21         ` Daniel Mack
2011-11-03 16:42           ` Clemens Ladisch [this message]
2011-10-31 12:10 ` [PATCH 2/5] ALSA: snd-usb: switch over to new endpoint streaming logic Daniel Mack
2011-11-01 20:57   ` Clemens Ladisch
2011-11-02 15:58     ` Takashi Iwai
2011-11-02 16:18       ` Clemens Ladisch
2011-11-02 16:18         ` Takashi Iwai
2011-11-02 22:01       ` Torsten Schenk
2011-11-18 14:44         ` Daniel Mack
2011-11-18 14:41     ` Daniel Mack
2011-10-31 12:10 ` [PATCH 3/5] ALSA: snd-usb: remove old " Daniel Mack
2011-10-31 12:10 ` [PATCH 4/5] ALSA: snd-usb: set MAX_URBS to 16 Daniel Mack
2011-11-01 20:57   ` Clemens Ladisch
2011-10-31 12:10 ` [PATCH 5/5] ALSA: snd-usb: add support for implicit feedback Daniel Mack
2011-10-31 12:38 ` [PATCH 0/5] RFC for snd-usb: rework usb endpoint logic Daniel Mack
2011-11-01  8:50   ` Aurélien Leblond
2011-11-01  9:15     ` Daniel Mack
2011-11-01  9:40       ` Felix Homann
2011-11-01 10:25         ` Daniel Mack
2011-11-01 10:39           ` Felix Homann
2011-11-01 12:11             ` Daniel Mack
2011-11-01 13:59               ` Grant Diffey
2011-11-01 15:36               ` Takashi Iwai
2011-11-01 16:19   ` Takashi Iwai
2011-11-01 19:03     ` Felix Homann
2011-11-02  6:49       ` Takashi Iwai
2011-11-02  8:27     ` Daniel Mack

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=4EB2C478.90609@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=blablack@gmail.com \
    --cc=gdiffey@gmail.com \
    --cc=linuxaudio@showlabor.de \
    --cc=tiwai@suse.de \
    --cc=zonque@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.