1. 22 11月, 2010 3 次提交
    • C
      ALSA: pcm: detect xruns in no-period-wakeup mode · 59ff878f
      Clemens Ladisch 提交于
      When period wakeups are disabled, successive calls to the pointer update
      function do not have a maximum allowed distance, so xruns cannot be
      detected with the pointer value only.
      
      To detect xruns, compare the actually elapsed time with the time that
      should have theoretically elapsed since the last update.  When the
      hardware pointer has wrapped around due to an xrun, the actually elapsed
      time will be too big by about hw_ptr_buffer_jiffies.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      59ff878f
    • C
      ALSA: pcm: support for period wakeup disabling · ab69a490
      Clemens Ladisch 提交于
      This patch allows to disable period interrupts which are
      not needed when the application relies on a system timer
      to wake-up and refill the ring buffer. The behavior of
      the driver is left unchanged, and interrupts are only
      disabled if the application requests this configuration.
      The behavior in case of underruns is slightly different,
      instead of being detected during the period interrupts the
      underruns are detected when the application calls
      snd_pcm_update_avail, which in turns forces a refresh of the
      hw pointer and shows the buffer is empty.
      
      More specifically this patch makes a lot of sense when
      PulseAudio relies on timer-based scheduling to access audio
      devices such as HDAudio or Intel SST. Disabling interrupts
      removes two unwanted wake-ups due to period elapsed events
      in low-power playback modes. It also simplifies PulseAudio
      voice modules used for speech calls.
      
      To quote Lennart "This patch looks very interesting and
      desirable. This is something have long been waiting for."
      
      Support for this in hardware drivers is optional.
      Signed-off-by: NPierre-Louis Bossart <pierre-louis.bossart@intel.com>
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ab69a490
    • J
      ALSA: sound/core/pcm_lib.c: Remove unnecessary semicolons · c80c1d54
      Joe Perches 提交于
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c80c1d54
  2. 19 8月, 2010 1 次提交
  3. 18 8月, 2010 1 次提交
  4. 19 7月, 2010 1 次提交
  5. 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
  6. 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
  7. 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
  8. 26 3月, 2010 1 次提交
  9. 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
  10. 21 1月, 2010 1 次提交
  11. 13 1月, 2010 1 次提交
  12. 08 1月, 2010 1 次提交
  13. 07 1月, 2010 4 次提交
  14. 22 12月, 2009 1 次提交
  15. 21 12月, 2009 1 次提交
    • K
      ALSA: fix incorrect rounding direction in snd_interval_ratnum() · 40962d7c
      Krzysztof Helt 提交于
      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: NKrzysztof Helt <krzysztof.h1@wp.pl>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      40962d7c
  16. 25 8月, 2009 1 次提交
  17. 20 8月, 2009 1 次提交
    • T
      ALSA: pcm - Fix drain behavior in non-blocking mode · 4cdc115f
      Takashi Iwai 提交于
      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: NTakashi Iwai <tiwai@suse.de>
      4cdc115f
  18. 23 7月, 2009 3 次提交
  19. 22 7月, 2009 1 次提交
    • T
      ALSA: pcm - Fix regressions with VMware · 79452f0a
      Takashi Iwai 提交于
      VMware tends to report PCM positions and period updates at utterly
      wrong timing.  This screws up the recent PCM core code that tries
      to correct the position based on the irq timing.
      
      Now, when a backward irq position is detected, skip the update
      instead of rebasing.  (This is almost the old behavior before
      2.6.30.)
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      79452f0a
  20. 08 6月, 2009 1 次提交
  21. 07 6月, 2009 2 次提交
  22. 05 6月, 2009 1 次提交
  23. 29 5月, 2009 4 次提交
  24. 27 5月, 2009 2 次提交
    • T
      ALSA: Enable PCM hw_ptr_jiffies check only in xrun_debug mode · c87d9732
      Takashi Iwai 提交于
      The PCM hw_ptr jiffies check results sometimes in problems when a
      hardware doesn't give smooth hw_ptr updates.  So far, au88x0 and some
      other drivers appear not working due to this strict check.
      However, this check is a nice debug tool, and the capability should be
      still kept.
      
      Hence, we disable this check now as default unless the user enables it
      by setting the xrun_debug mode to the specific stream via a proc file.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c87d9732
    • T
      ALSA: Fix invalid jiffies check after pause · 6af3fb72
      Takashi Iwai 提交于
      The hw_ptr_jiffies has to be reset properly to avoid the invalid
      check of jiffies delta in snd_pcm_update_hw_ptr*() functions.
      Especailly this patch fixes the bogus jiffies check after the puase
      and resume.
      
      This patch is a modified version of the original patch by Jaroslav.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6af3fb72
  25. 28 4月, 2009 1 次提交
    • T
      ALSA: pcm core - Avoid jiffies check for devices with BATCH flag · 3e5b5016
      Takashi Iwai 提交于
      The hardware devices with SNDRV_PCM_INFO_BATCH flag can't give the
      precise current position.  And such hardwares have often big FIFO
      in addition to the ring buffer, and it screws up the jiffies check
      in pcm_lib.c.
      
      This patch adds a simple check of info flag so that the driver skips
      the jiffies check in snd_pcm_period_elapsed() when BATCH flag is set.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3e5b5016
  26. 10 4月, 2009 1 次提交
  27. 20 3月, 2009 1 次提交
  28. 19 3月, 2009 1 次提交