# Radeon HDMI audio supported?



## canadagolffan (Mar 21, 2015)

Hello,

I was just wondering if audio out via HDMI is supported via the radeon driver?  Having trouble finding out the correct info, as it seems its supported in Linux, and was once supported in FreeBSD via the radeonhd driver (which is obsolete now?), but not sure if it works now in FreeBSD?

Just asking, as I can't get audio out working via HDMI.  X video output via HDMI works fine.

`cat /dev/sndstat`

```
Installed devices:
pcm0: <ATI RS690/780 (HDMI)> (play) default
pcm1: <VIA VT1828S (Analog 7.1+HP/2.0)> (play/rec)
pcm2: <VIA VT1828S (Rear-panel Digital)> (play)
```
`kldstat | grep radeon`

```
3    1 0xffffffff8195a000 6908     radeonkmsfw_RV610_me.ko
4    1 0xffffffff81961000 1e18     radeonkmsfw_RV610_pfp.ko
5    1 0xffffffff81963000 2100     radeonkmsfw_R600_rlc.ko
6    1 0xffffffff81966000 1e20     radeonkmsfw_RS780_pfp.ko
7    1 0xffffffff81968000 6908     radeonkmsfw_RS780_me.ko
8    1 0xffffffff8196f000 1b1a48   radeonkms.ko
```
`uname -a`

```
FreeBSD freebsd 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
Thanks.


----------



## CrispyWalrus (Mar 22, 2015)

I am also experiencing a similar issue.  I recently installed 10.1 on a second disk in my desktop.  I have a PCIE PowerColor Radeon HD 7750 which I connect to a flatscreen via hdmi for both my sound and video.  This works fine with the Catalyst drivers in Windows, but the radeon driver in FreeBSD does not seem to like audio.  Other than sound everything seems fine.


----------



## canadagolffan (Mar 23, 2015)

The only thing I can find digging through the source code is:

`cat /usr/src/sys/dev/drm2/radeon/radeon_drv.c | grep radeon_audio`


```
int radeon_audio = 0;
```

Now whether or not I'm brave enough to recompile a kernel with that set to 1, I don't know, but I think I will give it a try one of these days.

But I'm guessing it's set to 0 for a reason?


----------



## CrispyWalrus (Mar 23, 2015)

I may try that... but no real idea either.  I'm very rusty--haven't run FreeBSD since mid-2000s and I'm no code monkey.  I know enough to be dangerous as the saying goes.

I can boot with a Fedora LiveCD and multimedia works fine--viewed a vid at YouTube; so I was wondering about ndisgen(8) or linux-compat options too...


----------



## canadagolffan (Mar 23, 2015)

Just as an update, I compiled a new kernel with the modified /usr/src/sys/dev/drm2/radeon/radeon_drv.c and guess what... sound works via HDMI!

Not sure why radeon_audio is set to 0, but when it's set to 1, audio works!

I guess more testing is needed to see if it's not stable or whatever, but for now, I have HDMI audio.


----------



## CrispyWalrus (Mar 23, 2015)

Sweet!  Guess I'll stop poking around compats for now and try building a kernel ...

I do have diff symptom though-- no sound detected at all:


```
chris@odobenus ~ $ cat /dev/sndstat
Installed devices:
chris@odobenus ~ $ kldstat |grep radeon
30  1 0xffffffff81da3000 1b1a48  radeonkms.ko
35  1 0xffffffff81fdd000 36a0  radeonkmsfw_VERDE_pfp.ko
36  1 0xffffffff81fe1000 3688  radeonkmsfw_VERDE_me.ko
37  1 0xffffffff81fe5000 3690  radeonkmsfw_VERDE_ce.ko
38  1 0xffffffff81fe9000 3510  radeonkmsfw_VERDE_rlc.ko
39  1 0xffffffff81fed000 8e68  radeonkmsfw_VERDE_mc.ko
chris@odobenus ~ $
```


----------



## canadagolffan (Mar 23, 2015)

https://wiki.freebsd.org/Graphics

lists your card as just Partially supported, maybe the audio part is something that just doesnt work yet. 

(and just checking your `dmesg` and what not, the FreeBSD kernel isn't detecting the sound part of your video card by the looks of it)

Guess it pays off to have older hardware at this point. 

Good luck in getting it all working!


----------



## CrispyWalrus (Mar 23, 2015)

I did read "partially supported" as well on https://wiki.freebsd.org/Graphics , but it seemed more to do with the video acceleration and bus type than sound.  Mine is a PCI-Express not AGP, but yeah the notes on the partial support were:

Radeon video cards:
AGP cards not supported before FreeBSD 11-CURRENT
Features not yet working/implemented:
Hardware-assisted video decoding
Multiple cards sharing output connectors
Power management


The GALLIUM backed Software renderer works.
I do see an attempt to load the HDAC in my dmesg but it fails:

```
hdac0: <ATI (0xaab0) HDA Controller> mem 0xfea9c000-0xfea9ffff irq 19 at device 0.1 on pci1
hdac0: hdac_get_capabilities: Invalid corb size (0)
device_attach: hdac0 attach returned 6
```
I've no idea what a corb size is...


----------



## sidetone (Mar 27, 2015)

canadagolffan
That worked.
---
I thought it messed up my display settings, but that was the tv settings readjusting. Another thing that can be done, is just recompiling the modules without the kernel, by

`cd /usr/src/sys/modules/` or `cd /usr/src/sys/modules/drm2/`
`make clean; make; make install`

crispywalrus
Did you load the sound driver that Radeon and Intel hardware uses? snd_hda(4)


----------



## CrispyWalrus (Mar 27, 2015)

I had loaded snd_hda, which loads every sound driver under the sun.  Unfortunately the existing driver just didn't work.  I'd thought about recompiling with that flag you had found, or maybe grabbing the driver off the 11 builds; but I'd emailed one of the developers.  His response was: 

“Unfortunately, HDMI audio is not supported by the Radeon kernel driver yet. Our driver matches Linux 3.8 and we need to sync with Linux 3.13 IIRC to have stable HDMI audio. The same goes for audio over DisplayPort. The next update to the Radeon driver is planned for later this year; I hope this summer. This information was missing from the wiki, I updated it (see below the hardware matrix): https://wiki.freebsd.org/Graphics#Video_cards.”​I'd also been having issues with dropbox-- I figured that out but was a lot of hoop-jumping to get it to work on BSD.  I realized I'd spent a lot of time in the four days since I installed just trying to make what I needed work, and was work in itself... so I decided to bail on a BSD desktop and just installed Fedora 21 and it just worked... In four hours I'd passed that four days by and had everything working.  The downside is that even the "workstation" install came with apache and httpd loaded-- I've a lot of packages I don't need.  I like how clean FreeBSD is after install, but it just didn't do what I needed with the hardware I have.  I'll keep it on the server and Open on the fw, but for my desktop... well it's not there yet.


----------



## sidetone (Mar 27, 2015)

What ever works for you. It can become a task to get a FreeBSD system running how you want. I've left and came back, because I couldn't get BSD to do what I wanted to do then, and the set up took days.

I don't know if this applies, but I don't compile Radeon or DRM drivers into the kernel, because they don't seem to work that way. They do run loading them as modules. That link you showed, shows how to manually load them, but it is missing ''drm2'' which is automatically loaded along with "radeon_kms_" by my computer. It also says your card is partially supported. It might work, because all of the Radeon cards list audio as not implemented or supported, when what canadagolffan said for Radeon cards seems to work. There are lightweight console music players like audio/ximp3 that can be used to test it without a desktop.

I hope this is considered related to the thread, but it applies to Radeon:
In the KERNCONF 
	
	



```
device  agp
```
 must be enabled.


----------



## CrispyWalrus (Mar 28, 2015)

Hmm... I hadn't read that all of the Radeon cards list audio as not implemented or supported.  Mine was listed partially and after I emailed the guy on the team listed as responsible for kernel video drivers he had responded and updated the first note on their wiki to mention audio over hdmi/display ports is not working for mine and the others listed as partially working.


----------



## sidetone (Apr 2, 2015)

Now I get it. I tried a Radeon Pitcairn card, which is also listed as partially supported, that was sitting on my shelf. HDMI didn't work on it after starting xorg (DVI worked fine).

I went to /usr/src/sys/dev/drm2/radeon/ and did `less * | grep pitcairn; less * | grep PITCAIRN`, while it listed a lot, I didn't see any options to enable. Here are the combined outputs of pitcairn mentions in that directory; (nothing shows in another search for capital "P", lowercase "itcairn", in case anyone is wondering):

```
(rdev->family == CHIP_PITCAIRN))
   case CHIP_PITCAIRN:
   "PITCAIRN",
   CHIP_PITCAIRN,
   case CHIP_PITCAIRN:
   case CHIP_PITCAIRN:
     chip_name = "PITCAIRN";
     rlc_chip_name = "PITCAIRN";
    (rdev->family == CHIP_PITCAIRN)) {
   case CHIP_PITCAIRN:
---------------------------------
static const u32 pitcairn_io_mc_regs[TAHITI_IO_MC_REGS_SIZE][2] = {
     io_mc_regs = (u32 *)&pitcairn_io_mc_regs;
```
For my other card (Turks) that is listed as supported, the HDMI sound works with the "int radeon_audio" code above and recompiling the modules, even though it is listed as without audio ability.


----------



## mercurial (Apr 30, 2015)

I have ATI Radeon 5450 PCIe card. Following canadagolffan experience I'm happy to report HDMI audio works great.

```
cat /dev/sndstat (Yields this : root@beasty64:~ # cat /dev/sndstat
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play) default
pcm1: <VIA VT1708S_0 (Analog 7.1+HP/2.0)> (play/rec)
pcm2: <VIA VT1708S_0 (Rear-panel Digital)> (play)
pcm3: <VIA VT1708S_0 (Rear-panel Digital)> (play)
```

/usr/src/sys/dev/drm2/radeon/radeon_drv.c (change this line: int radeon_audio = 0; to int radeon_audio = 1;)
THEN REROLL KERNEL.


`cat ~/.profile > /dev/dsp` (May not be needed but I did it.)

`sysctl hw.snd.default_unit=0` (entered this at command line assuming it was pcm0: <ATI R6xx (HDMI)> (play) default) I was right.
Must copy THIS: hw.snd.default_unit=0 into /etc/sysctl.conf) http://dst.lbl.gov/ksblog/2012/05/freebsd-sound-setup-notes/
ASUS M4A78LT-M board, AMD Phenom II CPU, FreeBSD 10.1 64bit


----------



## sidetone (Jan 5, 2016)

Turning on HDMI audio is a problem for TV's that don't have autoscan. The picture resolution doesn't fit on the TV, and adjusting the TV resolution settings doesn't fix it. Autoscan works, provided the TV has that option. Does anyone know how to work around this on a TV that doesn't have the autoscan setting?

I'm wondering if it can be adjusted with an 
	
	



```
int
```
 setting in the /sys/dev/drm2/radeon/ directory.


----------



## sidetone (Jul 18, 2016)

To remove overscan (cropping off edges) for TV's that don't have the option, put 
	
	



```
xrandr --output HDMI-0 --set underscan on
```
 in your window manager config file.


```
xrandr --output HDMI-0 --set "underscan hborder" 10 --set "underscan vborder" 10
```
 can increase its borders.

*Update
Then this stopped working after updating my ports. Then had to use `xrandr --output HDMI-0 --auto` or some other resolution setting.


----------

