Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added Makefile rule for spu programs. Added Readme.

  • Loading branch information
martinlowinski committed Aug 10, 2009
1 parent 730f979 commit 0bc06b1c75f078304f71b2feed2452e0f6673938
Showing with 88 additions and 56 deletions.
  1. +3 −0 Makefile.in
  2. +35 −0 README.PS3
  3. +1 −0 configure.in
  4. +49 −56 src/video/ps3/spulibs/Makefile
@@ -40,6 +40,9 @@ SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@

# SPU programs
include $(srcdir)/src/video/ps3/spulibs/Makefile

DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode

HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
@@ -0,0 +1,35 @@

SDL on Sony Playstation3
------------------------

Installation:
First, you have to install the Cell SDK
- Download the Cell SDK installer RPM and ISO images to
a temporary directory such as /tmp/cellsdk.
- Mount the image: mount -o loop CellSDK-Devel-Fedora_3.1.0.0.0.iso /tmp/cellsdk
- Install the SDK installer: rpm -ivh cell-install-3.1.0-0.0.noarch.rpm
- Install the SDK: cd /opt/cell && ./cellsdk --iso /tmp/cellsdkiso install

You'll than need to install the SPU-libs
- Run make ps3-libs && make ps3libs-install

Finally, install SDL
- Go to SDL-1.2/ and build SDL like any other GNU style package.
e.g.
- Build the configure-script with ./autogen.sh
- Configure SDL for your needs: ./configure --enable-video-ps3 ...
- Build and install it: make && make install


Todo:
- Mouse & Keyboard support
- On SPU-side the current scaler and converter restrictions are:
- resolution has to be a multiple of 8 (will work on that)
- scaler/converter only supports the YV12 and IYUV format
- the scaler works only bilinear (lanzos would be nice)
- Optimize the SPU-program handling on the PPE side
- Integrate spumedia in SDL

Have fun!
Dirk Herrendoerfer <d.herrendoerfer [at] de [dot ibm [dot] com>

@@ -1523,6 +1523,7 @@ CheckPS3()
SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
echo "*** Before building SDL please run make ps3libs"
have_video=yes
fi
fi
@@ -3,81 +3,74 @@

# Toolchain
SPU_GCC=/usr/bin/spu-gcc
PPU_GCC=/usr/bin/gcc
PPU_EMBEDSPU=/usr/bin/embedspu
PPU_AR=/usr/bin/ar
PPU_LD=/usr/bin/ld
INSTALL=/usr/bin/install

SPU_SRCDIR=$(srcdir)/src/video/ps3/spulibs
SPU_LIBDIR=$(srcdir)/src/video/ps3/spulibs/libs
SPU_CFLAGS=-g -W -Wall -Winline -Wno-main -I. -I /usr/spu/include -I /opt/cell/sdk/usr/spu/include -finline-limit=10000 -Winline -ftree-vectorize -funroll-loops -fmodulo-sched -ffast-math -fPIC -O2

# Usually /usr/lib, depending on your distribution
PREFIX=/usr/lib


all: libfb_writer_spu.a libfb_writer_spu.so \
libyuv2rgb_spu.so libyuv2rgb_spu.a \
libbilin_scaler_spu.so libbilin_scaler_spu.a

ps3libs: $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/libfb_writer_spu.so \
$(SPU_LIBDIR)/libyuv2rgb_spu.so $(SPU_LIBDIR)/libyuv2rgb_spu.a \
$(SPU_LIBDIR)/libbilin_scaler_spu.so $(SPU_LIBDIR)/libbilin_scaler_spu.a

# fb_writer
fb_writer_spu-embed.o: fb_writer.c spu_common.h
$(SPU_GCC) $(SPU_CFLAGS) -o fb_writer_spu fb_writer.c -lm
$(PPU_EMBEDSPU) -m32 fb_writer_spu fb_writer_spu fb_writer_spu-embed.o
$(SPU_LIBDIR):
$(SHELL) $(auxdir)/mkinstalldirs $(SPU_LIBDIR)

libfb_writer_spu.so: fb_writer_spu-embed.o
$(PPU_LD) -o libfb_writer_spu.so -shared -soname=libfb_writer_spu.so fb_writer_spu-embed.o
# fb_writer (basically copying from a to b)
$(SPU_LIBDIR)/fb_writer_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/fb_writer.c $(SPU_SRCDIR)/spu_common.h
$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/fb_writer_spu $(SPU_SRCDIR)/fb_writer.c -lm
$(PPU_EMBEDSPU) -m32 fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu-embed.o

libfb_writer_spu.a: fb_writer_spu-embed.o
$(PPU_AR) -qcs libfb_writer_spu.a fb_writer_spu-embed.o
$(SPU_LIBDIR)/libfb_writer_spu.a: $(SPU_LIBDIR)/fb_writer_spu-embed.o
$(PPU_AR) -qcs $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/fb_writer_spu-embed.o

$(SPU_LIBDIR)/libfb_writer_spu.so: $(SPU_LIBDIR)/fb_writer_spu-embed.o
$(PPU_LD) -o $(SPU_LIBDIR)/libfb_writer_spu.so -shared -soname=libfb_writer_spu.so $(SPU_LIBDIR)/fb_writer_spu-embed.o

# yuv2rgb_converter
yuv2rgb_spu-embed.o: yuv2rgb_converter.c spu_common.h
$(SPU_GCC) $(SPU_CFLAGS) -o yuv2rgb_spu yuv2rgb_converter.c -lm
$(PPU_EMBEDSPU) -m32 yuv2rgb_spu yuv2rgb_spu yuv2rgb_spu-embed.o

libyuv2rgb_spu.a: yuv2rgb_spu-embed.o
$(PPU_AR) -qcs libyuv2rgb_spu.a yuv2rgb_spu-embed.o
# yuv2rgb_converter (converting YV12/IYUV to RGB)
$(SPU_LIBDIR)/yuv2rgb_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/yuv2rgb_converter.c $(SPU_SRCDIR)/spu_common.h
$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_SRCDIR)/yuv2rgb_converter.c -lm
$(PPU_EMBEDSPU) -m32 yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu-embed.o

libyuv2rgb_spu.so: yuv2rgb_spu-embed.o
$(PPU_LD) -o libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so yuv2rgb_spu-embed.o
$(SPU_LIBDIR)/libyuv2rgb_spu.a: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
$(PPU_AR) -qcs $(SPU_LIBDIR)/libyuv2rgb_spu.a $(SPU_LIBDIR)/yuv2rgb_spu-embed.o

$(SPU_LIBDIR)/libyuv2rgb_spu.so: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
$(PPU_LD) -o $(SPU_LIBDIR)/libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so $(SPU_LIBDIR)/yuv2rgb_spu-embed.o

# bilin_scaler
bilin_scaler_spu-embed.o: bilin_scaler.c spu_common.h
$(SPU_GCC) $(SPU_CFLAGS) -o bilin_scaler_spu bilin_scaler.c -lm
$(PPU_EMBEDSPU) -m32 bilin_scaler_spu bilin_scaler_spu bilin_scaler_spu-embed.o

libbilin_scaler_spu.a: bilin_scaler_spu-embed.o
$(PPU_AR) -qcs libbilin_scaler_spu.a bilin_scaler_spu-embed.o
# bilin_scaler (scaling bilinear YV12/IYUV pictures with resolutions /16)
$(SPU_LIBDIR)/bilin_scaler_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/bilin_scaler.c $(SPU_SRCDIR)/spu_common.h
$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_SRCDIR)/bilin_scaler.c -lm
$(PPU_EMBEDSPU) -m32 bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu-embed.o

libbilin_scaler_spu.so: bilin_scaler_spu-embed.o
$(PPU_LD) -o libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so bilin_scaler_spu-embed.o
$(SPU_LIBDIR)/libbilin_scaler_spu.a: $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
$(PPU_AR) -qcs $(SPU_LIBDIR)/libbilin_scaler_spu.a $(SPU_LIBDIR)/bilin_scaler_spu-embed.o

install: libfb_writer_spu.a libfb_writer_spu.so \
libyuv2rgb_spu.so libyuv2rgb_spu.a \
libbilin_scaler_spu.so libbilin_scaler_spu.a
$(INSTALL) -c -m 0755 libfb_writer_spu.so $(PREFIX)/.
$(INSTALL) -c -m 0655 libfb_writer_spu.a $(PREFIX)/.
$(INSTALL) -c -m 0755 libyuv2rgb_spu.so $(PREFIX)/.
$(INSTALL) -c -m 0655 libyuv2rgb_spu.a $(PREFIX)/.
$(INSTALL) -c -m 0755 libbilin_scaler_spu.so $(PREFIX)/.
$(INSTALL) -c -m 0655 libbilin_scaler_spu.a $(PREFIX)/.
$(SPU_LIBDIR)/libbilin_scaler_spu.so: $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
$(PPU_LD) -o $(SPU_LIBDIR)/libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so $(SPU_LIBDIR)/bilin_scaler_spu-embed.o


uninstall: $(PREFIX)/libfb_writer_spu.so $(PREFIX)/libfb_writer_spu.a \
$(PREFIX)/libyuv2rgb_spu.so $(PREFIX)/libyuv2rgb_spu.a \
$(PREFIX)/libbilin_scaler_spu.so $(PREFIX)/libbilin_scaler_spu.a
rm -f $(PREFIX)/libfb_writer_spu.a
rm -f $(PREFIX)/libfb_writer_spu.so
rm -f $(PREFIX)/libyuv2rgb_spu.so
rm -f $(PREFIX)/libyuv2rgb_spu.a
rm -f $(PREFIX)/libbilin_scaler_spu.so
rm -f $(PREFIX)/libbilin_scaler_spu.a
ps3libs-install: $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/libfb_writer_spu.so \
$(SPU_LIBDIR)/libyuv2rgb_spu.so $(SPU_LIBDIR)/libyuv2rgb_spu.a \
$(SPU_LIBDIR)/libbilin_scaler_spu.so $(SPU_LIBDIR)/libbilin_scaler_spu.a
$(INSTALL) -c -m 0755 $(SPU_LIBDIR)/libfb_writer_spu.so $(DESTDIR)$(libdir)/.
$(INSTALL) -c -m 0655 $(SPU_LIBDIR)/libfb_writer_spu.a $(DESTDIR)$(libdir)/.
$(INSTALL) -c -m 0755 $(SPU_LIBDIR)/libyuv2rgb_spu.so $(DESTDIR)$(libdir)/.
$(INSTALL) -c -m 0655 $(SPU_LIBDIR)/libyuv2rgb_spu.a $(DESTDIR)$(libdir)/.
$(INSTALL) -c -m 0755 $(SPU_LIBDIR)/libbilin_scaler_spu.so $(DESTDIR)$(libdir)/.
$(INSTALL) -c -m 0655 $(SPU_LIBDIR)/libbilin_scaler_spu.a $(DESTDIR)$(libdir)/.

ps3libs-uninstall:
rm -f $(DESTDIR)$(libdir)/libfb_writer_spu.a
rm -f $(DESTDIR)$(libdir)/libfb_writer_spu.so
rm -f $(DESTDIR)$(libdir)/libyuv2rgb_spu.so
rm -f $(DESTDIR)$(libdir)/libyuv2rgb_spu.a
rm -f $(DESTDIR)$(libdir)/libbilin_scaler_spu.so
rm -f $(DESTDIR)$(libdir)/libbilin_scaler_spu.a

clean:
rm -f bilin_scaler_spu-embed.o libbilin_scaler_spu.so libbilin_scaler_spu.a bilin_scaler_spu
rm -f yuv2rgb_spu-embed.o libyuv2rgb_spu.so libyuv2rgb_spu.a yuv2rgb_spu
rm -f fb_writer_spu-embed.o libfb_writer_spu.so libfb_writer_spu.a fb_writer_spu
ps3libs-clean:
rm -f $(SPU_LIBDIR)/*

0 comments on commit 0bc06b1

Please sign in to comment.