From owner-freebsd-current@FreeBSD.ORG Mon Jul 15 08:22:35 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8BC37D51; Mon, 15 Jul 2013 08:22:35 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: from mail-ob0-x234.google.com (mail-ob0-x234.google.com [IPv6:2607:f8b0:4003:c01::234]) by mx1.freebsd.org (Postfix) with ESMTP id 4EF8C301; Mon, 15 Jul 2013 08:22:35 +0000 (UTC) Received: by mail-ob0-f180.google.com with SMTP id eh20so13655034obb.11 for ; Mon, 15 Jul 2013 01:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ML8mAzaKGXcprMpE7d1tdzoudWm8DIWX5xVyIVDXURU=; b=WqyYllFGaaEefXlaxxyBzv5etUPyEnKiqT8qZzSZzGKA5rE0W1eIylPf8s9IekK9UX H4ka2/MPVss/wII/UeCtvR3RMHs/gjZ6WsfHmYB1gpBXBQVHlFRszEcjsZ4cOX6Mwgik Cvfau2xTEnRdkOPTJV7LN5z/wwhKm20HUdmLqMX8J0quNvSxVrvV156RXkaQDomcggFa G712OtpCI0UJfelXiG04x/ombMOlIV7hW2FDxdi3Skql0A3BU7zuUiBN5lw+Bq9jddRK UFv0NDRcNcxAtN2UIOQMp9Z4lredplgLX16bCGL9E/ndeoyMq3SjdREJMVWGEhqnKZdk cP1g== MIME-Version: 1.0 X-Received: by 10.60.45.103 with SMTP id l7mr42631717oem.25.1373876554838; Mon, 15 Jul 2013 01:22:34 -0700 (PDT) Sender: uspoerlein@gmail.com Received: by 10.76.9.5 with HTTP; Mon, 15 Jul 2013 01:22:34 -0700 (PDT) In-Reply-To: <51E0775F.3070805@FreeBSD.org> References: <20130712205446.GB2198@acme.spoerlein.net> <51E0775F.3070805@FreeBSD.org> Date: Mon, 15 Jul 2013 10:22:34 +0200 X-Google-Sender-Auth: m98gkfofsgl8cgG7I17VMUAikaY Message-ID: Subject: Re: Sound lag over HDMI From: =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jul 2013 08:22:35 -0000 2013/7/12 Alexander Motin : > On 12.07.2013 23:54, Ulrich Sp=C3=B6rlein 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@coyote:~# dmesg | egrep vgapci\|pcm >> vgapci0: port 0x3000-0x303f mem >> 0xe0000000-0xe03fffff,0xc0000000-0xdfffffff irq 16 at device 2.0 on pci0 >> agp0: on vgapci0 >> pcm0: at nid 20 and 24 on hdaa0 >> pcm1: at nid 30 and 31 on hdaa0 >> pcm2: at nid 6 on hdaa1 >> pcm3: at nid 7 on hdaa1 >> drmn0: 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 notice= d > lags. Before that I've also successfully used SPDIF connection for the lo= ng > time. Though I've never specially tested it somehow other then watching > movies. :) If you have some good testing methodology -- please, welcome t= o > 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 majo= r > 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 ea= ts > first second or about that of playback stream. It makes short sounds like > GUI event notifications inaudible sometimes. I guess that could be made t= o > 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 eve= r 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. Af= ter fixing the /dev/dri/card0 permission problem, even XBMC works like a charm on this system. Cheers, Uli