MythTV on Playstation3

From MythTV Official Wiki
Revision as of 18:50, 17 May 2007 by Mark kendall (talk | contribs) (Added config file for Sixaxis/PS3 joystick input)

Jump to: navigation, search

Ps3.png This will be a hub to gather all info around using MythTV on the Playstation 3.

Current status

MythTV is running under YellowDogLinux with packages from atrpm. The problem: As others reported before: playback is choppy because XVideo is not available and MythTV falls back to XSHM for playback.

I have installed Gentoo on my PS3 to start experimenting with DirectFB. DirectFB 1.0.0 compiled cleanly. I rebuilt SDL with directfb-support, and compiled mplayer with directfb support.
Unfortunately, mplayer does not work with directfb or sdl, it always crashes at some point. I still need to figure out why. Though the test-program DFBPoint does work nicely. When run with --dfb:mode=1280x720 it entered fullscreen nicely, but some of the slide-animations where a little bit sloppy. I wonder if Mythtv would run smooth via directfb if there is no hardware acceleration.

I have now successfully emerged qt-embedded. After that I checked out the mythtv-vid branch and compiled it successfully. It even starts fine in fullscreen mode (1280x720), the menu is shown, keyboard works. Unfortunatly the mythtv-vid branch contains some changes from upstream and this made the mythfrontend incompatible with my backend running on my server (My Server has protocol 31, the mythtv-vid-branch currently 33) so i could not check how video-playback would run. However I made some tests with mplayer: When I just call it without parameters (no -vo=directfb) it works through sdl and that uses fbcon. It even scales to full 720p. However playback of HD-material is very choppy and not fluid at all. SD-material runs nearly smooth. Then I started the X server and used mplayer with the X11 driver. SD-material and material slightly over SD runs very smooth and great. Sadly the X11 driver cannot scale to fullscreen, which is very odd. HD-material (720p) runs better than under the console, but not even near the full framerate. Interestingly i heard of people running mplayer with Full-HD videos (1080p) under X and they said it was smooth as silk.

Playstation3 hardware issues

There are 2 major issues that need to be addressed when running Linux/mythtv on the PS3:

  • Memory

There is only around 200Mb of memory available for Linux to work with. As a result, Mythtv can be slow to start up and switch between menu pages as theme detail is swapped from the harddisk to main memory. Running Mythtv at 1080 can be painfully slow.

The main way of reducing memory consumption is to run Mythtv without the overhead of X11, window managers etc. This can be achieved by installing qt-embedded and building Mythtv to use it instead of the default qt.

  • Displaying video

Sony have restricted any direct access to the video hardware. All rendering is via a memory backed framebuffer and all colour conversion, scaling etc for video playback must be done in software. Mythtv will happily play standard definition video but will skip a lot of frames due to this conversion overhead.

To improve performance we need to use the six additional processors (SPUs) that are available on the PS3. By offloading the heavy work of colour conversion and scaling, we can leave the main processor (PPU) to concentrate on video decoding, sound, osd, event handling etc.

Other less critical issues:

  • No serial ports

Serial lirc interfaces will not work on the PS3. Either use a keyboard (wireless or wired) or a usb lirc receiver.

Alternatively, the sixaxis wireless controller should work with a more recent or patched kernel and a custom joystick config file. See (wireless) and (wired).

Development status/TODO

  • qt embedded

qt embedded compiled and installed. Need to compile with Mythtv.

  • DirectFB

Mythtv video playback does not currently work with DirectFB on the PS3. As far as I can tell, DirectFB really needs a new driver to deal with the specifics of the PS3 framebuffer. (Note: playback fails because there is no video layer available from directfb). Given the unique combination of the ps3 framebuffer and the 6 SPUs available, I'm focusing on a mythtv video method for the ps3 (see below)

  • Sixaxis controller

Need to compile a patched kernel to test sixaxis input in wireless mode.

YellowdogLinux 5.0 supports the sixaxis 'out of the box' in usb mode. See below for an example joystick config file.

  • Video display

I've written a new video output method for mythtv on the PS3. This takes control of the framebuffer directly and coordinates vertical synchronisation, buffer flipping etc. It also offloads all colour conversion and video scaling to one or more SPU's.

Colour conversion on SPUs.
vertical sync
xrandr support (PS3 has a very clear set of supported display modes)
osd blending
full size osd

  • Exit option - Boot GameOS

Done - added an extra (configurable) option to the exit menu that boots into the Sony game OS.

Sixaxis controller config file for use with Mythfrontend

This should work on a default YellowdogLinux 5.0 install.

# Joystick menu config file for mythtv using Sixaxis controller
#  Place in ~/.mythtv/

# N.B. Not all buttons and axis have been implemented

devicename /dev/js0

# select
button 0                    Enter
# L3
button 1                    Enter
# R3
button 2                    Enter
# Start
button 3                    Enter 
# Dpad Up
button 4                    Up
# Dpad right
button 5                    Right
# Dpad down
button 6                    Down
# Dpad left
button 7                    Left

# triangle
button 12                   M
# Circle
button 13                   Escape
# Cross
button 14                   Enter
# Square
button 15                   I
# PS Button
button 16                   Enter

# left thumb
axis   0    -32767  -15000  Left
axis   0     15000   32767  Right
axis   1    -32767  -15000  Up
axis   1     15000   32767  Down

# right thumb
axis   2    -32767  -15000  Left
axis   2     15000   32767  Right
axis   3    -32767  -15000  Up
axis   3     15000   32767  Down

Information found on the web

For now I found the following interesting bits of information regarding MythTV on the ps3:

Framebuffer related

General bits of information

Whats next?

Since I don't want to go SVN in my mythtv-network (one server, 2-3 frontends) i am stuck a little bit because I cannot try the frontend i compilde. Does anyone have an Idea on how to build a second mythbackend server with a newer version on the same machine as the real server and run them simultanously? Or could i run one in a virtual machine? But from where would i get some recordings to test video-playback then? Any Ideas?

Until I have a solution to the above problem, consider this project on halt.

Anyway I will probably test a little bit more with mplayer and see how i may optimize playback. Perhaps there are some workarounds to at least play back recordings in an easy and comfortable way. (UPnP and djmount come to mind)

I will report back when there is progress...