This project is mirrored from Pull mirroring updated .
  1. 13 Sep, 2012 1 commit
  2. 11 Sep, 2012 1 commit
  3. 06 Sep, 2012 2 commits
    • Takashi Iwai's avatar
      ALSA: Remove VOLATILE flag from chmap ctls · 6e67683d
      Takashi Iwai authored
      The VOLATILE flag was added to control elements by
      snd_pcm_add_chmap_ctls() just because I didn't want to have a
      side-effect of "alsactl restore".  But now the set operation doesn't
      allow to change the value unless the PCM stream is in PREAPRED state,
      there is no reason to keep this flag.  Let's rip it off.
      Signed-off-by: default avatarTakashi Iwai <>
    • Takashi Iwai's avatar
      ALSA: PCM: channel mapping API implementation · 2d3391ec
      Takashi Iwai authored
      This patch implements the basic data types for the standard channel
      mapping API handling.
      - The definitions of the channel positions and the new TLV types are
        added in sound/asound.h and sound/tlv.h, so that they can be
        referred from user-space.
      - Introduced a new helper function snd_pcm_add_chmap_ctls() to create
        control elements representing the channel maps for each PCM
      - Some standard pre-defined channel maps are provided for
      Signed-off-by: default avatarTakashi Iwai <>
  4. 05 Jul, 2012 1 commit
  5. 22 May, 2012 1 commit
  6. 11 May, 2012 1 commit
    • Takashi Iwai's avatar
      ALSA: pcm - Optimize the call of snd_pcm_update_hw_ptr() in read/write loop · 0910c216
      Takashi Iwai authored
      In the PCM read/write loop, the driver calls snd_pcm_update_hw_ptr()
      at each time at the beginning of the loop.  Russell King reported that
      this hogs CPU significantly.
      The current code assumes that the pointer callback is very fast and
      cheap, also not too much fine grained.  It's not true in all cases.
      When the pointer advances short samples while the read/write copy has
      been performed, the driver updates the hw_ptr and gets avail > 0
      again.  Then it tries to read/write these small chunks.  This repeats
      until the avail really gets to zero.
      For avoiding this situation, a simple workaround is to call
      snd_pcm_update_hw_ptr() only once at starting the loop, assuming that
      the read/write copy is performed fast enough.  If the available count
      becomes short, it goes to snd_pcm_wait_avail() anyway, and this
      processes right.
      Tested-by: default avatarRussell King <>
      Signed-off-by: default avatarTakashi Iwai <>
  7. 15 Mar, 2012 1 commit
  8. 31 Oct, 2011 1 commit
  9. 20 Sep, 2011 1 commit
  10. 15 Sep, 2011 1 commit
    • Arjan van de Ven's avatar
      ALSA: pcm - fix race condition in wait_for_avail() · 763437a9
      Arjan van de Ven authored
      wait_for_avail() in pcm_lib.c has a race in it (observed in practice by an
      Intel validation group).
      The function is supposed to return once space in the buffer has become
      available, or if some timeout happens.  The entity that creates space (irq
      handler of sound driver and some such) will do a wake up on a waitqueue
      that this function registers for.
      However there are two races in the existing code
      1) If space became available between the caller noticing there was no
         space and this function actually sleeping, the wakeup is missed and the
         timeout condition will happen instead
      2) If a wakeup happened but not sufficient space became available, the
         code will loop again and wait for more space.  However, if the second
         wake comes in prior to hitting the schedule_timeout_interruptible(), it
         will be missed, and potentially you'll wait out until the timeout
      The fix consists of using more careful setting of the current state (so
      that if a wakeup happens in the main loop window, the schedule_timeout()
      falls through) and by checking for available space prior to going into the
      schedule_timeout() loop, but after being on the waitqueue and having the
      state set to interruptible.
      [tiwai: the following changes have been added to Arjan's original patch:
       - merged akpm's fix for waitqueue adding order into a single patch
       - reduction of duplicated code of avail check
      Signed-off-by: default avatarArjan van de Ven <>
      Signed-off-by: default avatarAndrew Morton <>
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>
  11. 24 Jul, 2011 1 commit
  12. 26 May, 2011 1 commit
  13. 19 May, 2011 1 commit
  14. 18 May, 2011 1 commit
    • Ben Gardiner's avatar
      ALSA: sound, core, pcm_lib: xrun_log: log also in_interrupt · ec08b144
      Ben Gardiner authored
      When debugging pcm drivers I found the "period" or "hw" prefix printed
      respectively to be very useful is observing the interplay between
      interrupt-context updates and syscall-context updates.
      Similarly, when debugging overruns with XRUN_DEBUG_LOG it is useful to
      see the context of the last 10 positions.
      Add an in_interrupt member to hwptr_log_entry which stores the value of
      the in_interrupt parameter of snd_pcm_update_hw_ptr0 when the log entry
      is created. Print a "[Q]" prefix when dumping the log entries if
      in_interrupt was true.
      Signed-off-by: default avatarBen Gardiner <>
      Signed-off-by: default avatarTakashi Iwai <>
  15. 01 Apr, 2011 1 commit
  16. 21 Dec, 2010 1 commit
  17. 22 Nov, 2010 4 commits
  18. 19 Aug, 2010 1 commit
  19. 18 Aug, 2010 1 commit
  20. 19 Jul, 2010 1 commit
  21. 28 Jun, 2010 1 commit
    • David Dillow's avatar
      ALSA: pcm_lib: avoid timing jitter in snd_pcm_read/write() · 5daeba34
      David Dillow authored
      When using poll() to wait for the next period -- or avail_min samples --
      one gets a consistent delay for each system call that is usually just a
      little short of the selected period time. However, When using
      snd_pcm_read/write(), one gets a jittery delay that alternates between
      less than a millisecond and approximately two period times. This is
      caused by snd_pcm_lib_{read,write}1() transferring any available samples
      to the user's buffer and adjusting the application pointer prior to
      sleeping to the end of the current period. When the next period
      interrupt occurs, there is then less than avail_min samples remaining to
      be transferred in the period, so we end up sleeping until a second
      period occurs.
      This is solved by using runtime->twake as the number of samples needed
      for a wakeup in addition to selecting the proper wait queue to wake in
      snd_pcm_update_state(). This requires twake to be non-zero when used
      by snd_pcm_lib_{read,write}1() even if avail_min is zero.
      Signed-off-by: default avatarDave Dillow <>
      Signed-off-by: default avatarJaroslav Kysela <>
  22. 25 May, 2010 1 commit
    • Clemens Ladisch's avatar
      ALSA: pcm: fix delta calculation at boundary wraparound · b406e610
      Clemens Ladisch authored
      In the cleanup of the hw_ptr update functions in 2.6.33, the calculation
      of the delta value was changed to use the modulo operator to protect
      against a negative difference due to the pointer wrapping around at the
      However, the ptr variables are unsigned, so a negative difference would
      result in the two complement's value which has no relation to the actual
      difference relative to the boundary; the result is typically some value
      near LONG_MAX-boundary.  Furthermore, even if the modulo operation would
      be done with signed types, the result of a negative dividend could be
      The invalid delta value is then caught by the following checks, but this
      means that the pointer update is ignored.
      To fix this, use a range check as in the other pointer calculations.
      Signed-off-by: default avatarClemens Ladisch <>
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>
  23. 21 May, 2010 1 commit
    • Clemens Ladisch's avatar
      ALSA: pcm: fix the fix of the runtime->boundary calculation · ead4046b
      Clemens Ladisch authored
      Commit 7910b4a1 in 2.6.34 changed the
      runtime->boundary calculation to make this value a multiple of both the
      buffer_size and the period_size, because the latter is assumed by the
      runtime->hw_ptr_interrupt calculation.
      However, due to the lack of a ioctl that could read the software
      parameters before they are set, the kernel requires that alsa-lib
      calculates the boundary value, too.  The changed algorithm leads to
      a different boundary value used by alsa-lib, which makes, e.g., mplayer
      fail to play a 44.1 kHz file because the silence_size parameter is now
      invalid; bug report:
      This patch reverts the change to the boundary calculation, and instead
      fixes the hw_ptr_interrupt calculation to be period-aligned regardless
      of the boundary value.
      Signed-off-by: default avatarClemens Ladisch <>
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>
  24. 26 Mar, 2010 1 commit
  25. 26 Jan, 2010 1 commit
    • Jaroslav Kysela's avatar
      ALSA: pcm_lib - return back hw_ptr_interrupt · e7636925
      Jaroslav Kysela authored
      Clemens Ladisch noted for hw_ptr_removal in "cleanup & merge hw_ptr
      update functions" commit:
      "It is possible for the status/delay ioctls to be called when the sound
      card's pointer register alreay shows a position at the beginning of the
      new period, but immediately before the interrupt is actually executed.
      (This happens regularly on a SMP machine with mplayer.)  When that
      happens, the code thinks that the position must be at least one period
      ahead of the current position and drops an entire buffer of data."
      Return back the hw_ptr_interrupt variable. The last interrupt pointer
      is always computed from the latest hw_ptr instead of tracking it
      separately (in this case all hw_ptr checks and modifications might
      influence also hw_ptr_interrupt and it is difficult to keep it
      Signed-off-by: default avatarJaroslav Kysela <>
  26. 21 Jan, 2010 1 commit
  27. 13 Jan, 2010 1 commit
  28. 08 Jan, 2010 1 commit
  29. 07 Jan, 2010 4 commits
  30. 22 Dec, 2009 1 commit
  31. 21 Dec, 2009 1 commit
    • Krzysztof Helt's avatar
      ALSA: fix incorrect rounding direction in snd_interval_ratnum() · 40962d7c
      Krzysztof Helt authored
      The direction of rounding is incorrect in the snd_interval_ratnum()
      It was detected with following parameters (sb8 driver playing
      8kHz stereo file):
       - num is always 1000000
       - requested frequency rate is from 7999 to 7999 (single frequency)
      The first loop calculates div_down(num, freq->min) which is 125.
      Thus, a frequency range's minimum value is 1000000 / 125 = 8000 Hz.
      The second loop calculates div_up(num, freq->max) which is 126
      The frequency range's maximum value is 1000000 / 126 = 7936 Hz.
      The range maximum is lower than the range minimum so the function
      fails due to empty result range.
      Signed-off-by: default avatarKrzysztof Helt <>
      Signed-off-by: default avatarTakashi Iwai <>
  32. 25 Aug, 2009 1 commit
  33. 20 Aug, 2009 1 commit
    • Takashi Iwai's avatar
      ALSA: pcm - Fix drain behavior in non-blocking mode · 4cdc115f
      Takashi Iwai authored
      The current PCM core has the following problems regarding PCM draining
      in non-blocking mode:
      - the current f_flags isn't checked in snd_pcm_drain(), thus changing
        the mode dynamically via snd_pcm_nonblock() after open doesn't work.
      - calling drain in non-blocking mode just return -EAGAIN error, but
        doesn't provide any way to sync with draining.
      This patch fixes these issues.
      - check file->f_flags in snd_pcm_drain() properly
      - when O_NONBLOCK is set, PCM core sets the stream(s) to DRAIN state
        but quits ioctl immediately without waiting the whole drain; the
        caller can sync the drain manually via poll()
      Signed-off-by: default avatarTakashi Iwai <>