HTPC: FreeBSD for your TV

System setup

by ross at 13:29:54 on November 7, 2012

X Window Sytem

Install X as usual (skip Qt part of the „Toolkits“ page as you won't need Qt here).

If you need an example here's mine xorg.conf — nothing special here as everything was autodetected properly (HDMI is used).

If you need to use tv-out then here is the xorg.conf I wrote back when I was using tv-out. There are many comments there to show you the possible options.

One thing I should note: this LG TV was autodetected as having 300x300 dpi resolution (so fonts in GTK programs are large enough when you are 3-5 metres away from the TV).

If your TV was autodetected as having low dpi you can force whatever resolution you need by adding this to Device section of xorg.conf:

Option      "UseEdidDpi" "FALSE"
Option      "DPI" "300 x 300"

Sound setup

Determine the driver first (load all of them):

# kldload snd_driver

# cat /dev/sndstat                                                                              [7:33:21]
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386)
Installed devices:
pcm0: <HDA Realtek ALC662 PCM #0 Analog> (play/rec) default
pcm1: <HDA Realtek ALC662 PCM #1 Digital> (play)
pcm2: <HDA NVidia GT21x HDMI PCM #0 DisplayPort> (play)
pcm3: <HDA NVidia GT21x HDMI PCM #0 DisplayPort> (play)
pcm4: <HDA NVidia GT21x HDMI PCM #0 DisplayPort> (play)
pcm5: <HDA NVidia GT21x HDMI PCM #0 DisplayPort> (play)

As you can see the driver that worked is HDA. Add to /boot/loader.conf:

snd_hda_load="YES"

This system have two audio output options: pcm0-1 are motherboard sound channels and pcm1-5 are HDMI channels.

Just use motherboard sound if you connect to the TV via tv-out (no additional setup is needed usually) or switch the sound output to video card if you use HDMI.

HDMI sound output

To test the sound install a simple wav-player and download the test signal:

# cd /usr/ports/audio/waveplay
# make install clean

# rehash
# cd
# fetch http://daemon-notes.com/downloads/assets/misc/test.wav

Now switch to the first HDMI channel (pcm2) and play the sound:

# sysctl hw.snd.default_unit=2
# waveplay ~/test.wav

If you hear nothing switch to the next HDMI channel (hw.snd.default_unit=3) and play the file again. In the case with this GT210 pcm3 was the one that worked.

Add to /etc/sysctl.conf the correct call to enable HDMI sound:

hw.snd.default_unit=3

If sound still doesn't work

GT210 needed a hack to get it working. If you have the same card or get "play interrupt timeout, channel dead" error then have a look at Appendix A.

 

Comments