Re: Sound lag over HDMI

From: Ulrich Spörlein <uqs_at_FreeBSD.org>
Date: Mon, 15 Jul 2013 10:22:34 +0200
2013/7/12 Alexander Motin <mav_at_freebsd.org>:
> On 12.07.2013 23:54, Ulrich Spörlein wrote:
>>
>> I'm trying to setup XBMC on a -CURRENT box with an IvyBridge CPU and
>> GPU. While testing playback via mplayer on a LG TV over HDMI, I noticed
>> that sound is lagging video by about 100-200ms or so. When I switch to
>> using the jack outputs powered by some Realtek chip, audio is perfectly
>> fine.
>>
>> Is HDMI lag a known problem? Can this be fixed?
>>
>> root_at_coyote:~# dmesg | egrep vgapci\|pcm
>> vgapci0: <VGA-compatible display> port 0x3000-0x303f mem
>> 0xe0000000-0xe03fffff,0xc0000000-0xdfffffff irq 16 at device 2.0 on pci0
>> agp0: <IvyBridge mobile GT2 IG> on vgapci0
>> pcm0: <Realtek ALC888 (Rear Analog)> at nid 20 and 24 on hdaa0
>> pcm1: <Realtek ALC888 (Rear Digital)> at nid 30 and 31 on hdaa0
>> pcm2: <Intel Panther Point (HDMI/DP 8ch)> at nid 6 on hdaa1
>> pcm3: <Intel Panther Point (HDMI/DP 8ch)> at nid 7 on hdaa1
>> drmn0: <Intel IvyBridge (M)> on vgapci0
>
>
> I don't know what to say. I am now using HDMI audio from NVIDIA card to
> quite old external 5.1 receiver with XBMC every day, and I haven't noticed
> lags. Before that I've also successfully used SPDIF connection for the long
> time. Though I've never specially tested it somehow other then watching
> movies. :) If you have some good testing methodology -- please, welcome to
> share. By the HDA driver HDMI is handled exactly the same way as analog
> output from the point of data buffering, so I would not expect there major
> differences.
>
> You may try to experiment with hw.snd.latency sysctl to tune buffering in
> kernel to see whether it affect the result.
>
> Also you may compare delays when doing AC3/DTS pass-through with case of
> software decoding and discrete (multichannel) PCM playback.
>
> The only potentially related effect I have noticed is that my receiver eats
> first second or about that of playback stream. It makes short sounds like
> GUI event notifications inaudible sometimes. I guess that could be made to
> restore audio sync after some unavoidable startup delay, but that is only my
> guess.

Hmm, weird. I've rebooted the machine (it was up more than 30d before I ever
started up Xorg or any sound-using application), and maybe that fixed some
contigmalloc issues or something, because I can no longer reproduce
the problem.
I've had problems like this on an old laptop, where if I didn't start
X11 within 24h
of rebooting, it wouldn't start up. This system is using ZFS of
course, so unless
you take memory early on, ZFS will have eaten it :)

Anyway, thanks for your suggestions and I can confirm everything's fine. After
fixing the /dev/dri/card0 permission problem, even XBMC works like a charm
on this system.

Cheers,
Uli
Received on Mon Jul 15 2013 - 06:22:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC