changeset 3154:95e48f7a3a93 gsoc2009_ps3

Added Makefile rule for spu programs. Added Readme.
author Martin Lowinski <martin@goldtopf.org>
date Mon, 10 Aug 2009 18:05:33 +0000
parents a16c4ec43631
children abc49915ccb2
files Makefile.in README.PS3 configure.in src/video/ps3/spulibs/Makefile
diffstat 4 files changed, 92 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Mon Aug 10 13:28:58 2009 +0000
+++ b/Makefile.in	Mon Aug 10 18:05:33 2009 +0000
@@ -40,6 +40,9 @@
 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.PS3	Mon Aug 10 18:05:33 2009 +0000
@@ -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>
+
--- a/configure.in	Mon Aug 10 13:28:58 2009 +0000
+++ b/configure.in	Mon Aug 10 18:05:33 2009 +0000
@@ -1523,6 +1523,7 @@
       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
--- a/src/video/ps3/spulibs/Makefile	Mon Aug 10 13:28:58 2009 +0000
+++ b/src/video/ps3/spulibs/Makefile	Mon Aug 10 18:05:33 2009 +0000
@@ -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
-
 
-# 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
+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
 
-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
-
-libfb_writer_spu.a: fb_writer_spu-embed.o
-	$(PPU_AR) -qcs libfb_writer_spu.a fb_writer_spu-embed.o
+$(SPU_LIBDIR):
+	$(SHELL) $(auxdir)/mkinstalldirs $(SPU_LIBDIR)
 
-
-# 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
+# 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
 
-libyuv2rgb_spu.a: yuv2rgb_spu-embed.o
-	$(PPU_AR) -qcs libyuv2rgb_spu.a yuv2rgb_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
 
-libyuv2rgb_spu.so: yuv2rgb_spu-embed.o
-	$(PPU_LD) -o libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so yuv2rgb_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
 
 
-# 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
+# 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
 
-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)/libyuv2rgb_spu.a: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
+	$(PPU_AR) -qcs $(SPU_LIBDIR)/libyuv2rgb_spu.a $(SPU_LIBDIR)/yuv2rgb_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)/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
 
 
-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
+# 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
+
+$(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
+
+$(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
 
 
-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-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
+
+ps3libs-clean:
+	rm -f $(SPU_LIBDIR)/*