Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
c4d74517
Commit
c4d74517
authored
Jan 20, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PS3 Linux is no more...
parent
008911fd
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
0 additions
and
4725 deletions
+0
-4725
Makefile.in
Makefile.in
+0
-5
README.PS3
README.PS3
+0
-35
configure.in
configure.in
+0
-41
SDL_config.h.in
include/SDL_config.h.in
+0
-1
SDL_sysvideo.h
src/video/SDL_sysvideo.h
+0
-3
SDL_video.c
src/video/SDL_video.c
+0
-3
SDL_ps3events.c
src/video/ps3/SDL_ps3events.c
+0
-36
SDL_ps3events_c.h
src/video/ps3/SDL_ps3events_c.h
+0
-28
SDL_ps3modes.c
src/video/ps3/SDL_ps3modes.c
+0
-143
SDL_ps3modes_c.h
src/video/ps3/SDL_ps3modes_c.h
+0
-34
SDL_ps3render.c
src/video/ps3/SDL_ps3render.c
+0
-747
SDL_ps3render_c.h
src/video/ps3/SDL_ps3render_c.h
+0
-29
SDL_ps3spe.c
src/video/ps3/SDL_ps3spe.c
+0
-166
SDL_ps3spe_c.h
src/video/ps3/SDL_ps3spe_c.h
+0
-87
SDL_ps3video.c
src/video/ps3/SDL_ps3video.c
+0
-228
SDL_ps3video.h
src/video/ps3/SDL_ps3video.h
+0
-79
Makefile
src/video/ps3/spulibs/Makefile
+0
-47
bilin_scaler.c
src/video/ps3/spulibs/bilin_scaler.c
+0
-2050
fb_writer.c
src/video/ps3/spulibs/fb_writer.c
+0
-193
spu_common.h
src/video/ps3/spulibs/spu_common.h
+0
-108
yuv2rgb.c
src/video/ps3/spulibs/yuv2rgb.c
+0
-662
No files found.
Makefile.in
View file @
c4d74517
...
...
@@ -37,11 +37,6 @@ VERSION_OBJECTS = @VERSION_OBJECTS@
SDLMAIN_TARGET
=
libSDLmain.a
SDLMAIN_OBJECTS
=
@SDLMAIN_OBJECTS@
# PS3 SPU programs
SPU_GCC
=
@SPU_GCC@
EMBEDSPU
=
@EMBEDSPU@
#include $(srcdir)/src/video/ps3/spulibs/Makefile
DIST
=
acinclude Android.mk autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README
*
sdl-config.in sdl.m4 sdl.pc.in SDL.spec SDL.spec.in src
test
TODO VisualC.html VisualC VisualCE Watcom-Win32.zip WhatsNew Xcode Xcode-iPhoneOS
HDRS
=
\
...
...
README.PS3
deleted
100644 → 0
View file @
008911fd
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>
configure.in
View file @
c4d74517
...
...
@@ -1546,46 +1546,6 @@ AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audi
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 rcg04172001 Set up the Null video driver.
CheckDummyVideo()
{
...
...
@@ -2245,7 +2205,6 @@ case "$host" in
CheckX11
CheckDirectFB
CheckFusionSound
CheckPS3
CheckOpenGLX11
CheckInputEvents
CheckTslib
...
...
include/SDL_config.h.in
View file @
c4d74517
...
...
@@ -264,7 +264,6 @@
#undef SDL_VIDEO_DRIVER_NDS
#undef SDL_VIDEO_DRIVER_PHOTON
#undef SDL_VIDEO_DRIVER_QNXGF
#undef SDL_VIDEO_DRIVER_PS3
#undef SDL_VIDEO_DRIVER_RISCOS
#undef SDL_VIDEO_DRIVER_WIN32
#undef SDL_VIDEO_DRIVER_X11
...
...
src/video/SDL_sysvideo.h
View file @
c4d74517
...
...
@@ -411,9 +411,6 @@ extern VideoBootStrap X11_bootstrap;
#if SDL_VIDEO_DRIVER_DIRECTFB
extern
VideoBootStrap
DirectFB_bootstrap
;
#endif
#if SDL_VIDEO_DRIVER_PS3
extern
VideoBootStrap
PS3_bootstrap
;
#endif
#if SDL_VIDEO_DRIVER_WIN32
extern
VideoBootStrap
WIN32_bootstrap
;
#endif
...
...
src/video/SDL_video.c
View file @
c4d74517
...
...
@@ -65,9 +65,6 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_DIRECTFB
&
DirectFB_bootstrap
,
#endif
#if SDL_VIDEO_DRIVER_PS3
&
PS3_bootstrap
,
#endif
#if SDL_VIDEO_DRIVER_WIN32
&
WIN32_bootstrap
,
#endif
...
...
src/video/ps3/SDL_ps3events.c
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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: */
src/video/ps3/SDL_ps3events_c.h
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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: */
src/video/ps3/SDL_ps3modes.c
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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"
void
PS3_InitModes
(
_THIS
)
{
deprintf
(
1
,
"+PS3_InitModes()
\n
"
);
SDL_VideoDisplay
display
;
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
SDL_DisplayMode
mode
;
PS3_DisplayModeData
*
modedata
;
unsigned
long
vid
=
0
;
modedata
=
(
PS3_DisplayModeData
*
)
SDL_malloc
(
sizeof
(
*
modedata
));
if
(
!
modedata
)
{
return
;
}
/* Setting up the DisplayMode based on current settings */
struct
ps3fb_ioctl_res
res
;
if
(
ioctl
(
data
->
fbdev
,
PS3FB_IOCTL_SCREENINFO
,
&
res
))
{
SDL_SetError
(
"Can't get PS3FB_IOCTL_SCREENINFO"
);
}
mode
.
format
=
SDL_PIXELFORMAT_RGB888
;
mode
.
refresh_rate
=
0
;
mode
.
w
=
res
.
xres
;
mode
.
h
=
res
.
yres
;
/* Setting up driver specific mode data,
* Get the current ps3 specific videmode number */
if
(
ioctl
(
data
->
fbdev
,
PS3FB_IOCTL_GETMODE
,
(
unsigned
long
)
&
vid
))
{
SDL_SetError
(
"Can't get PS3FB_IOCTL_GETMODE"
);
}
deprintf
(
2
,
"PS3FB_IOCTL_GETMODE = %u
\n
"
,
vid
);
modedata
->
mode
=
vid
;
mode
.
driverdata
=
modedata
;
/* Set display's videomode and add it */
SDL_zero
(
display
);
display
.
desktop_mode
=
mode
;
display
.
current_mode
=
mode
;
SDL_AddVideoDisplay
(
&
display
);
deprintf
(
1
,
"-PS3_InitModes()
\n
"
);
}
/* DisplayModes available on the PS3 */
static
SDL_DisplayMode
ps3fb_modedb
[]
=
{
/* VESA */
{
SDL_PIXELFORMAT_RGB888
,
1280
,
768
,
0
,
NULL
},
// WXGA
{
SDL_PIXELFORMAT_RGB888
,
1280
,
1024
,
0
,
NULL
},
// SXGA
{
SDL_PIXELFORMAT_RGB888
,
1920
,
1200
,
0
,
NULL
},
// WUXGA
/* Native resolutions (progressive, "fullscreen") */
{
SDL_PIXELFORMAT_RGB888
,
720
,
480
,
0
,
NULL
},
// 480p
{
SDL_PIXELFORMAT_RGB888
,
1280
,
720
,
0
,
NULL
},
// 720p
{
SDL_PIXELFORMAT_RGB888
,
1920
,
1080
,
0
,
NULL
}
// 1080p
};
/* PS3 videomode number according to ps3fb_modedb */
static
PS3_DisplayModeData
ps3fb_data
[]
=
{
{
11
},
{
12
},
{
13
},
{
130
},
{
131
},
{
133
},
};
void
PS3_GetDisplayModes
(
_THIS
,
SDL_VideoDisplay
*
display
)
{
deprintf
(
1
,
"+PS3_GetDisplayModes()
\n
"
);
SDL_DisplayMode
mode
;
unsigned
int
nummodes
;
nummodes
=
sizeof
(
ps3fb_modedb
)
/
sizeof
(
SDL_DisplayMode
);
int
n
;
for
(
n
=
0
;
n
<
nummodes
;
++
n
)
{
/* Get driver specific mode data */
ps3fb_modedb
[
n
].
driverdata
=
&
ps3fb_data
[
n
];
/* Add DisplayMode to list */
deprintf
(
2
,
"Adding resolution %u x %u
\n
"
,
ps3fb_modedb
[
n
].
w
,
ps3fb_modedb
[
n
].
h
);
SDL_AddDisplayMode
(
display
,
&
ps3fb_modedb
[
n
]);
}
deprintf
(
1
,
"-PS3_GetDisplayModes()
\n
"
);
}
int
PS3_SetDisplayMode
(
_THIS
,
SDL_VideoDisplay
*
display
,
SDL_DisplayMode
*
mode
)
{
deprintf
(
1
,
"+PS3_SetDisplayMode()
\n
"
);
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
PS3_DisplayModeData
*
dispdata
=
(
PS3_DisplayModeData
*
)
mode
->
driverdata
;
/* Set the new DisplayMode */
deprintf
(
2
,
"Setting PS3FB_MODE to %u
\n
"
,
dispdata
->
mode
);
if
(
ioctl
(
data
->
fbdev
,
PS3FB_IOCTL_SETMODE
,
(
unsigned
long
)
&
dispdata
->
mode
))
{
deprintf
(
2
,
"Could not set PS3FB_MODE
\n
"
);
SDL_SetError
(
"Could not set PS3FB_MODE
\n
"
);
return
-
1
;
}
deprintf
(
1
,
"-PS3_SetDisplayMode()
\n
"
);
return
0
;
}
void
PS3_QuitModes
(
_THIS
)
{
deprintf
(
1
,
"+PS3_QuitModes()
\n
"
);
/* There was no mem allocated for driverdata */
int
i
,
j
;
for
(
i
=
0
;
i
<
SDL_GetNumVideoDisplays
();
++
i
)
{
SDL_VideoDisplay
*
display
=
SDL_GetVideoDisplay
(
i
);
for
(
j
=
display
->
num_display_modes
;
j
--
;)
{
display
->
display_modes
[
j
].
driverdata
=
NULL
;
}
}
deprintf
(
1
,
"-PS3_QuitModes()
\n
"
);
}
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/SDL_ps3modes_c.h
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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"
#ifndef _SDL_ps3modes_h
#define _SDL_ps3modes_h
extern
void
PS3_InitModes
(
_THIS
);
extern
void
PS3_GetDisplayModes
(
_THIS
,
SDL_VideoDisplay
*
display
);
extern
int
PS3_SetDisplayMode
(
_THIS
,
SDL_VideoDisplay
*
display
,
SDL_DisplayMode
*
mode
);
extern
void
PS3_QuitModes
(
_THIS
);
#endif
/* SDL_ps3modes_h */
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/SDL_ps3render.c
deleted
100644 → 0
View file @
008911fd
This diff is collapsed.
Click to expand it.
src/video/ps3/SDL_ps3render_c.h
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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"
/* Default framebuffer device on PS3 */
/* SDL surface based renderer implementation */
extern
SDL_RenderDriver
SDL_PS3_RenderDriver
;
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/SDL_ps3spe.c
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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_video.h"
#include "SDL_ps3spe_c.h"
#include "SDL_ps3video.h"
#include "SDL_ps3render_c.h"
/* Start the SPE thread */
int
SPE_Start
(
spu_data_t
*
spe_data
)
{
deprintf
(
2
,
"[PS3->SPU] Start SPE: %s
\n
"
,
spe_data
->
program_name
);
if
(
!
(
spe_data
->
booted
))
SPE_Boot
(
spe_data
);
/* To allow re-running of context, spe_ctx_entry has to be set before each call */
spe_data
->
entry
=
SPE_DEFAULT_ENTRY
;
spe_data
->
error_code
=
0
;
/* Create SPE thread and run */
deprintf
(
2
,
"[PS3->SPU] Create Thread: %s
\n
"
,
spe_data
->
program_name
);
if
(
pthread_create
(
&
spe_data
->
thread
,
NULL
,
(
void
*
)
&
SPE_RunContext
,
(
void
*
)
spe_data
))
{
deprintf
(
2
,
"[PS3->SPU] Could not create pthread for spe: %s
\n
"
,
spe_data
->
program_name
);
SDL_SetError
(
"[PS3->SPU] Could not create pthread for spe"
);
return
-
1
;
}
if
(
spe_data
->
keepalive
)
SPE_WaitForMsg
(
spe_data
,
SPU_READY
);
}
/* Stop the SPE thread */
int
SPE_Stop
(
spu_data_t
*
spe_data
)
{
deprintf
(
2
,
"[PS3->SPU] Stop SPE: %s
\n
"
,
spe_data
->
program_name
);
/* Wait for SPE thread to complete */
deprintf
(
2
,
"[PS3->SPU] Wait for SPE thread to complete: %s
\n
"
,
spe_data
->
program_name
);
if
(
pthread_join
(
spe_data
->
thread
,
NULL
))
{
deprintf
(
2
,
"[PS3->SPU] Failed joining the thread: %s
\n
"
,
spe_data
->
program_name
);
SDL_SetError
(
"[PS3->SPU] Failed joining the thread"
);
return
-
1
;
}
return
0
;
}
/* Create SPE context and load program */
int
SPE_Boot
(
spu_data_t
*
spe_data
)
{
/* Create SPE context */
deprintf
(
2
,
"[PS3->SPU] Create SPE Context: %s
\n
"
,
spe_data
->
program_name
);
spe_data
->
ctx
=
spe_context_create
(
0
,
NULL
);
if
(
spe_data
->
ctx
==
NULL
)
{
deprintf
(
2
,
"[PS3->SPU] Failed creating SPE context: %s
\n
"
,
spe_data
->
program_name
);
SDL_SetError
(
"[PS3->SPU] Failed creating SPE context"
);
return
-
1
;
}
/* Load SPE object into SPE local store */
deprintf
(
2
,
"[PS3->SPU] Load Program into SPE: %s
\n
"
,
spe_data
->
program_name
);
if
(
spe_program_load
(
spe_data
->
ctx
,
&
spe_data
->
program
))
{
deprintf
(
2
,
"[PS3->SPU] Failed loading program into SPE context: %s
\n
"
,
spe_data
->
program_name
);
SDL_SetError
(
"[PS3->SPU] Failed loading program into SPE context"
);
return
-
1
;
}
spe_data
->
booted
=
1
;
deprintf
(
2
,
"[PS3->SPU] SPE boot successful
\n
"
);
return
0
;
}
/* (Stop and) shutdown the SPE */
int
SPE_Shutdown
(
spu_data_t
*
spe_data
)
{
if
(
spe_data
->
keepalive
&&
spe_data
->
booted
)
{
SPE_SendMsg
(
spe_data
,
SPU_EXIT
);
SPE_Stop
(
spe_data
);
}
/* Destroy SPE context */
deprintf
(
2
,
"[PS3->SPU] Destroy SPE context: %s
\n
"
,
spe_data
->
program_name
);
if
(
spe_context_destroy
(
spe_data
->
ctx
))
{
deprintf
(
2
,
"[PS3->SPU] Failed destroying context: %s
\n
"
,
spe_data
->
program_name
);
SDL_SetError
(
"[PS3->SPU] Failed destroying context"
);
return
-
1
;
}
deprintf
(
2
,
"[PS3->SPU] SPE shutdown successful: %s
\n
"
,
spe_data
->
program_name
);
return
0
;
}
/* Send message to the SPE via mailboxe */
int
SPE_SendMsg
(
spu_data_t
*
spe_data
,
unsigned
int
msg
)
{
deprintf
(
2
,
"[PS3->SPU] Sending message %u to %s
\n
"
,
msg
,
spe_data
->
program_name
);
/* Send one message, block until message was sent */
unsigned
int
spe_in_mbox_msgs
[
1
];
spe_in_mbox_msgs
[
0
]
=
msg
;
int
in_mbox_write
=
spe_in_mbox_write
(
spe_data
->
ctx
,
spe_in_mbox_msgs
,
1
,
SPE_MBOX_ALL_BLOCKING
);
if
(
1
>
in_mbox_write
)
{
deprintf
(
2
,
"[PS3->SPU] No message could be written to %s
\n
"
,
spe_data
->
program_name
);
SDL_SetError
(
"[PS3->SPU] No message could be written"
);
return
-
1
;
}
return
0
;
}
/* Read 1 message from SPE, block until at least 1 message was received */
int
SPE_WaitForMsg
(
spu_data_t
*
spe_data
,
unsigned
int
msg
)
{
deprintf
(
2
,
"[PS3->SPU] Waiting for message from %s
\n
"
,
spe_data
->
program_name
);
unsigned
int
out_messages
[
1
];
while
(
!
spe_out_mbox_status
(
spe_data
->
ctx
));
int
mbox_read
=
spe_out_mbox_read
(
spe_data
->
ctx
,
out_messages
,
1
);
deprintf
(
2
,
"[PS3->SPU] Got message from %s, message was %u
\n
"
,
spe_data
->
program_name
,
out_messages
[
0
]);
if
(
out_messages
[
0
]
==
msg
)
return
0
;
else
return
-
1
;
}
/* Re-runnable invocation of the spe_context_run call */
void
SPE_RunContext
(
void
*
thread_argp
)
{
/* argp is the pointer to argument to be passed to the SPE program */
spu_data_t
*
args
=
(
spu_data_t
*
)
thread_argp
;
deprintf
(
3
,
"[PS3->SPU] void* argp=0x%x
\n
"
,
(
unsigned
int
)
args
->
argp
);
/* Run it.. */
deprintf
(
2
,
"[PS3->SPU] Run SPE program: %s
\n
"
,
args
->
program_name
);
if
(
spe_context_run
(
args
->
ctx
,
&
args
->
entry
,
0
,
(
void
*
)
args
->
argp
,
NULL
,
NULL
)
<
0
)
{
deprintf
(
2
,
"[PS3->SPU] Failed running SPE context: %s
\n
"
,
args
->
program_name
);
SDL_SetError
(
"[PS3->SPU] Failed running SPE context: %s"
,
args
->
program_name
);
exit
(
1
);
}
pthread_exit
(
NULL
);
}
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/SDL_ps3spe_c.h
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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
*/
/* This SPE API basically provides 3 ways to run and control a program
* on the SPE:
* - Start and stop the program (keepalive=0).
* SPE_Start() will implicitly boot up the program, create a thread and run
* the context.
* SPE_Stop() will join the (terminated) thread (may block) and return.
* - Boot the program and run it (keepalive=0).
* SPE_Boot() will create a context and load the program and finally start
* the context with SPE_Start().
* SPE_Stop() will savely end the program.
* - Boot, Run and send messages to the program (keepalive=1).
* Start the program by using one of the methods described above. When
* received the READY-message the program is in its infinite loop waiting
* for new messages.
* Every time you run the program, send SPU_START and the address of the
* according struct using SPE_SendMsg().
* SPE_WaitForMsg() will than wait for SPU_FIN and is blocking.
* SPE_Shutdown() sends SPU_EXIT and finally stops the program.
*
* Therefor the SPE program
* - either runs once and returns
* - or runs in an infinite loop and is controlled by messages.
*/
#include "SDL_config.h"
#include "spulibs/spu_common.h"
#include <libspe2.h>
#ifndef _SDL_ps3spe_h
#define _SDL_ps3spe_h
/* SPU handling data */
typedef
struct
spu_data
{
/* Context to be executed */
spe_context_ptr_t
ctx
;
spe_program_handle_t
program
;
/* Thread running the context */
pthread_t
thread
;
/* For debugging */
char
*
program_name
;
/* SPE_Start() or SPE_Boot() called */
unsigned
int
booted
;
/* Runs the program in an infinite loop? */
unsigned
int
keepalive
;
unsigned
int
entry
;
/* Exit code of the program */
int
error_code
;
/* Arguments passed to the program */
void
*
argp
;
}
spu_data_t
;
/* SPU specific API functions */
int
SPE_Start
(
spu_data_t
*
spe_data
);
int
SPE_Stop
(
spu_data_t
*
spe_data
);
int
SPE_Boot
(
spu_data_t
*
spe_data
);
int
SPE_Shutdown
(
spu_data_t
*
spe_data
);
int
SPE_SendMsg
(
spu_data_t
*
spe_data
,
unsigned
int
msg
);
int
SPE_WaitForMsg
(
spu_data_t
*
spe_data
,
unsigned
int
msg
);
void
SPE_RunContext
(
void
*
thread_argp
);
#endif
/* _SDL_ps3spe_h */
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/SDL_ps3video.c
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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"
/* SDL PS3 video driver implementation based on dummy video driver
*
* Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion
* of this was cut-and-pasted from Stephane Peter's work in the AAlib
* SDL video driver. Renamed to "DUMMY" by Sam Lantinga.
*/
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"
#include "SDL_ps3video.h"
#include "SDL_ps3spe_c.h"
#include "SDL_ps3events_c.h"
#include "SDL_ps3render_c.h"
#include "SDL_ps3modes_c.h"
#include <fcntl.h>
#include <linux/fb.h>
#include <asm/ps3fb.h>
#include <sys/mman.h>
#define PS3VID_DRIVER_NAME "ps3"
/* Initialization/Query functions */
static
int
PS3_VideoInit
(
_THIS
);
static
void
PS3_VideoQuit
(
_THIS
);
/* Stores the SPE executable name of fb_writer_spu */
extern
spe_program_handle_t
fb_writer_spu
;
/* PS3 driver bootstrap functions */
static
int
PS3_Available
(
void
)
{
deprintf
(
1
,
"+PS3_Available()
\n
"
);
const
char
*
envr
=
SDL_getenv
(
"SDL_VIDEODRIVER"
);
if
((
envr
)
&&
(
SDL_strcmp
(
envr
,
PS3VID_DRIVER_NAME
)
==
0
))
{
return
(
1
);
}
deprintf
(
1
,
"-PS3_Available()
\n
"
);
return
(
0
);
}
static
void
PS3_DeleteDevice
(
SDL_VideoDevice
*
device
)
{
deprintf
(
1
,
"+PS3_DeleteDevice()
\n
"
);
SDL_free
(
device
->
driverdata
);
SDL_free
(
device
);
deprintf
(
1
,
"-PS3_DeleteDevice()
\n
"
);
}
static
SDL_VideoDevice
*
PS3_CreateDevice
(
int
devindex
)
{
deprintf
(
1
,
"+PS3_CreateDevice()
\n
"
);
SDL_VideoDevice
*
device
;
SDL_VideoData
*
data
;
/* Initialize all variables that we clean on shutdown */
device
=
(
SDL_VideoDevice
*
)
SDL_calloc
(
1
,
sizeof
(
SDL_VideoDevice
));
if
(
!
device
)
{
SDL_OutOfMemory
();
if
(
device
)
{
SDL_free
(
device
);
}
return
(
0
);
}
data
=
(
struct
SDL_VideoData
*
)
SDL_calloc
(
1
,
sizeof
(
SDL_VideoData
));
if
(
!
data
)
{
SDL_OutOfMemory
();
SDL_free
(
device
);
return
(
0
);
}
device
->
driverdata
=
data
;
/* Set the function pointers */
device
->
VideoInit
=
PS3_VideoInit
;
device
->
VideoQuit
=
PS3_VideoQuit
;
device
->
SetDisplayMode
=
PS3_SetDisplayMode
;
device
->
GetDisplayModes
=
PS3_GetDisplayModes
;
device
->
PumpEvents
=
PS3_PumpEvents
;
device
->
free
=
PS3_DeleteDevice
;
deprintf
(
1
,
"-PS3_CreateDevice()
\n
"
);
return
device
;
}
VideoBootStrap
PS3_bootstrap
=
{
PS3VID_DRIVER_NAME
,
"SDL PS3 Cell video driver"
,
PS3_Available
,
PS3_CreateDevice
};
int
PS3_VideoInit
(
_THIS
)
{
int
i
;
deprintf
(
1
,
"PS3_VideoInit()
\n
"
);
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
SDL_DisplayMode
mode
;
/* Create SPU fb_parms and thread structure */
data
->
fb_parms
=
(
struct
fb_writer_parms_t
*
)
memalign
(
16
,
sizeof
(
struct
fb_writer_parms_t
));
data
->
fb_thread_data
=
(
spu_data_t
*
)
malloc
(
sizeof
(
spu_data_t
));
if
(
data
->
fb_parms
==
NULL
||
data
->
fb_thread_data
==
NULL
)
{
SDL_OutOfMemory
();
return
-
1
;
}
data
->
fb_thread_data
->
program
=
fb_writer_spu
;
data
->
fb_thread_data
->
program_name
=
"fb_writer_spu"
;
data
->
fb_thread_data
->
argp
=
(
void
*
)
data
->
fb_parms
;
data
->
fb_thread_data
->
keepalive
=
1
;
data
->
fb_thread_data
->
booted
=
0
;
SPE_Start
(
data
->
fb_thread_data
);
/* Open the device */
data
->
fbdev
=
open
(
PS3DEV
,
O_RDWR
);
if
(
data
->
fbdev
<
0
)
{
SDL_SetError
(
"[PS3] Unable to open device %s"
,
PS3DEV
);
return
-
1
;
}
/* Take control of frame buffer from kernel, for details see
* http://felter.org/wesley/files/ps3/linux-20061110-docs/ApplicationProgrammingEnvironment.html
* kernel will no longer flip the screen itself
*/
ioctl
(
data
->
fbdev
,
PS3FB_IOCTL_ON
,
0
);
/* Unblank screen */
ioctl
(
data
->
fbdev
,
FBIOBLANK
,
0
);
struct
fb_fix_screeninfo
fb_finfo
;
if
(
ioctl
(
data
->
fbdev
,
FBIOGET_FSCREENINFO
,
&
fb_finfo
))
{
SDL_SetError
(
"[PS3] Can't get fixed screeninfo"
);
return
(
0
);
}
/* Note: on PS3, fb_finfo.smem_len is enough for double buffering */
if
((
data
->
frame_buffer
=
(
uint8_t
*
)
mmap
(
0
,
fb_finfo
.
smem_len
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
data
->
fbdev
,
0
))
==
(
uint8_t
*
)
-
1
)
{
SDL_SetError
(
"[PS3] Can't mmap for %s"
,
PS3DEV
);
return
(
0
);
}
else
{
/* Enable double buffering */
}
/* Blank screen */
memset
(
data
->
frame_buffer
,
0x00
,
fb_finfo
.
smem_len
);
PS3_InitModes
(
_this
);
for
(
i
=
0
;
i
<
_this
->
num_displays
;
++
i
)
{
SDL_AddRenderDriver
(
&
_this
->
displays
[
i
],
&
SDL_PS3_RenderDriver
);
}
/* We're done! */
return
0
;
}
void
PS3_VideoQuit
(
_THIS
)
{
deprintf
(
1
,
"PS3_VideoQuit()
\n
"
);
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
PS3_QuitModes
(
_this
);
/* Unmap framebuffer */
if
(
data
->
frame_buffer
)
{
struct
fb_fix_screeninfo
fb_finfo
;
if
(
ioctl
(
data
->
fbdev
,
FBIOGET_FSCREENINFO
,
&
fb_finfo
)
!=
-
1
)
{
munmap
(
data
->
frame_buffer
,
fb_finfo
.
smem_len
);
data
->
frame_buffer
=
0
;
}
}
/* Shutdown SPE and related resources */
if
(
data
->
fb_parms
)
free
((
void
*
)
data
->
fb_parms
);
if
(
data
->
fb_thread_data
)
{
SPE_Shutdown
(
data
->
fb_thread_data
);
free
((
void
*
)
data
->
fb_thread_data
);
}
/* Close device */
if
(
data
->
fbdev
)
{
/* Give control of frame buffer back to kernel */
ioctl
(
data
->
fbdev
,
PS3FB_IOCTL_OFF
,
0
);
close
(
data
->
fbdev
);
data
->
fbdev
=
-
1
;
}
}
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/SDL_ps3video.h
deleted
100644 → 0
View file @
008911fd
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 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"
#ifndef _SDL_ps3video_h
#define _SDL_ps3video_h
#include "../SDL_sysvideo.h"
#include "SDL_ps3spe_c.h"
#include <linux/fb.h>
#include <asm/ps3fb.h>
/* Debugging
* 0: No debug messages
* 1: Video debug messages
* 2: SPE debug messages
* 3: Memory adresses
*/
#define DEBUG_LEVEL 0
#ifdef DEBUG_LEVEL
#define deprintf( level, fmt, args... ) \
do \
{ \
if ( (unsigned)(level) <= DEBUG_LEVEL ) \
{ \
fprintf( stdout, fmt, ##args ); \
fflush( stdout ); \
} \
} while ( 0 )
#else
#define deprintf( level, fmt, args... )
#endif
/* Default framebuffer device on PS3 */
#define PS3DEV "/dev/fb0"
/* Private display data */
typedef
struct
SDL_VideoData
{
/* Framebuffer device descriptor */
int
fbdev
;
/* mmap'd access to fbdev */
uint8_t
*
frame_buffer
;
/* SPE threading stuff of the framebuffer */
spu_data_t
*
fb_thread_data
;
/* Framebuffer transfer data */
volatile
struct
fb_writer_parms_t
*
fb_parms
__attribute__
((
aligned
(
128
)));
}
SDL_VideoData
;
typedef
struct
SDL_DisplayModeData
{
unsigned
long
mode
;
//struct ps3fb_ioctl_res res;
}
PS3_DisplayModeData
;
#endif
/* _SDL_ps3video_h */
/* vi: set ts=4 sw=4 expandtab: */
src/video/ps3/spulibs/Makefile
deleted
100644 → 0
View file @
008911fd
# This Makefile is for building the CELL BE SPU libs
# libfb_writer_spu.so, libyuv2rgb_spu.so, libbilin_scaler_spu.so
# Toolchain
PPU_LD
=
/usr/bin/ld
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
DEPS
=
$(SPU_SRCDIR)
/spu_common.h
LIBS
=
fb_writer yuv2rgb bilin_scaler
OBJLIBS
=
$
(
foreach lib,
$(LIBS)
,lib
$(lib)
_spu.a
)
SHALIBS
=
$
(
foreach lib,
$(LIBS)
,lib
$(lib)
_spu.so
)
ps3libs
:
$(foreach lib
,
$(OBJLIBS)
,
$(SPU_LIBDIR)/$(lib)) $(foreach lib
,
$(SHALIBS)
,
$(SPU_LIBDIR)/$(lib))
$(SPU_LIBDIR)/lib%_spu.a
:
$(SPU_LIBDIR)/%-embed.o
$(AR)
-qcs
$@
$<
$(SPU_LIBDIR)/lib%_spu.so
:
$(SPU_LIBDIR)/%-embed.o
$(PPU_LD)
-o
$@
-shared
-soname
=
$
(
notdir
$@
)
$<
$(SPU_LIBDIR)/%-embed.o
:
$(SPU_LIBDIR)/%.o
$(EMBEDSPU)
-m32
$
(
subst
-embed
.o,,
$
(
notdir
$@
))
_spu
$<
$@
$(SPU_LIBDIR)/%.o
:
$(SPU_SRCDIR)/%.c $(DEPS)
$(SPU_GCC)
$(SPU_CFLAGS)
-o
$@
$<
-lm
ps3libs-install
:
$(foreach obj
,
$(OBJLIBS)
,
$(SPU_LIBDIR)/$(obj)) $(foreach obj
,
$(SHALIBS)
,
$(SPU_LIBDIR)/$(obj))
for
file
in
$(OBJLIBS)
;
do
\
$(INSTALL)
-c
-m
0655
$(SPU_LIBDIR)
/
$$
file
$(DESTDIR)$(libdir)
/
$$
file
;
\
done
for
file
in
$(SHALIBS)
;
do
\
$(INSTALL)
-c
-m
0755
$(SPU_LIBDIR)
/
$$
file
$(DESTDIR)$(libdir)
/
$$
file
;
\
done
ps3libs-uninstall
:
for
file
in
$(OBJLIBS)
$(SHALIBS)
;
do
\
rm
-f
$(DESTDIR)$(libdir)
/
$$
file
;
\
done
ps3libs-clean
:
rm
-f
$(SPU_LIBDIR)
/
*
src/video/ps3/spulibs/bilin_scaler.c
deleted
100644 → 0
View file @
008911fd
This diff is collapsed.
Click to expand it.
src/video/ps3/spulibs/fb_writer.c
deleted
100644 → 0
View file @
008911fd
/*
* SDL - Simple DirectMedia Layer
* CELL BE Support for PS3 Framebuffer
* Copyright (C) 2008, 2009 International Business Machines Corporation
*
* 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
*
* Martin Lowinski <lowinski [at] de [dot] ibm [ibm] com>
* Dirk Herrendoerfer <d.herrendoerfer [at] de [dot] ibm [dot] com>
* SPE code based on research by:
* Rene Becker
* Thimo Emmerich
*/
#include "spu_common.h"
#include <spu_intrinsics.h>
#include <spu_mfcio.h>
#include <stdio.h>
#include <string.h>
// Debugging
//#define DEBUG
#ifdef DEBUG
#define deprintf(fmt, args... ) \
fprintf( stdout, fmt, ##args ); \
fflush( stdout );
#else
#define deprintf( fmt, args... )
#endif
void
cpy_to_fb
(
unsigned
int
);
/* fb_writer_spu parms */
static
volatile
struct
fb_writer_parms_t
parms
__attribute__
((
aligned
(
128
)));
/* Code running on SPU */
int
main
(
unsigned
long
long
spe_id
__attribute__
((
unused
)),
unsigned
long
long
argp
__attribute__
((
unused
)))
{
deprintf
(
"[SPU] fb_writer_spu is up... (on SPE #%llu)
\n
"
,
spe_id
);
uint32_t
ea_mfc
,
mbox
;
// send ready message
spu_write_out_mbox
(
SPU_READY
);
while
(
1
)
{
/* Check mailbox */
mbox
=
spu_read_in_mbox
();
deprintf
(
"[SPU] Message is %u
\n
"
,
mbox
);
switch
(
mbox
)
{
case
SPU_EXIT
:
deprintf
(
"[SPU] fb_writer goes down...
\n
"
);
return
0
;
case
SPU_START
:
break
;
default:
deprintf
(
"[SPU] Cannot handle message
\n
"
);
continue
;
}
/* Tag Manager setup */
unsigned
int
tags
;
tags
=
mfc_multi_tag_reserve
(
5
);
if
(
tags
==
MFC_TAG_INVALID
)
{
deprintf
(
"[SPU] Failed to reserve mfc tags on fb_writer
\n
"
);
return
0
;
}
/* Framebuffer parms */
ea_mfc
=
spu_read_in_mbox
();
deprintf
(
"[SPU] Message on fb_writer is %u
\n
"
,
ea_mfc
);
spu_mfcdma32
(
&
parms
,
(
unsigned
int
)
ea_mfc
,
sizeof
(
struct
fb_writer_parms_t
),
tags
,
MFC_GET_CMD
);
deprintf
(
"[SPU] argp = %u
\n
"
,
(
unsigned
int
)
argp
);
DMA_WAIT_TAG
(
tags
);
/* Copy parms->data to framebuffer */
deprintf
(
"[SPU] Copying to framebuffer started
\n
"
);
cpy_to_fb
(
tags
);
deprintf
(
"[SPU] Copying to framebuffer done!
\n
"
);
mfc_multi_tag_release
(
tags
,
5
);
deprintf
(
"[SPU] fb_writer_spu... done!
\n
"
);
/* Send FIN msg */
spu_write_out_mbox
(
SPU_FIN
);
}
return
0
;
}
void
cpy_to_fb
(
unsigned
int
tag_id_base
)
{
unsigned
int
i
;
unsigned
char
current_buf
;
uint8_t
*
in
=
parms
.
data
;
/* Align fb pointer which was centered before */
uint8_t
*
fb
=
(
unsigned
char
*
)((
unsigned
int
)
parms
.
center
&
0xFFFFFFF0
);
uint32_t
bounded_input_height
=
parms
.
bounded_input_height
;
uint32_t
bounded_input_width
=
parms
.
bounded_input_width
;
uint32_t
fb_pixel_size
=
parms
.
fb_pixel_size
;
uint32_t
out_line_stride
=
parms
.
out_line_stride
;
uint32_t
in_line_stride
=
parms
.
in_line_stride
;
uint32_t
in_line_size
=
bounded_input_width
*
fb_pixel_size
;
current_buf
=
0
;
/* Local store buffer */
static
volatile
uint8_t
buf
[
4
][
BUFFER_SIZE
]
__attribute__
((
aligned
(
128
)));
/* do 4-times multibuffering using DMA list, process in two steps */
for
(
i
=
0
;
i
<
bounded_input_height
>>
2
;
i
++
)
{
/* first buffer */
DMA_WAIT_TAG
(
tag_id_base
+
1
);
// retrieve buffer
spu_mfcdma32
(
buf
[
0
],
(
unsigned
int
)
in
,
in_line_size
,
tag_id_base
+
1
,
MFC_GETB_CMD
);
DMA_WAIT_TAG
(
tag_id_base
+
1
);
// store buffer
spu_mfcdma32
(
buf
[
0
],
(
unsigned
int
)
fb
,
in_line_size
,
tag_id_base
+
1
,
MFC_PUTB_CMD
);
in
+=
in_line_stride
;
fb
+=
out_line_stride
;
deprintf
(
"[SPU] 1st buffer copied in=0x%x, fb=0x%x
\n
"
,
in
,
fb
);
/* second buffer */
DMA_WAIT_TAG
(
tag_id_base
+
2
);
// retrieve buffer
spu_mfcdma32
(
buf
[
1
],
(
unsigned
int
)
in
,
in_line_size
,
tag_id_base
+
2
,
MFC_GETB_CMD
);
DMA_WAIT_TAG
(
tag_id_base
+
2
);
// store buffer
spu_mfcdma32
(
buf
[
1
],
(
unsigned
int
)
fb
,
in_line_size
,
tag_id_base
+
2
,
MFC_PUTB_CMD
);
in
+=
in_line_stride
;
fb
+=
out_line_stride
;
deprintf
(
"[SPU] 2nd buffer copied in=0x%x, fb=0x%x
\n
"
,
in
,
fb
);
/* third buffer */
DMA_WAIT_TAG
(
tag_id_base
+
3
);
// retrieve buffer
spu_mfcdma32
(
buf
[
2
],
(
unsigned
int
)
in
,
in_line_size
,
tag_id_base
+
3
,
MFC_GETB_CMD
);
DMA_WAIT_TAG
(
tag_id_base
+
3
);
// store buffer
spu_mfcdma32
(
buf
[
2
],
(
unsigned
int
)
fb
,
in_line_size
,
tag_id_base
+
3
,
MFC_PUTB_CMD
);
in
+=
in_line_stride
;
fb
+=
out_line_stride
;
deprintf
(
"[SPU] 3rd buffer copied in=0x%x, fb=0x%x
\n
"
,
in
,
fb
);
/* fourth buffer */
DMA_WAIT_TAG
(
tag_id_base
+
4
);
// retrieve buffer
spu_mfcdma32
(
buf
[
3
],
(
unsigned
int
)
in
,
in_line_size
,
tag_id_base
+
4
,
MFC_GETB_CMD
);
DMA_WAIT_TAG
(
tag_id_base
+
4
);
// store buffer
spu_mfcdma32
(
buf
[
3
],
(
unsigned
int
)
fb
,
in_line_size
,
tag_id_base
+
4
,
MFC_PUTB_CMD
);
in
+=
in_line_stride
;
fb
+=
out_line_stride
;
deprintf
(
"[SPU] 4th buffer copied in=0x%x, fb=0x%x
\n
"
,
in
,
fb
);
deprintf
(
"[SPU] Loop #%i, bounded_input_height=%i
\n
"
,
i
,
bounded_input_height
>>
2
);
}
DMA_WAIT_TAG
(
tag_id_base
+
2
);
DMA_WAIT_TAG
(
tag_id_base
+
3
);
DMA_WAIT_TAG
(
tag_id_base
+
4
);
}
src/video/ps3/spulibs/spu_common.h
deleted
100644 → 0
View file @
008911fd
/*
* SDL - Simple DirectMedia Layer
* CELL BE Support for PS3 Framebuffer
* Copyright (C) 2008, 2009 International Business Machines Corporation
*
* 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
*
* Martin Lowinski <lowinski [at] de [dot] ibm [ibm] com>
* Dirk Herrendoerfer <d.herrendoerfer [at] de [dot] ibm [dot] com>
* SPE code based on research by:
* Rene Becker
* Thimo Emmerich
*/
/* Common definitions/makros for SPUs */
#ifndef _SPU_COMMON_H
#define _SPU_COMMON_H
#include <stdio.h>
#include <stdint.h>
#include <string.h>
/* Tag management */
#define DMA_WAIT_TAG(_tag) \
mfc_write_tag_mask(1<<(_tag)); \
mfc_read_tag_status_all();
/* SPU mailbox messages */
#define SPU_READY 0
#define SPU_START 1
#define SPU_FIN 2
#define SPU_EXIT 3
/* Tags */
#define RETR_BUF 0
#define STR_BUF 1
#define TAG_INIT 2
/* Buffersizes */
#define MAX_HDTV_WIDTH 1920
#define MAX_HDTV_HEIGHT 1080
/* One stride of HDTV */
#define BUFFER_SIZE 7680
/* fb_writer ppu/spu exchange parms */
struct
fb_writer_parms_t
{
uint8_t
*
data
;
uint8_t
*
center
;
uint32_t
out_line_stride
;
uint32_t
in_line_stride
;
uint32_t
bounded_input_height
;
uint32_t
bounded_input_width
;
uint32_t
fb_pixel_size
;
/* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
char
padding
[
4
];
}
__attribute__
((
aligned
(
128
)));
/* yuv2rgb ppu/spu exchange parms */
struct
yuv2rgb_parms_t
{
uint8_t
*
y_plane
;
uint8_t
*
v_plane
;
uint8_t
*
u_plane
;
uint8_t
*
dstBuffer
;
unsigned
int
src_pixel_width
;
unsigned
int
src_pixel_height
;
/* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
char
padding
[
128
-
((
4
*
sizeof
(
uint8_t
*
)
+
2
*
sizeof
(
unsigned
int
))
&
0x7F
)];
}
__attribute__
((
aligned
(
128
)));
/* bilin_scaler ppu/spu exchange parms */
struct
scale_parms_t
{
uint8_t
*
y_plane
;
uint8_t
*
v_plane
;
uint8_t
*
u_plane
;
uint8_t
*
dstBuffer
;
unsigned
int
src_pixel_width
;
unsigned
int
src_pixel_height
;
unsigned
int
dst_pixel_width
;
unsigned
int
dst_pixel_height
;
/* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
char
padding
[
128
-
((
4
*
sizeof
(
uint8_t
*
)
+
4
*
sizeof
(
unsigned
int
))
&
0x7F
)];
}
__attribute__
((
aligned
(
128
)));
#endif
/* _SPU_COMMON_H */
src/video/ps3/spulibs/yuv2rgb.c
deleted
100644 → 0
View file @
008911fd
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment