1. 19 8月, 2013 1 次提交
    • T
      ALSA: pcm: Use snd_printd_ratelimit() · 74d779ab
      Tim Gardner 提交于
      The use of snd_printd_ratelimit() supresses superfluous output from
      printk_ratelimit() when CONFIG_SND_DEBUG is not defined. For example,
      
      [   43.753692] snd_pcm_update_hw_ptr0: 26 callbacks suppressed
      [   48.822131] snd_pcm_update_hw_ptr0: 25 callbacks suppressed
      [   53.894953] snd_pcm_update_hw_ptr0: 25 callbacks suppressed
      [   58.997761] snd_pcm_update_hw_ptr0: 25 callbacks suppressed
      [   64.100952] snd_pcm_update_hw_ptr0: 25 callbacks suppressed
      
      fills the log even when no debug output is actually produced.
      
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Yacine Belkadi <yacine.belkadi.1@gmail.com>
      Signed-off-by: NTim Gardner <tim.gardner@canonical.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      74d779ab
  2. 24 5月, 2013 1 次提交
  3. 12 3月, 2013 1 次提交
  4. 23 10月, 2012 2 次提交
  5. 13 9月, 2012 1 次提交
  6. 11 9月, 2012 1 次提交
  7. 07 9月, 2012 2 次提交
    • T
      ALSA: Remove VOLATILE flag from chmap ctls · 6e67683d
      Takashi Iwai 提交于
      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: NTakashi Iwai <tiwai@suse.de>
      6e67683d
    • T
      ALSA: PCM: channel mapping API implementation · 2d3391ec
      Takashi Iwai 提交于
      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
        (sub)stream.
      
      - Some standard pre-defined channel maps are provided for
        convenience.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2d3391ec
  8. 05 7月, 2012 1 次提交
  9. 23 5月, 2012 1 次提交
  10. 12 5月, 2012 1 次提交
    • T
      ALSA: pcm - Optimize the call of snd_pcm_update_hw_ptr() in read/write loop · 0910c216
      Takashi Iwai 提交于
      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: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0910c216
  11. 15 3月, 2012 1 次提交
  12. 01 11月, 2011 1 次提交
  13. 20 9月, 2011 1 次提交
  14. 15 9月, 2011 1 次提交
    • A
      ALSA: pcm - fix race condition in wait_for_avail() · 763437a9
      Arjan van de Ven 提交于
      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
         happens.
      
      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: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: <stable@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      763437a9
  15. 24 7月, 2011 1 次提交
  16. 26 5月, 2011 1 次提交
  17. 19 5月, 2011 1 次提交
  18. 18 5月, 2011 1 次提交
    • B
      ALSA: sound, core, pcm_lib: xrun_log: log also in_interrupt · ec08b144
      Ben Gardiner 提交于
      When debugging pcm drivers I found the "period" or "hw" prefix printed
      by either XRUN_DEBUG_PERIODUPDATE or XRUN_DEBUG_PERIODUPDATE events,
      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: NBen Gardiner <bengardiner@nanometrics.ca>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ec08b144
  19. 02 4月, 2011 1 次提交
  20. 21 12月, 2010 1 次提交
  21. 22 11月, 2010 4 次提交
  22. 19 8月, 2010 1 次提交
  23. 18 8月, 2010 1 次提交
  24. 19 7月, 2010 1 次提交
  25. 28 6月, 2010 1 次提交
    • D
      ALSA: pcm_lib: avoid timing jitter in snd_pcm_read/write() · 5daeba34
      David Dillow 提交于
      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: NDave Dillow <dave@thedillows.org>
      Signed-off-by: NJaroslav Kysela <perex@perex.cz>
      5daeba34
  26. 26 5月, 2010 1 次提交
    • C
      ALSA: pcm: fix delta calculation at boundary wraparound · b406e610
      Clemens Ladisch 提交于
      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
      boundary.
      
      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
      negative.
      
      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: NClemens Ladisch <clemens@ladisch.de>
      Cc: <stable@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b406e610
  27. 21 5月, 2010 1 次提交
    • C
      ALSA: pcm: fix the fix of the runtime->boundary calculation · ead4046b
      Clemens Ladisch 提交于
      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:
      <https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5015>.
      
      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: NClemens Ladisch <clemens@ladisch.de>
      Cc: <stable@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ead4046b
  28. 26 3月, 2010 1 次提交
  29. 27 1月, 2010 1 次提交
    • J
      ALSA: pcm_lib - return back hw_ptr_interrupt · e7636925
      Jaroslav Kysela 提交于
      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
      consistent).
      Signed-off-by: NJaroslav Kysela <perex@perex.cz>
      e7636925
  30. 21 1月, 2010 1 次提交
  31. 13 1月, 2010 1 次提交
  32. 08 1月, 2010 1 次提交
  33. 07 1月, 2010 3 次提交