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

Merged Martin's code changes from Google Summer of Code 2009

  • Loading branch information
slouken committed Sep 7, 2009
1 parent 1d2f8bb commit a5ed89ba1866b0bb8f9ff6e17d6986c629ff3049
@@ -40,6 +40,11 @@ SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@

# PS3 SPU programs
SPU_GCC = @SPU_GCC@
EMBEDSPU = @EMBEDSPU@
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_atomic.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_power.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>

@@ -1509,6 +1509,46 @@ AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[defa
fi
}

dnl See if we're running on PlayStation 3 Cell hardware
CheckPS3()
{
AC_ARG_ENABLE(video-ps3,
AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
, enable_video_ps3=yes)
if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then
video_ps3=no
AC_CHECK_HEADER([linux/fb.h])
AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
[#ifndef _LINUX_TYPES_H
#include <linux/types.h>
#endif])
AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)

AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
AC_CHECK_PROGS(EMBEDSPU, [embedspu])

have_spu_libs=yes
AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
if test x$have_ps3fb_hdr = xyes -a x$have_libspe2_hdr = xyes -a x$have_spe2_lib = xyes -a "$SPU_GCC" -a "$EMBEDSPU"; then
AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
video_ps3=yes
have_video=yes
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"

if test x$have_spu_libs = xno; then
AC_MSG_WARN([ps3libs missing, please run make ps3libs])
fi
fi
AC_MSG_CHECKING([for PlayStation 3 Cell support])
AC_MSG_RESULT([$video_ps3])
fi
}

dnl Find the SVGAlib includes and libraries
CheckSVGA()
{
@@ -2401,6 +2441,7 @@ case "$host" in
CheckDirectFB
CheckFusionSound
CheckPS2GS
CheckPS3
CheckSVGA
CheckVGL
CheckWscons
@@ -273,6 +273,7 @@
#undef SDL_VIDEO_DRIVER_PHOTON
#undef SDL_VIDEO_DRIVER_QNXGF
#undef SDL_VIDEO_DRIVER_PS2GS
#undef SDL_VIDEO_DRIVER_PS3
#undef SDL_VIDEO_DRIVER_RISCOS
#undef SDL_VIDEO_DRIVER_SVGALIB
#undef SDL_VIDEO_DRIVER_VGL
@@ -359,6 +359,9 @@ extern VideoBootStrap DirectFB_bootstrap;
#if SDL_VIDEO_DRIVER_PS2GS
extern VideoBootStrap PS2GS_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_PS3
extern VideoBootStrap PS3_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_VGL
extern VideoBootStrap VGL_bootstrap;
#endif
@@ -73,6 +73,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_PS2GS
&PS2GS_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_PS3
&PS3_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_VGL
&VGL_bootstrap,
#endif
@@ -88,32 +88,6 @@
#include "SDL_yuv_sw_c.h"


struct SDL_SW_YUVTexture
{
Uint32 format;
Uint32 target_format;
int w, h;
Uint8 *pixels;
int *colortab;
Uint32 *rgb_2_pix;
void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
unsigned char *lum, unsigned char *cr,
unsigned char *cb, unsigned char *out,
int rows, int cols, int mod);
void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
unsigned char *lum, unsigned char *cr,
unsigned char *cb, unsigned char *out,
int rows, int cols, int mod);

/* These are just so we don't have to allocate them separately */
Uint16 pitches[3];
Uint8 *planes[3];

/* This is a temporary surface in case we have to stretch copy */
SDL_Surface *stretch;
SDL_Surface *display;
};

/* The colorspace conversion functions */

#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES
@@ -26,6 +26,32 @@

/* This is the software implementation of the YUV texture support */

struct SDL_SW_YUVTexture
{
Uint32 format;
Uint32 target_format;
int w, h;
Uint8 *pixels;
int *colortab;
Uint32 *rgb_2_pix;
void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
unsigned char *lum, unsigned char *cr,
unsigned char *cb, unsigned char *out,
int rows, int cols, int mod);
void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
unsigned char *lum, unsigned char *cr,
unsigned char *cb, unsigned char *out,
int rows, int cols, int mod);

/* These are just so we don't have to allocate them separately */
Uint16 pitches[3];
Uint8 *planes[3];

/* This is a temporary surface in case we have to stretch copy */
SDL_Surface *stretch;
SDL_Surface *display;
};

typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;

SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h);
@@ -0,0 +1,36 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"

#include "../../events/SDL_sysevents.h"
#include "../../events/SDL_events_c.h"

#include "SDL_ps3video.h"
#include "SDL_ps3events_c.h"

void
PS3_PumpEvents(_THIS)
{
/* do nothing. */
}

/* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,28 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"

#include "SDL_ps3video.h"

extern void PS3_PumpEvents(_THIS);

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit a5ed89b

Please sign in to comment.