As we all know, sony have restricted access to the RSX chip for Linux. Recently, some very clever hackers were able to find a 'FIFO/push buffer' which would eventually lead to a fully functional 3d driver.
But there are problems with this. Firstly, a full driver would take years to complete, and secondly, Sony can very easily change something which would break these drivers (this recently happened with the 2.10 update)
There is another option. It's possible to use the SPUs in the cell to do colour conversion for us. This finally allows us to have mythtv running at a bearable speed, even in HD resolutions.
This how-to focuses on the second option, and is geared for people who desperately want to have their PS3s as mythtv-frontend boxes (like myself). However, the basics of this how-to should work with programs like mplayer, vlc, etc.
Note that this driver will not use the SPUs to actually decode the video, that's part of the spu-medialib and will require application support to work. All we are using the SPUs for is the colour conversion.
Note that this driver will not use the SPUs to actually decode the video, that's part of the spu-medialib and will require application support to work
This process is pretty straight forward. This guide will assume that you have already got a mythtv backend running somewhere on your network, and that you know how to add frontends to it.
If you have not installed a mythtv-frontend on your PS3 Ubuntu installation, then do so now. As some hints, I'd suggest doing a bare-bones install from the alternative ubuntu disc (type 'cli' at the inital boot prompt), and then install the ubuntu-mythtv-frontend package. This will bring in everything you need, including a bare-bones X installation, and will bring up the frontend automatically at boot. Simple.
I'm using Ubuntu Gutsy here. I doubt this will work with Feisty, but it should be okay with Hardy, once it's released.
Now that you have your mythtv frontend working on your PS3, you'll notice how bad the video playback is. This is easy to fix (but slightly involved).
Firstly, you need to create a file missing from the ubuntu packages:
Code:
# sudo nano -w /usr/lib/pkgconfig/libspe2.pc
In the editor which opens, copy and paste the following (it's best to login from a desktop PC so you can easily copy and paste this)
Code:
prefix=$(prefix)
exec_prefix=$(exec_prefix)
libdir=$(libdir)
includedir=$(includedir)
Name: libspe2
Description: A wrapper library to adapt the JSRE SPU usage model to SPUFS
Version: 2.2.0
Requires:
Conflicts:
Libs: -L${libdir} -lrt -lpthread
Cflags: -I${includedir}
Use Ctrl+X to exit, Press Y and then Enter to save the file.
This block you can just do line by line:
Code:
# sudo apt-get install libtool build-essential libspe2-dev automake xorg-dev subversion
# wget http://linux.yes.nu/PS3Ubuntu/files/spu-medialib_0.1git20071126-1_powerpc.deb
# sudo dpkg -i spu-medialib_0.1git20071126-1_powerpc.deb
# svn co svn://svn.ps2dev.org/ps3ware/trunk/xf86-video-spu
# cd xf86-video-spu
# autoreconf -if && ./configure --prefix /usr && make
# sudo make install
# cd ~
The first apt-get command will bring in a lot of packages. Don't panic, they are small and won't get in the way of anything. The rest fetches a dependency not available in the standard ubuntu repositories and then compiles the driver.
After the driver has built, you'll need to edit your xorg.conf:
Code:
sudo nano -w /etc/X11/xorg.conf
Change your device section to look like this:
Code:
Section "Device"
Identifier "Generic Video Card"
Driver "spu_fbdev"
Option "ShadowFB" "false"
EndSection
The ShadowFB option is
requiredAdd this to the end:
Code:
Section "Module"
# Load "dbe"
Load "extmod"
# Load "glx"
# Load "record"
Load "freetype"
Load "type1"
# Load "dri"
EndSection
For reference, my entire xorg.conf looks like this:
Code:
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "gb"
Option "XkbOptions" "lv3:ralt_switch"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "spu_fbdev"
Option "ShadowFB" "false"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
Option "DPMS"
HorizSync 30-70
VertRefresh 50-160
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 24
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "Module"
# Load "dbe"
Load "extmod"
# Load "glx"
# Load "record"
Load "freetype"
Load "type1"
# Load "dri"
EndSection
Restart X:
Code:
sudo /etc/init.d/gdm restart
Fingers crossed, you should now have really nice playback with mythtv.
As I had to 'work backwards' with this (as in, try to figure out what a base install would need), I may have missed packages in the first apt-get line. Let me know if I missed anything.
Ideally, a package would make this process even easier. As I really don't know what I'm doing when it comes to these things, I cannot provide one. If anyone is willing, it would make this process even easier.
CPU usage with the new driver is as follows:
Code:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3899 mythtv 15 0 205m 80m 39m S 34 37.6 26:54.54 mythfrontend.re
This is with a SD recording, but playing on a HD TV at HD resolutions. I don't have any HD sources yet, if anyone is willing to test, I'd love to hear back from you.
You should be aware that this driver is not finished. There are bugs, some of them are down-right nasty. I strongly suggest you have openssh-server installed on your PS3 so you can log into it to issue 'killall -9 Xorg' it if needed. I find that sometimes the driver crashes the display. You can't even use the keyboard when this happens and the only way to fix it is to login from another computer and issue that command.
You may find that the sound seems to work okay, but the graphics are garbage. If this happens, exit mythtv, restart X, and then fire-up mythtv again. The frontend package I mentioned earlier will do this automatically when you quit mythtv.