aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp52
-rw-r--r--backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h4
-rw-r--r--backends/platform/sdl/raspberrypi/README.RASPBERRYPI100
-rwxr-xr-xconfigure8
-rw-r--r--ports.mk8
5 files changed, 134 insertions, 38 deletions
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index b3d03f6336..f2df0e0086 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -34,7 +34,7 @@
#include <bcm_host.h>
-#define numpages 2
+#define NUMPAGES 2
struct dispvarsStruct {
DISPMANX_DISPLAY_HANDLE_T display;
@@ -70,16 +70,15 @@ DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventS
DispmanXInit();
}
-DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager()
-{
+DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager() {
DispmanXVideoQuit();
delete _dispvars;
}
-void DispmanXSdlGraphicsManager::DispmanXInit () {
+void DispmanXSdlGraphicsManager::DispmanXInit() {
_dispvars->screen = 0;
_dispvars->vcImagePtr = 0;
- _dispvars->pages = (struct dispmanxPage*)calloc(numpages, sizeof(struct dispmanxPage));
+ _dispvars->pages = (struct dispmanxPage *)calloc(NUMPAGES, sizeof(struct dispmanxPage));
_dispvars->pageflipPending = 0;
_dispvars->nextPage = &_dispvars->pages[0];
@@ -93,11 +92,11 @@ void DispmanXSdlGraphicsManager::DispmanXInit () {
_dispvars->display = vc_dispmanx_display_open(_dispvars->screen);
}
-void DispmanXSdlGraphicsManager::DispmanXSetup (int width, int height, int bpp) {
+void DispmanXSdlGraphicsManager::DispmanXSetup(int width, int height, int bpp) {
DispmanXFreeResources();
- vc_dispmanx_display_get_info(_dispvars->display, &(_dispvars->amode));
+ vc_dispmanx_display_get_info(_dispvars->display, &_dispvars->amode);
- _dispvars->pitch = width * (bpp/8);
+ _dispvars->pitch = width * (bpp / 8);
_dispvars->pixFormat = VC_IMAGE_RGB565;
// Transparency disabled
@@ -127,8 +126,7 @@ void DispmanXSdlGraphicsManager::DispmanXSetup (int width, int height, int bpp)
vc_dispmanx_rect_set(&(_dispvars->bmpRect), 0, 0, width, height);
vc_dispmanx_rect_set(&(_dispvars->srcRect), 0, 0, width << 16, height << 16);
- int i;
- for (i = 0; i < numpages; i++)
+ for (int i = 0; i < NUMPAGES; i++)
_dispvars->pages[i].resource = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height,
&(_dispvars->vcImagePtr));
@@ -142,8 +140,8 @@ void DispmanXSdlGraphicsManager::DispmanXSetup (int width, int height, int bpp)
vc_dispmanx_update_submit_sync(_dispvars->update);
}
-void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
- struct dispvarsStruct *_dispvars = (struct dispvarsStruct*) arg;
+void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void *arg) {
+ struct dispvarsStruct *_dispvars = (struct dispvarsStruct*)arg;
// Changing the page to write must be done before the signaling
// so we have the right page in nextPage when update_main continues
@@ -189,10 +187,9 @@ void DispmanXSdlGraphicsManager::DispmanXUpdate() {
}
void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
- int i;
_dispvars->update = vc_dispmanx_update_start(0);
- for (i = 0; i < numpages; i++)
+ for (int i = 0; i < NUMPAGES; i++)
vc_dispmanx_resource_delete(_dispvars->pages[i].resource);
vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
@@ -227,24 +224,18 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
//
// Create the surface that contains the 8 bit game data
//
-#ifdef USE_RGB_COLOR
- _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight,
- _screenFormat.bytesPerPixel << 3,
- ((1 << _screenFormat.rBits()) - 1) << _screenFormat.rShift ,
- ((1 << _screenFormat.gBits()) - 1) << _screenFormat.gShift ,
- ((1 << _screenFormat.bBits()) - 1) << _screenFormat.bShift ,
- ((1 << _screenFormat.aBits()) - 1) << _screenFormat.aShift );
- if (_screen == NULL)
- error("allocating _screen failed");
+ _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight,
+ _screenFormat.bytesPerPixel << 3,
+ ((1 << _screenFormat.rBits()) - 1) << _screenFormat.rShift ,
+ ((1 << _screenFormat.gBits()) - 1) << _screenFormat.gShift ,
+ ((1 << _screenFormat.bBits()) - 1) << _screenFormat.bShift ,
+ ((1 << _screenFormat.aBits()) - 1) << _screenFormat.aShift );
+ if (_screen == NULL)
+ error("allocating _screen failed");
// Avoid having SDL_SRCALPHA set even if we supplied an alpha-channel in the format.
SDL_SetAlpha(_screen, 0, 255);
-#else
- _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0);
- if (_screen == NULL)
- error("allocating _screen failed");
-#endif
-
+
// SDL 1.2 palettes default to all black,
// SDL 1.3 palettes default to all white,
// Thus set our own default palette to all black.
@@ -269,9 +260,7 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
// for mouse pointer adjustment to work correctly.
SDL_SetVideoMode(_videoMode.screenWidth, _videoMode.screenHeight, 16, SDL_FULLSCREEN);
-#ifdef USE_RGB_COLOR
detectSupportedFormats();
-#endif
if (_hwscreen == NULL) {
// DON'T use error(), as this tries to bring up the debug
@@ -538,7 +527,6 @@ bool DispmanXSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
void DispmanXSdlGraphicsManager::setFullscreenMode(bool enable) {
_videoMode.fullscreen = enable;
- return;
}
void DispmanXSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index 23a091fd04..a5abb8618a 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -28,8 +28,6 @@
struct dispvarsStruct;
struct dispmanxPage;
-typedef uint32_t DISPMANX_UPDATE_HANDLE_T;
-
class DispmanXSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource);
@@ -41,7 +39,7 @@ public:
void setAspectRatioCorrection(bool enable);
protected:
// Raspberry Pi Dispmanx API
- void DispmanXSetup(int width, int height, int bpp);
+ void DispmanXSetup(int dwidth, int dheight, int dbpp);
void DispmanXInit();
void DispmanXUpdate();
void DispmanXFreeResources();
diff --git a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
new file mode 100644
index 0000000000..f7143805a8
--- /dev/null
+++ b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
@@ -0,0 +1,100 @@
+ScummVM-RASPBERRYPI README
+==============================================================================
+
+Notes
+============
+
+This version of ScummVM is specially tailored to use DispmanX, the native 2D
+API on the Raspberry Pi. The idea is that scaling and drawing on a double
+buffer with a non-blocking vsync wait is all done using the on-board VideoCore
+hardware, thus using only a small fraction of the CPU ScummVM uses when ran
+on a clunky, software-scaled and desynced X11 enviroment using the X11 API.
+Thus, running this version under an X11 session is not supported.
+
+Requirements
+============
+- Raspberry Pi 1 or 2 microcomputer.
+- Raspbian (Debian) installed on SD card. Other distros may be supported if
+ they include the VideoCore runtime libraries that Raspbian includes.
+-An attached keyboard and mouse, or alternatively joystick.
+
+Controls
+============
+
+The standard ScummVM keyboard and mouse controls are used as in any other
+GNU/Linux based system.
+Use the --joystick parameter if you want to use a joystick instead of the
+intended mouse for playing the games (not recommended).
+
+Installation from binaries
+==============================
+
+We have at least three methods to get the binaries into the Raspbian SD:
+
+1) Since Debian (Raspbian) includes an ssh service by default, I recommend
+keeping the SD card on the Raspberry Pi, and using scp to copy the package over
+to your home directory in the Debian filesystem.
+
+scp scummvm-rpi_<version>.zip pi@<raspberrypi_ip>:/home/pi
+
+2) If your RaspberryPi has internet access, you can simply use wget to
+download the package to your home folder:
+
+cd ~/
+wget <package_link>
+
+3) You could also connect the Raspbian SD card to your main PC and, after
+mounting it (or being automounted as it would be in most desktop GNU/Linux
+systems), copy the package file manually to your home directory.
+How to mount an SD and copy files to it is beyond the scope of this README.
+
+Once we have the package file in our home directory using one of the three
+aforementioned methods, we would need to uncompress it:
+
+unzip scummvm-rpi_<version>.zip
+
+As a result, a directory containing the scummvm along with this README will be
+created.
+We can run it by simply changing to our scummvm directory and executing the
+scummvm file.
+
+cd scummvm-rpi
+./scummvm
+
+I recommend copying the games to /home/pi/scummvm-rpi. Adding the games via the menu
+works as in any other system ScummVM runs on.
+
+Building from sources
+==============================
+
+We have two options to build once we have the sources in our main GNU/Linux desktop
+class PC or in our Raspberry Pi:
+
+1) Building on the Raspberry Pi itself, although possible, is an SLOW task for the
+little computer unless you use distributed gcc (or distcc for short).
+
+Local compilation would simply consist of the "standard" GNU/Linux building process:
+
+cd <sources_dir>
+
+./configure ./configure --backend=raspberrypi -disable-debug --enable-release
+--enable-optimizations --disable-mt32emu --disable-flac --disable-mad --disable-vorbis
+--disable-tremor --disable-fluidsynth --disable-taskbar --disable-timidity --disable-alsa
+
+make
+
+¡¡It will be an SLOW process, taking several hours to complete, unless you
+are running distcc against a fast compilation server!!
+
+2) If we wandt to build by cross-compiling on a GNU/Linux X86-based computer,
+we can find concise instructions for this can be found on the ScummVM wiki:
+
+http://wiki.scummvm.org/index.php/Compiling_ScummVM/RPI
+
+NOTE: Distcc is my preferred method as it does cross-compiling totally transparent
+(we build ON the Pi but the actual CPU-intensive compilation is made on an external
+server), but it involves building a custom gcc version on the compilation server and
+configuring a server and client in both the Raspberry Pi and the server.
+More info here: http://elinux.org/RPi_Linaro_GCC_Compilation#Build_GCC_Linaro
+
+Enjoy!
diff --git a/configure b/configure
index ec45fd458b..92aa1452f2 100755
--- a/configure
+++ b/configure
@@ -2987,6 +2987,7 @@ case $_backend in
LIBS="$LIBS -Wl,-Map,mapfile.txt"
;;
raspberrypi)
+ echocheck "DispmanX graphics "
_use_dispmanx=no
DISPMANX_CXXFLAGS="-I$RPI_ROOTDIR/opt/vc/include -I$RPI_ROOTDIR/opt/vc/include/interface/vmcs_host/linux/ -I$RPI_ROOTDIR/opt/vc/include/interface/vcos/pthreads -mfpu=vfp -mfloat-abi=hard -I$RPI_ROOTDIR/opt/rpi_root/usr/include/SDL"
DISPMANX_LIBS="--sysroot=$RPI_ROOTDIR -L$RPI_ROOTDIR/usr/lib -L$RPI_ROOTDIR/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
@@ -2999,7 +3000,6 @@ case $_backend in
EOF
cc_check $DISPMANX_CXXFLAGS $DISPMANX_LIBS && _use_dispmanx=yes
if test "$_use_dispmanx" = "yes"; then
- echo "Activating Raspberry Pi DispmanX graphics backend"
CXXFLAGS="$CXXFLAGS $DISPMANX_CXXFLAGS"
LIBS="$LIBS $DISPMANX_LIBS"
MODULES="$MODULES backends/platform/sdl"
@@ -3009,8 +3009,7 @@ EOF
_build_hq_scalers=no
_opengl=no
_default_optimization_level=-O3
- else
- echo "Can't activate DispmanX context (missing headers?)."
+ echo $_use_dispmanx
fi
;;
samsungtv)
@@ -3157,6 +3156,9 @@ case $_backend in
LIBS="$LIBS -L$RPI_ROOTDIR/usr/lib -L$RPI_ROOTDIR/usr/lib/arm-linux-gnueabihf -lSDL"
DEFINES="$DEFINES -DSDL_BACKEND"
add_line_to_config_mk "SDL_BACKEND = 1"
+ _16bit=yes
+ _savegame_timestamp=no
+ _eventrec=no
esac
#
diff --git a/ports.mk b/ports.mk
index fdab7e23af..c31a5239c5 100644
--- a/ports.mk
+++ b/ports.mk
@@ -329,5 +329,13 @@ endif
@echo Now run
@echo "\tgit commit 'DISTS: Generated Code::Blocks and MSVC project files'"
+# Target to create Raspberry Pi zip containig binary and specific README
+raspberrypi_dist:
+ mkdir -p $(srcdir)/scummvm-rpi
+ cp $(srcdir)/backends/platform/sdl/raspberrypi/README.RASPBERRYPI $(srcdir)/scummvm-rpi/README
+ cp $(srcdir)/scummvm $(srcdir)/scummvm-rpi
+ zip -r scummvm-rpi.zip scummvm-rpi
+ rm -f -R scummvm-rpi
+
# Mark special targets as phony
.PHONY: deb bundle osxsnap win32dist install uninstall