Hi!

Having DP/HDMI Audio output on Mesa is a problem that I avoided for too long.

Basically I have a TV that I’d had like to use it with my desktop PC. Now, the fact that it isn’t my main monitor is the main reason why I didn’t bother too much in finding a solution. I forgot about it and did everything on muh PC room 8)

But as I spend some fiat on that screen why not to use it? Also because I don’t know what else I’m going to use it for… (I fucking watch no brainwashing TV nor there is an evil cable/antenna connected to it. FOAD)

So here I am.

The problem lies in some code from AMD not being accepted in the currently release Linux Kernels, leaving Mesa users without DP/HDMI audio.

Read more here:

Now the good news are:

The code has been accepted in 4.15 (will be available soon). There are a few patched Kernels specific for AMD containing these patches.

So to fix the issue you can either use 4.15 (which has a few RC already out) or use a patched Kernel.

I personally installed the Kernel 4.15 so keep that in mind while reading this guide, the other Kernel probably work the same but you could encounter other problems that won’t be discussed here.

Also I’m on Arch Linux where installing cutting edge and custom software is very easy, if you are using another distro and can’t find these patched Kernels just go for 4.15 ;)

Lastly: I use Pulseaudio.

This is what you need to do:

Install a Kernel. Modify a kernel parameter (only for pre-Vega cards). Test the available HDMI channels/devices. Tweak Pulseaudio with Pavucontrol.

That’s it! I’ll provide links to the Arch Wiki for every steps, these are very useful also if you’re on another distro.

1) Kernel

As said on Arch it’s quite easy as the AUR has a nice package called linux-git (I installed the 4.15rc7).

Alternatively you can add an external repository so that you won’t need to compile the kernel anytime it gets update, I suggest you to opt for this option (I also use an external repo for mesa-git and it saves soooo much time). [many thanks to Reddit’s user haagch for the suggestion]

This is the repo:

add it to your /etc/pacman.conf and then follow these instructions on how to add thr unofficial key:

Then install the package it:

# pacman -S linux-mainline

If you prefer to compile it with the AUR PKGBUILD:

To install it I’m using yaourt:

# yaourt -S linux-git

to speed up a bit open /etc/makepkg.conf and uncomment and modify this line like this:

MAKEDEPENDS="-j$nproc"

this variable will be called later in the PKGBUILD.

As for the AMD patched Kernels any linux-amd* should work as stated in the wiki:

2) Kernel parameters

Only for pre-Vega cards as stated here:

To modify open /etc/default/grub and add to GRUB_CMDLINE_LINUX_DEFAULT this option amdgpu.dc=1

here’s mine:

GRUB_CMDLINE_LINUX_DEFAULT="quiet amdgpu.dc=1"

then update grub:

# grub-mkconfig -o /boot/grub/grub.cfg

wiki:

3) Test the available channels/devices

You can skip this point and come back if you can’t get PulseAudio to output audio.

to test the channels first run:

aplay -l

This will print a list of the available cards, this is mine:

aplay -l **** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3] Subdevices: 0/1 Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: PX22 [Turtle Beach PX22], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0

as you can see HDMI is card 1 and its devices are 3 and 7-11

we can try device 3 with speaker-test like this:

speaker-test -Dplughw:1,3

and CTRL+C to stop the loops.

but since I’m a lazy guy I’m going to try them all with a single command

for i in {3..11}; do speaker-test -c2 -l2 -Dplughw:1,$i; done

this will send 2 loops of audio (-l2) to each device {3..11}, testing 2 channels (-c2).

modify these accordingly :)

In my case it prints a few errors as I have no device 4,5 and 6 but it successfully tries all the devices.

At this point you should hear a sound!

If you get:

Playback open error: -16,Device or resource busy

run:

pulseaudio -k

and retry, this is most likely the correct devices but already captured by PulseAudio, restarting Pulseaudio will make it available.

4) Pavucontrol

open Pavucontrol and check the Configuration Tab, you may have many different profiles to chose from, to me there is just one available, most are marked as unavailable.

That profile should be the right one!

Now play an audio track and be sure that under the Playback tab the correct output is selected and that under the Output Devices tab your device is not muted or has low volume.

Now you should hear audio through DP/HDMI!

If it doesn’t work try to run:

pulseaudio -k

and see what happens, if you still have no luck go to point 3 and try/retry speaker-test

Remember that PulseAudio remembers it’s settings, so always take a look at the Playback tab on pavucontrol or simply turn off every device that you don’t need :)

TA SALÜDE