[alsa-devel] Intel HDA + HDMI - snd_pcm_drain buggy behaviour.
Sander Jansen
s.jansen at gmail.com
Sun Feb 16 01:44:39 CET 2014
All,
When I play regular PCM audio through the HDMI that's connected to my
amplifier I noticed buggy behaviour when using the snd_pcm_drain() call.
>From my understanding of ALSA, during playback snd_pcm_drain() normally
blocks until the playback buffer is empty.
Here's what I'm experiencing:
a. If the PCM handle is in BLOCKING mode, the snd_pcm_drain() function will
block indefinitely (I've waited 30 seconds, before I gave up).
b. In NON-BLOCKING mode, the first call to snd_pcm_drain results in a
" Resource temporarily unavailable", subsequent call works but the pcm
state has changed to DRAINING and takes about 1 sec to change to SETUP.
Even though the audio has less than 0.5 seconds of actual playback left.
So to make it work, I changed my single snd_pcm_drain() call into the
following pseudo code:
while(state==RUNNING && snd_pcm_drain()<0) {
state=snd_pcm_state()
}
while(state==DRAINING && sleep(100)){
state=snd_pcm_state()
}
Even though this seem to "sort of work", another problem with this approach
I've noticed, is that part of the beginning of the playback buffer may be
replayed at the end of the drain:
1. start playback at beginning of file
2. seek to close to the end of the file (snd_pcm_drop() gets called)
3. end of file reached, drain gets called, hear the end of the song +
part of the beginning again?
So I'm wondering whether this may be related to the drain issue I've
noticed. I've attached the alsa-info.
Thanks,
Sander
-------------- next part --------------
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.62
!!################################
!!Script ran on: Sat Feb 15 23:44:15 UTC 2014
!!Linux Distribution
!!------------------
Arch Linux \r (\l) NAME="Arch Linux" ID=arch PRETTY_NAME="Arch Linux" HOME_URL="https://www.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://bugs.archlinux.org/"
!!DMI Information
!!---------------
Manufacturer:
Product Name:
Product Version:
Firmware Version: GKPPT10H.86A.0020.2012.0919.2135
!!Kernel Information
!!------------------
Kernel release: 3.13.3-1-ARCH
Operating System: GNU/Linux
Architecture: x86_64
Processor: unknown
SMP Enabled: Yes
!!ALSA Version
!!------------
Driver version: k3.13.3-1-ARCH
Library version: 1.0.27.2
Utilities version: 1.0.27.2
!!Loaded ALSA modules
!!-------------------
snd_hda_intel
!!Sound Servers on this system
!!----------------------------
Jack:
Installed - Yes (/usr/bin/jackd)
Running - No
!!Soundcards recognised by ALSA
!!-----------------------------
0 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf7c20000 irq 43
!!PCI Soundcards installed in the system
!!--------------------------------------
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
!!Advanced information - PCI Vendor/Device/Subsystem ID's
!!-------------------------------------------------------
00:1b.0 0403: 8086:1e20 (rev 04)
Subsystem: 8086:2044
!!Loaded sound module options
!!---------------------------
!!Module: snd_hda_intel
align_buffer_size : -1
bdl_pos_adj : 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
beep_mode : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
enable_msi : -1
id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
jackpoll_ms : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
patch : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
position_fix : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
power_save : 0
power_save_controller : Y
probe_mask : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
probe_only : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
single_cmd : N
snoop : Y
!!HDA-Intel Codec information
!!---------------------------
--startcollapse--
Codec: Intel PantherPoint HDMI
Address: 3
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x80862806
Subsystem Id: 0x80860101
Revision Id: 0x100000
No Modem Function Group found
Default PCM:
rates [0x0]:
bits [0x0]:
formats [0x0]:
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
Power states: D0 D3 CLKSTOP EPSS
Power: setting=D0, actual=D0, Clock-stop-OK
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x02 [Audio Output] wcaps 0x6611: 8-Channels Digital
Converter: stream=8, channel=0
Digital: Enabled GenLevel
Digital category: 0x2
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1e]: 16 20 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x6611: 8-Channels Digital
Converter: stream=0, channel=0
Digital: Enabled
Digital category: 0x0
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1e]: 16 20 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x6611: 8-Channels Digital
Converter: stream=0, channel=0
Digital: Enabled
Digital category: 0x0
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1e]: 16 20 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Node 0x05 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
Control: name="IEC958 Playback Con Mask", index=0, device=0
Control: name="IEC958 Playback Pro Mask", index=0, device=0
Control: name="IEC958 Playback Default", index=0, device=0
Control: name="IEC958 Playback Switch", index=0, device=0
Control: name="ELD", index=0, device=3
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x00]
Pincap 0x09000094: OUT Detect HBR HDMI DP
Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x1, Sequence = 0x0
Pin-ctls: 0x40: OUT
Unsolicited: tag=01, enabled=1
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
0x02
Node 0x06 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x80]
Pincap 0x09000094: OUT Detect HBR HDMI DP
Pin Default 0x58560020: [N/A] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x2, Sequence = 0x0
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
0x03
Node 0x07 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
Control: name="HDMI/DP,pcm=7 Jack", index=0, device=0
Control: name="IEC958 Playback Con Mask", index=1, device=0
Control: name="IEC958 Playback Pro Mask", index=1, device=0
Control: name="IEC958 Playback Default", index=1, device=0
Control: name="IEC958 Playback Switch", index=1, device=0
Control: name="ELD", index=0, device=7
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x00]
Pincap 0x09000094: OUT Detect HBR HDMI DP
Pin Default 0x18560030: [Jack] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x3, Sequence = 0x0
Pin-ctls: 0x40: OUT
Unsolicited: tag=02, enabled=1
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
0x04
Node 0x08 [Vendor Defined Widget] wcaps 0xf00000: Mono
--endcollapse--
!!ALSA Device nodes
!!-----------------
crw-rw----+ 1 root audio 116, 5 Feb 15 16:36 /dev/snd/controlC0
crw-rw----+ 1 root audio 116, 4 Feb 15 16:36 /dev/snd/hwC0D3
crw-rw----+ 1 root audio 116, 3 Feb 15 17:38 /dev/snd/pcmC0D3p
crw-rw----+ 1 root audio 116, 2 Feb 15 16:36 /dev/snd/pcmC0D7p
crw-rw---- 1 root audio 116, 1 Feb 15 16:36 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Feb 15 16:36 /dev/snd/timer
/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 60 Feb 15 16:36 .
drwxr-xr-x 3 root root 180 Feb 15 16:36 ..
lrwxrwxrwx 1 root root 12 Feb 15 16:36 pci-0000:00:1b.0 -> ../controlC0
!!ALSA configuration files
!!------------------------
!!User specific config file (~/.asoundrc)
pcm.!default {
type hw
card 0
device 3
}
!!Aplay/Arecord output
!!--------------------
APLAY
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
ARECORD
**** List of CAPTURE Hardware Devices ****
!!Amixer output
!!-------------
!!-------Mixer controls for card 0 [PCH]
Card hw:0 'PCH'/'HDA Intel PCH at 0xf7c20000 irq 43'
Mixer name : 'Intel PantherPoint HDMI'
Components : 'HDA:80862806,80860101,00100000'
Controls : 14
Simple ctrls : 2
Simple mixer control 'IEC958',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'IEC958',1
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
!!Alsactl output
!!--------------
--startcollapse--
state.PCH {
control.1 {
iface CARD
name 'HDMI/DP,pcm=3 Jack'
value true
comment {
access read
type BOOLEAN
count 1
}
}
control.2 {
iface MIXER
name 'IEC958 Playback Con Mask'
value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
control.3 {
iface MIXER
name 'IEC958 Playback Pro Mask'
value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
control.4 {
iface MIXER
name 'IEC958 Playback Default'
value '0482000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write'
type IEC958
count 1
}
}
control.5 {
iface MIXER
name 'IEC958 Playback Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.6 {
iface PCM
device 3
name ELD
value '10000d006782005f00000000000000004c2d0d0553414d53554e47097f070f7f071507503e1fc04d02005706006754005f54010000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read volatile'
type BYTES
count 83
}
}
control.7 {
iface CARD
name 'HDMI/DP,pcm=7 Jack'
value false
comment {
access read
type BOOLEAN
count 1
}
}
control.8 {
iface MIXER
name 'IEC958 Playback Con Mask'
index 1
value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
control.9 {
iface MIXER
name 'IEC958 Playback Pro Mask'
index 1
value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
control.10 {
iface MIXER
name 'IEC958 Playback Default'
index 1
value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write'
type IEC958
count 1
}
}
control.11 {
iface MIXER
name 'IEC958 Playback Switch'
index 1
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.12 {
iface PCM
device 7
name ELD
value ''
comment {
access 'read volatile'
type BYTES
count 0
}
}
control.13 {
iface PCM
device 3
name 'Playback Channel Map'
value.0 0
value.1 0
value.2 0
value.3 0
value.4 0
value.5 0
value.6 0
value.7 0
comment {
access 'read write'
type INTEGER
count 8
range '0 - 36'
}
}
control.14 {
iface PCM
device 7
name 'Playback Channel Map'
value.0 0
value.1 0
value.2 0
value.3 0
value.4 0
value.5 0
value.6 0
value.7 0
comment {
access 'read write'
type INTEGER
count 8
range '0 - 36'
}
}
}
--endcollapse--
!!All Loaded Modules
!!------------------
Module
arc4
ecb
md4
md5
hmac
nls_utf8
cifs
fscache
fuse
joydev
hid_logitech_dj
usbhid
hid
mousedev
ir_lirc_codec
lirc_dev
ir_mce_kbd_decoder
ir_sanyo_decoder
ir_sony_decoder
ir_nec_decoder
ir_rc6_decoder
ir_jvc_decoder
ir_rc5_decoder
rc_rc6_mce
mceusb
rc_core
snd_hda_codec_hdmi
iTCO_wdt
iTCO_vendor_support
evdev
intel_rapl
x86_pkg_temp_thermal
intel_powerclamp
coretemp
kvm_intel
kvm
crct10dif_pclmul
crct10dif_common
crc32_pclmul
crc32c_intel
ghash_clmulni_intel
cryptd
microcode
pcspkr
i2c_i801
fan
thermal
i915
snd_hda_intel
snd_hda_codec
intel_agp
intel_gtt
snd_hwdep
snd_pcm
drm_kms_helper
drm
snd_page_alloc
snd_timer
e1000e
snd
i2c_algo_bit
soundcore
mei_me
i2c_core
mei
ptp
processor
lpc_ich
video
button
pps_core
ext4
crc16
mbcache
jbd2
sd_mod
ahci
libahci
libata
ehci_pci
ehci_hcd
scsi_mod
usbcore
usb_common
!!Sysfs Files
!!-----------
/sys/class/sound/hwC0D3/init_pin_configs:
0x05 0x18560010
0x06 0x58560020
0x07 0x18560030
/sys/class/sound/hwC0D3/driver_pin_configs:
/sys/class/sound/hwC0D3/user_pin_configs:
/sys/class/sound/hwC0D3/init_verbs:
/sys/class/sound/hwC0D3/hints:
!!ALSA/HDA dmesg
!!--------------
[ 1.351481] e1000e 0000:00:19.0 eth0: MAC: 10, PHY: 11, PBA No: FFFFFF-0FF
[ 1.351755] snd_hda_intel 0000:00:1b.0: irq 43 for MSI/MSI-X
[ 1.360950] usb 2-1.1: new full-speed USB device number 3 using ehci-pci
[ 1.374727] input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1b.0/sound/card0/input4
[ 1.374841] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1b.0/sound/card0/input3
[ 1.379470] [drm] Memory usable by graphics device = 2048M
--
[ 150.531900] type=1006 audit(1392503914.568:5): pid=1432 uid=0 old auid=4294967295 new auid=1000 old ses=4294967295 new ses=4 res=1
[ 293.675643] hda-intel 0000:00:1b.0: Unstable LPIB (4194300 >= 131072); disabling LPIB delay counting
[ 1438.757738] type=1006 audit(1392505201.717:6): pid=1562 uid=0 old auid=4294967295 new auid=1000 old ses=4294967295 new ses=5 res=1
More information about the Alsa-devel
mailing list