Optimus系统上的HDMI音频

我有一个运行Ubuntu 14.04 build 05/05/14的华硕G46vw(规格如下),这台笔记本电脑配有Intel Card和660M分立器件。 我非常高兴能让HDMI与Optimus合作。 但我最后一件事让我疯了。 音频通过HDMI。

我试过用这个问题搜索废话,我很擅长通过论坛阅读为自己搞清楚,但到目前为止我没有运气。 Pulseaudio没有列出我的HDMI输出。 也许我需要更新Pulse Audio? 以下是更多信息。

播放硬件设备列表

# aplay -l card 0: PCH [HDA Intel PCH], device 0: VT1802 Analog [VT1802 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 1: VT1802 Digital [VT1802 Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 2: VT1802 Alt Analog [VT1802 Alt Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 # cat /proc/asound/cards 0 [PCH ]: HDA-Intel - HDA Intel PCH HDA Intel PCH at 0xf7a10000 irq 46 

我设法使用“NVIDIA公司GF116M [GeForce GT 555M / 635M]”GPU,使用nvidia驱动程序和nvidia-prime在我的笔记本电脑上运行HDMI音频输出。 这个过程相当复杂,你必须在每次重启后执行它。 我编写了一个脚本,尽可能自动化该过程。 它的评论解释了它的作用。 ( 编辑: 如果您不喜欢运行脚本,您也可以按照此处描述的步骤操作: https : //askubuntu.com/a/660910/73753

 #!/bin/bash # Check if we are executing as root if [ $UID != 0 ]; then echo "This script must be run as root."; exit fi # The nvidia driver cannot be loaded while we are configuring the GPU. # Check whether the nvidia kernel is loaded: if grep nvidia /proc/modules; then # It is. Check if we have HDMI audio if lspci | grep 01:00.1; then # Yes, so we are already done. echo "The following list should contain HDMI audio devices" aplay -l alsa reload echo "--> You are done!"; exit else # No, disable output through nvidia: prime-select intel echo "Please reboot. Afterwards rerun this script."; exit fi fi # Make sure that the GPU is powered if ! lspci -H1 | grep 01:00.0; then if ! grep OFF /proc/acpi/bbswitch; then echo "ERROR: GPU is listed in lspci -H1, but bbswitch thinks it is off"; exit 1 fi # Turn on the discrete GPU (to get it listed in `lspci -H1`) echo ON > /proc/acpi/bbswitch if ! grep ON /proc/acpi/bbswitch; then echo "ERROR: Failed to turn on the GPU"; exit 1 fi fi # Check if the GPU's audio chip is powered if ! lspci -H1 | grep 01:00.1; then echo "Suspend the pc and resume it again. This will turn on the audio chip on the discrete GPU. Afterwards rerun this script."; exit fi # The output of 'lscpi -H1' should now contain 2 lines similar to: # 01:00.0 VGA compatible controller: NVIDIA Corporation GF116M [GeForce GT 555M/635M] (rev a1) # 01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1) # Now we need to rescan for the GPU such that the audio chip is found as well if lspci | grep 01:00.0; then # Now we 'unmount' the GPU # the nvidia driver is not loaded, otherwise this step would eventualy cause your computer to freeze/hang echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove # Wait a bit sleep 1 # Check if this succeeded if ! lspci | grep 01:00.0; then echo "ERROR: Failed to remove the GPU (or so it seems, you can try again)"; exit 1 fi fi if ! lspci | grep 01:00.0; then # Rescan echo 1 > /sys/bus/pci/rescan if ! lspci | grep 01:00.1; then echo "ERROR: Rescan did not find the audio chip"; exit 1 fi # The output of 'lspci' should now contain 2 lines similar to: # 01:00.0 VGA compatible controller: NVIDIA Corporation GF116M [GeForce GT 555M/635M] (rev a1) # 01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1) # Now we are ready to restart X11 using the nvidia driver prime-select nvidia echo "Please log out and in again. Afterwards rerun this script."; exit fi echo "ERROR: Something went wrong"; exit 1 

好的,所以以下适用于nvidia-384专有驱动程序,在Ubuntu Gnome 16.04.3上安装了nvidia-prime。 理论上它应该适用于所有Nvidia optimus芯片组。

 $ sudo prime-select intel $ sudo reboot // After the reboot and login $ sudo lspci -H1 | grep -i nvidia 

这只会显示VGA控制器,而不是音频芯片。 要启用音频芯片,请执行以下命令。

 $ sudo su # setpci -s 01:00.0 0x488.l=0x2000000:0x2000000 # echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove // where 0000:01:00.0 is your VGA device in sysfs PCI heirarchy. # echo "1" > /sys/bus/pci/rescan # lspci -H1 | grep -i nvidia 

这次它会向你展示音频芯片。 例如,对我来说,最后一个命令显示:

01:00.0 VGA兼容控制器:NVIDIA Corporation GK107GLM [Quadro K1100M](rev a1)01:00.1音频设备:NVIDIA Corporation GK107 HDMI音频控制器(rev a1)

现在,您需要设置环境并加载Nvidia驱动程序。 为此,退出root shell,将nvidia设置为主要设备并重新启动显示管理器即

 # exit $ sudo prime-select nvidia $ sudo service gdm restart 

登录后,驱动程序将音频控制器注册到Alsa,因此您现在可以在声音设置中选择HDMI音频。 希望这有助于某人。