Bug 42567

Summary: Alsa dmix no longer works with nvidia HDMI and 3.2.0
Product: Drivers Reporter: dura (dura)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, caralu74, Development, florian, jhuber722, tiwai, yupadmin
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.2.0 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: asound.conf
Test patch
alsa-info.txt.b7Y8Fmnqcp
Revised test patch
Yet more revised patch

Description dura 2012-01-09 09:27:02 UTC
Created attachment 72055 [details]
asound.conf
Comment 1 dura 2012-01-09 09:56:36 UTC
When using dmix and kernel 3.2.0 mplayer and others hang when starting to play audio with my NVidia GT240. No problem when talking directly to hardware (see attached asound.conf).
This is related to HDMI buffer size change in hda_intel.c.
Things work work normaly if commenting:
2755         if (chip->driver_caps & AZX_DCAPS_BUFSIZE)
2756                 align_buffer_size = 0;
which in fact changes buffer size from 4 to 128.

Note 1: git bisect was not able to find the bad commit.
Note 2: As "https://bugzilla.kernel.org/buglist.cgi" keeps saying "Can't connect to MySQL server on '127.0.0.1'", I can't make a duplicate search.
Comment 2 Takashi Iwai 2012-01-18 14:49:49 UTC
OK, then we can add AZX_DCSPS_BUFSIZE bit to the driver_data field of your HD-audio controller device.  Could you try the patch below?
Comment 3 Takashi Iwai 2012-01-18 14:50:14 UTC
Created attachment 72109 [details]
Test patch
Comment 4 Development 2012-01-20 20:59:58 UTC
For me your patch did not fix it. Commenting line 2755+2756 in hda_intel.c like dura described it in comment #1 fixed it. 

See https://bbs.archlinux.org/viewtopic.php?id=133875 
and
http://www.nvnews.net/vbulletin/showthread.php?t=172449
for some more infos.
Comment 5 Takashi Iwai 2012-01-20 21:19:21 UTC
(In reply to comment #4)
> For me your patch did not fix it. Commenting line 2755+2756 in hda_intel.c
> like
> dura described it in comment #1 fixed it. 
> 
> See https://bbs.archlinux.org/viewtopic.php?id=133875 
> and
> http://www.nvnews.net/vbulletin/showthread.php?t=172449
> for some more infos.

Your must be a different controller.  Attach alsa-info.sh output to this bugzilla.
Comment 6 Development 2012-01-20 22:17:42 UTC
Created attachment 72143 [details]
alsa-info.txt.b7Y8Fmnqcp
Comment 7 Development 2012-01-20 22:18:53 UTC
I uploaded it as alsa-info.txt.b7Y8Fmnqcp.

My card is a Geforce 210 (Chipset GT218), used output is 1,7 (HDMI Audio).
Comment 8 Yarema 2012-01-22 14:29:02 UTC
Same issue on Zotac HD id11-e, GT218, no sound through HDMI.
Alsa-info uploaded there: http://www.alsa-project.org/db/?f=5a6758face52e86482331da646c2c22a9163844f
Comment 9 Yarema 2012-01-22 19:27:02 UTC
I want to report, that patch in comment #6 doesn't fix the problem. I gonna try fix as it was explained by Dura, but kernel compiling take same time. I'll report it.
Comment 10 Takashi Iwai 2012-01-23 09:54:54 UTC
Ah, OK, I see the things in a wrong way; the buffers must be aligned on these, instead of unaligned.

Could you try the patch below instead?
Comment 11 Takashi Iwai 2012-01-23 09:55:40 UTC
Created attachment 72152 [details]
Revised test patch
Comment 12 Development 2012-01-23 16:03:10 UTC
Revised test patch works fine for me.
Comment 13 Takashi Iwai 2012-01-23 16:16:03 UTC
Thanks for a quick check.

BTW, the patch above contains some incomplete chunks.  The below is the reduced version I'm going to apply to the upstream.
Comment 14 Takashi Iwai 2012-01-23 16:16:39 UTC
Created attachment 72174 [details]
Yet more revised patch
Comment 15 Development 2012-01-23 16:45:52 UTC
I also tried the "more revised patch", works fine, too. Thx for the fix, hopefully we see it in 3.2.2
Comment 16 Yarema 2012-01-23 20:42:32 UTC
@Takashi, your last patch works pretty well! Hope it will be included in the next kernel release. Thanks!
Comment 17 dura 2012-01-23 22:53:23 UTC
The latest patch works here too
Comment 18 Florian Mickler 2012-02-01 21:01:05 UTC
A patch referencing this bug report has been merged in Linux v3.3-rc2:

commit 52409aa6a0e96337da137c069856298f4dd825a0
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Jan 23 17:10:24 2012 +0100

    ALSA: hda - Fix buffer-alignment regression with Nvidia HDMI
Comment 19 J 2012-02-04 08:50:37 UTC
ac3 passthrough is broken on my Intel CougarPoint HDMI output with the 3.2 kernel, but this system does not have an nvidia card.  3.1 kernel works fine.  Could this be due to this bug?
(Lenovo x220, Gentoo x86_64)
Comment 20 caralu74 2012-02-28 19:09:08 UTC
This patch does not work for me, but I SOLVED the problem adding pci=use_crs to my Kernel options, so I edit in this way:
sudo gedit /etc/default/grub and add change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=use_crs"
and my sound card is now recognized and work well.
I follow these 2 links:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5533
and the link that solved was   https://bugzilla.kernel.org/show_bug.cgi?id=42619

Thank you so much to everybody that help to solve this problems.
Comment 21 caralu74 2012-02-29 21:38:34 UTC
Today after a minor kernel update I restar my pc and the sound has gone, my sound card is not recognized so I recompiled the alsa-driver-1.0.25 patched and the sound card is now recognized, so this PATCH WORK FOR ME.