[Scummvm-cvs-logs] scummvm master -> b1545d6162abe5e455d6c1fe882e233be3480442

sev- sev at scummvm.org
Sat Nov 21 00:13:54 CET 2015


This automated email contains information about 22 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
08a3376ba7 RASPBERRYPI: Added Raspberry Pi native 2D API support (dispmanx)
b4f5dc181e RASPBERRYPI: Updated dispmanx code with non-blocking vsync and triple buffer
f876fdc7f0 RASPBERRYPI: fixed some comments and spacing on the dispmanx graphics driver
0855b41c07 RASPBERRYPI: Fixed variable names, removed gcc optimization flags, temporary decrease buffers to 2.
eeb9ec9af9 RASPBERRYPI: Corrected redundant for loop on the dispmanx graphics driver code.
d5862217c3 RASPBERRYPI: Fixed cross-compilation.
2592c72cb5 RASPBERRYPI: Rewrote buffering code of the dispmanx graphics driver for stability.
bf68de9aa7 RASPBERRYPI: Changed the RGB code for the game screen surface and added RaspberryPi information file.
6320a008ec SDL/DISPMANX: Updated rendering code for better buffers management.
b706ca36f1 SDL/DISPMANX: Updated class member names, configure script and asociated files and docs to conform to fingolfin's correc
8cf5f96b9e SDL/DISPMANX: Make hasFeature(kFeatureFullscreenMode) return false since dispmanx graphics always run in accelerated ful
8382e87baa SDL/DISPMANX: Made minor corrections sugested by fingolfin.
fcbecdeaf6 SDL/DISPMANX: Corrected hasFeature() return values and made setFullScreenMode() ignore the enable value.
aa7734a643 SDL/DISPMANX Corrected configure script so Scummvm cross-compiles with modern Raspbian that uses multiarch.
a4bfef8c53 SDL/DISPMANX Removed a redundant and unused configure parameter info related to dispmanx.
c362119572 SDL/DISPMANX Renamed the RASBERRYPI define to the less confusing name of DISPMANX because it controls whether dispmanx r
c2c95cc95b SDL/DISPMANX Fixed dispmanx activation parameter on README.RASPBERRYPI
37e157a11c SDL/DISPMANX Make additional notes on README.RASPBERRYPI telling users to manually disable some features that are sub-op
99739a13fe Merge branch 'master' into dispmanx
9d831d0c42 SDL/DISPMANX Fixed small issues with merging: Use append_var, fix spacing issues and changed SurfaceSdlGraphicsManager c
c2c7225bbf SDL/DISPMANX Added myself to credits.pl
b1545d6162 Merge pull request #575 from vanfanel/dispmanx


Commit: 08a3376ba7bdcd262131eafa5ae5e4e8a4ecf18d
    https://github.com/scummvm/scummvm/commit/08a3376ba7bdcd262131eafa5ae5e4e8a4ecf18d
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-03-29T21:52:53+02:00

Commit Message:
RASPBERRYPI: Added Raspberry Pi native 2D API support (dispmanx)

Changed paths:
  A backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
  A backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
  A backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
  A backends/platform/sdl/raspberrypi/raspberrypi.cpp
  A backends/platform/sdl/raspberrypi/raspberrypi.h
    backends/module.mk
    backends/platform/sdl/module.mk
    backends/platform/sdl/posix/posix-main.cpp
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
new file mode 100644
index 0000000..03a10f1
--- /dev/null
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -0,0 +1,505 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+//Needed for Raspberry Pi header incussion
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "common/scummsys.h"
+
+#if defined(RASPBERRYPI)
+
+#include "backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h"
+#include "graphics/scaler/aspect.h"
+#include "common/mutex.h"
+#include "common/textconsole.h"
+
+#include <bcm_host.h>
+
+struct dispvarsStruct { 
+	DISPMANX_DISPLAY_HANDLE_T display;
+	DISPMANX_MODEINFO_T amode;
+	DISPMANX_UPDATE_HANDLE_T update;
+	DISPMANX_RESOURCE_HANDLE_T resources[2];
+	DISPMANX_ELEMENT_HANDLE_T element;
+	VC_IMAGE_TYPE_T pixFormat;
+	VC_DISPMANX_ALPHA_T *alpha;    
+	VC_RECT_T srcRect;
+	VC_RECT_T dstRect; 
+	VC_RECT_T bmpRect;
+	uint vcImagePtr;
+	uint screen;
+	uint pitch;
+	uint flipPage;
+	bool aspectRatioCorrection;
+	void *pixmem;
+};
+
+DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource)
+ : SurfaceSdlGraphicsManager(sdlEventSource) {
+	_dispvars = new dispvarsStruct;
+	DispmanXInit();
+}
+
+DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager() 
+{
+	DispmanXVideoQuit();
+	delete _dispvars;
+}
+
+void DispmanXSdlGraphicsManager::DispmanXInit () {
+	_dispvars->screen = 0;
+        _dispvars->flipPage = 0;
+	_dispvars->vcImagePtr = 0;
+	
+	// Before we call any vc_* function, we need to call this one.
+	bcm_host_init();
+	
+	_dispvars->display = vc_dispmanx_display_open(_dispvars->screen);
+}
+
+void DispmanXSdlGraphicsManager::DispmanXSetup (int width, int height, int bpp) {
+	DispmanXFreeResources();
+	vc_dispmanx_display_get_info(_dispvars->display, &(_dispvars->amode));
+
+        _dispvars->pitch = width * (bpp/8);
+	_dispvars->pixFormat = VC_IMAGE_RGB565;	       
+
+	// Transparency disabled
+	VC_DISPMANX_ALPHA_T layerAlpha;    
+	layerAlpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
+	layerAlpha.opacity = 255;
+	layerAlpha.mask = 0;
+	_dispvars->alpha = &layerAlpha;	
+
+	if (_dispvars->aspectRatioCorrection) {
+		float orig_ratio = ((float)width / (float)height); 
+		int dst_width = _dispvars->amode.height * orig_ratio;	
+		
+		// If we obtain an scaled image width that is bigger than the physical screen width,
+		// then we keep the physical screen width as our maximun width.	
+		if (dst_width > _dispvars->amode.width) 
+			dst_width = _dispvars->amode.width;
+		int dst_ypos  = (_dispvars->amode.width - dst_width) / 2; 
+		vc_dispmanx_rect_set(&(_dispvars->dstRect), dst_ypos, 0, 
+	   		dst_width, _dispvars->amode.height);
+	} else {
+		vc_dispmanx_rect_set(&(_dispvars->dstRect), 0, 0, 
+	   		_dispvars->amode.width, _dispvars->amode.height);
+	}
+
+	// We configure the rects now	
+	vc_dispmanx_rect_set(&(_dispvars->bmpRect), 0, 0, width, height);	
+	vc_dispmanx_rect_set(&(_dispvars->srcRect), 0, 0, width << 16, height << 16);	
+
+	// We create two resources for double buffering
+	_dispvars->resources[0] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
+		&(_dispvars->vcImagePtr));
+	
+	_dispvars->resources[1] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height,
+		&(_dispvars->vcImagePtr));
+	
+	// Add element
+	_dispvars->update = vc_dispmanx_update_start(0);
+	
+	_dispvars->element = vc_dispmanx_element_add(_dispvars->update, _dispvars->display, 0,
+		&(_dispvars->dstRect), _dispvars->resources[_dispvars->flipPage], &(_dispvars->srcRect), 
+		DISPMANX_PROTECTION_NONE, _dispvars->alpha, 0, (DISPMANX_TRANSFORM_T)0);
+	
+	vc_dispmanx_update_submit_sync(_dispvars->update);		
+}
+
+void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
+	vc_dispmanx_resource_write_data(_dispvars->resources[_dispvars->flipPage], _dispvars->pixFormat,
+		_dispvars->pitch, _dispvars->pixmem, &(_dispvars->bmpRect));
+	
+	// Update starts
+	_dispvars->update = vc_dispmanx_update_start(0);
+
+	vc_dispmanx_element_change_source(_dispvars->update, _dispvars->element,
+		_dispvars->resources[_dispvars->flipPage]);
+	
+	vc_dispmanx_update_submit_sync(_dispvars->update);		
+	// Update ends
+	
+	_dispvars->flipPage = !_dispvars->flipPage;
+	return;
+}
+
+void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
+	_dispvars->update = vc_dispmanx_update_start(0);
+		
+    	vc_dispmanx_resource_delete(_dispvars->resources[0]);
+    	vc_dispmanx_resource_delete(_dispvars->resources[1]);
+	vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
+	
+	vc_dispmanx_update_submit_sync(_dispvars->update);		
+}
+
+void DispmanXSdlGraphicsManager::DispmanXVideoQuit() {
+	DispmanXFreeResources();
+	vc_dispmanx_display_close(_dispvars->display);
+	bcm_host_deinit();
+}
+
+bool DispmanXSdlGraphicsManager::loadGFXMode() {
+	_forceFull = true;
+	
+	// In DispmanX, we manage aspect ratio correction, so for scummvm it's always disabled.
+	_videoMode.aspectRatioCorrection = false;
+	
+	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+	_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+
+	//
+	// 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");
+
+	// 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.
+	// SDL_SetColors does nothing for non indexed surfaces.
+	SDL_SetColors(_screen, _currentPalette, 0, 256);
+
+	//
+	// Create the surface that contains the scaled graphics in 16 bit mode
+	//
+
+	// We call DispmanXSetup() before SDL_SetVideoMode() because we use _hwscreen == null
+	// to know inside DispmanXSetup() if we've been there before and need to free resources.
+	DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight, 16);	
+	// _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, SDL_FULLSCREEN);
+	_hwscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
+		0, 0, 0, 0);
+	
+	_dispvars->pixmem = _hwscreen->pixels;
+
+	// We draw on a RAM surface, but we make this call just to get SDL input initialized. 
+	// Even if we don't use the returned SDL_Surface *, we still need to use the right dimensions
+	// 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
+		// console, which WON'T WORK now that _hwscreen is hosed.
+
+		if (!_oldVideoMode.setup) {
+			warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
+			g_system->quit();
+		} else {
+			return false;
+		}
+	}
+
+	//
+	// Create the surface used for the graphics in 16 bit before scaling, and also the overlay
+	//
+
+	// Need some extra bytes around when using 2xSaI
+	_tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3,
+						16,
+						_hwscreen->format->Rmask,
+						_hwscreen->format->Gmask,
+						_hwscreen->format->Bmask,
+						_hwscreen->format->Amask);
+
+	if (_tmpscreen == NULL)
+		error("allocating _tmpscreen failed");
+
+	_overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth, _videoMode.overlayHeight,
+						16,
+						_hwscreen->format->Rmask,
+						_hwscreen->format->Gmask,
+						_hwscreen->format->Bmask,
+						_hwscreen->format->Amask);
+
+	if (_overlayscreen == NULL)
+		error("allocating _overlayscreen failed");
+
+	_overlayFormat.bytesPerPixel = _overlayscreen->format->BytesPerPixel;
+
+	_overlayFormat.rLoss = _overlayscreen->format->Rloss;
+	_overlayFormat.gLoss = _overlayscreen->format->Gloss;
+	_overlayFormat.bLoss = _overlayscreen->format->Bloss;
+	_overlayFormat.aLoss = _overlayscreen->format->Aloss;
+
+	_overlayFormat.rShift = _overlayscreen->format->Rshift;
+	_overlayFormat.gShift = _overlayscreen->format->Gshift;
+	_overlayFormat.bShift = _overlayscreen->format->Bshift;
+	_overlayFormat.aShift = _overlayscreen->format->Ashift;
+
+	_tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + 3, _videoMode.overlayHeight + 3,
+						16,
+						_hwscreen->format->Rmask,
+						_hwscreen->format->Gmask,
+						_hwscreen->format->Bmask,
+						_hwscreen->format->Amask);
+
+	if (_tmpscreen2 == NULL)
+		error("allocating _tmpscreen2 failed");
+
+#ifdef USE_OSD
+	_osdSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA,
+						_hwscreen->w,
+						_hwscreen->h,
+						16,
+						_hwscreen->format->Rmask,
+						_hwscreen->format->Gmask,
+						_hwscreen->format->Bmask,
+						_hwscreen->format->Amask);
+	if (_osdSurface == NULL)
+		error("allocating _osdSurface failed");
+	SDL_SetColorKey(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kOSDColorKey);
+#endif
+
+	_eventSource->resetKeyboadEmulation(
+		_videoMode.screenWidth * _videoMode.scaleFactor - 1,
+		effectiveScreenHeight() - 1);
+
+	// Distinguish 555 and 565 mode
+	if (_hwscreen->format->Rmask == 0x7C00)
+		InitScalers(555);
+	else
+		InitScalers(565);
+
+	return true;
+}
+
+void DispmanXSdlGraphicsManager::internUpdateScreen() {
+	SDL_Surface *srcSurf, *origSurf;
+	int height, width;
+	ScalerProc *scalerProc;
+	int scale1;
+
+	// If the shake position changed, fill the dirty area with blackness
+	if (_currentShakePos != _newShakePos ||
+		(_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
+		SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_newShakePos * _videoMode.scaleFactor)};
+
+		SDL_FillRect(_hwscreen, &blackrect, 0);
+
+		_currentShakePos = _newShakePos;
+
+		_forceFull = true;
+	}
+
+	// Check whether the palette was changed in the meantime and update the
+	// screen surface accordingly.
+	if (_screen && _paletteDirtyEnd != 0) {
+		SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
+			_paletteDirtyStart,
+			_paletteDirtyEnd - _paletteDirtyStart);
+
+		_paletteDirtyEnd = 0;
+
+		_forceFull = true;
+	}
+
+#ifdef USE_OSD
+	// OSD visible (i.e. non-transparent)?
+	if (_osdAlpha != SDL_ALPHA_TRANSPARENT) {
+		// Updated alpha value
+		const int diff = SDL_GetTicks() - _osdFadeStartTime;
+		if (diff > 0) {
+			if (diff >= kOSDFadeOutDuration) {
+				// Back to full transparency
+				_osdAlpha = SDL_ALPHA_TRANSPARENT;
+			} else {
+				// Do a linear fade out...
+				const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100;
+				_osdAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration;
+			}
+			SDL_SetAlpha(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdAlpha);
+			_forceFull = true;
+		}
+	}
+#endif
+
+	if (!_overlayVisible) {
+		origSurf = _screen;
+		srcSurf = _tmpscreen;
+		width = _videoMode.screenWidth;
+		height = _videoMode.screenHeight;
+		scalerProc = _scalerProc;
+		scale1 = _videoMode.scaleFactor;
+	} else {
+		origSurf = _overlayscreen;
+		srcSurf = _tmpscreen2;
+		width = _videoMode.overlayWidth;
+		height = _videoMode.overlayHeight;
+		scalerProc = Normal1x;
+
+		scale1 = 1;
+	}
+
+	// Add the area covered by the mouse cursor to the list of dirty rects if
+	// we have to redraw the mouse.
+	if (_mouseNeedsRedraw)
+		undrawMouse();
+
+	// Force a full redraw if requested
+	if (_forceFull) {
+		_numDirtyRects = 1;
+		_dirtyRectList[0].x = 0;
+		_dirtyRectList[0].y = 0;
+		_dirtyRectList[0].w = width;
+		_dirtyRectList[0].h = height;
+	}
+
+	// Only draw anything if necessary
+	if (_numDirtyRects > 0 || _mouseNeedsRedraw) {
+		SDL_Rect *r;
+		SDL_Rect dst;
+		uint32 srcPitch, dstPitch;
+		SDL_Rect *lastRect = _dirtyRectList + _numDirtyRects;
+
+		for (r = _dirtyRectList; r != lastRect; ++r) {
+			dst = *r;
+			dst.x++;	// Shift rect by one since 2xSai needs to access the data around
+			dst.y++;	// any pixel to scale it, and we want to avoid mem access crashes.
+
+			if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
+				error("SDL_BlitSurface failed: %s", SDL_GetError());
+		}
+
+		SDL_LockSurface(srcSurf);
+		SDL_LockSurface(_hwscreen);
+
+		srcPitch = srcSurf->pitch;
+		dstPitch = _hwscreen->pitch;
+
+		for (r = _dirtyRectList; r != lastRect; ++r) {
+			register int dst_y = r->y + _currentShakePos;
+			register int dst_h = 0;
+			register int rx1 = r->x * scale1;
+
+			if (dst_y < height) {
+				dst_h = r->h;
+				if (dst_h > height - dst_y)
+					dst_h = height - dst_y;
+
+				dst_y = dst_y * scale1;
+
+				assert(scalerProc != NULL);
+				scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+					(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
+			}
+
+			r->x = rx1;
+			r->y = dst_y;
+			r->w = r->w * scale1;
+			r->h = dst_h * scale1;
+
+		}
+		SDL_UnlockSurface(srcSurf);
+		SDL_UnlockSurface(_hwscreen);
+
+		// Readjust the dirty rect list in case we are doing a full update.
+		// This is necessary if shaking is active.
+		if (_forceFull) {
+			_dirtyRectList[0].y = 0;
+			_dirtyRectList[0].h = effectiveScreenHeight();
+		}
+
+		drawMouse();
+
+#ifdef USE_OSD
+		if (_osdAlpha != SDL_ALPHA_TRANSPARENT) {
+			SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0);
+		}
+#endif
+		// Finally, blit all our changes to the screen
+		if (!_displayDisabled) {
+			SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
+			DispmanXUpdate();
+		}
+	}
+
+	_numDirtyRects = 0;
+	_forceFull = false;
+	_mouseNeedsRedraw = false;
+}
+
+bool DispmanXSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
+
+	// Ctrl-Alt-a toggles aspect ratio correction
+	if (key == 'a') {
+		beginGFXTransaction();
+			setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_dispvars->aspectRatioCorrection);
+		endGFXTransaction();
+#ifdef USE_OSD
+		char buffer[128];
+		if (_dispvars->aspectRatioCorrection)
+			sprintf(buffer, "%s", ("Enabled aspect ratio correction"));
+		else
+			sprintf(buffer, "%s", ("Disabled aspect ratio correction"));
+		displayMessageOnOSD(buffer);
+#endif
+		internUpdateScreen();
+		return true;
+	}
+
+	return true;
+}
+
+void DispmanXSdlGraphicsManager::setFullscreenMode(bool enable) {
+	_videoMode.fullscreen = enable;
+	return;
+}
+
+void DispmanXSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
+	Common::StackLock lock(_graphicsMutex);
+	// Ratio correction is managed externally by dispmanx, so we disable it at the SDL level but take note,
+	// so it's effectively taken into account at the dispmanx level in DispmanXSetup().
+	if (_oldVideoMode.setup && _dispvars->aspectRatioCorrection == enable)
+		return;
+	
+	if (_transactionMode == kTransactionActive) {
+		_dispvars->aspectRatioCorrection = enable;
+		_transactionDetails.needHotswap = false;
+		DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight, 16);	
+	}
+}
+
+#endif
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
new file mode 100644
index 0000000..ff38283
--- /dev/null
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_SDL_DISPMANX_H
+#define BACKENDS_GRAPHICS_SDL_DISPMANX_H
+
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
+
+struct dispvarsStruct;
+
+class DispmanXSdlGraphicsManager : public SurfaceSdlGraphicsManager {
+public:
+	DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource);
+	~DispmanXSdlGraphicsManager(); 
+	bool loadGFXMode();
+	void internUpdateScreen();
+	bool handleScalerHotkeys(Common::KeyCode key);
+	void setFullscreenMode(bool enable);
+	void setAspectRatioCorrection(bool enable);
+protected:	
+	// Raspberry Pi Dispmanx API
+	void DispmanXSetup(int width, int height, int bpp);
+	void DispmanXInit();
+	void DispmanXUpdate();
+	void DispmanXFreeResources(void);
+	void DispmanXVideoQuit();
+	struct dispvarsStruct *_dispvars;
+};
+
+#endif /* BACKENDS_GRAPHICS_SDL_DISPMANX_H */
diff --git a/backends/module.mk b/backends/module.mk
index 34e2928..645b5ed 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -193,6 +193,11 @@ MODULE_OBJS += \
 	timer/psp/timer.o
 endif
 
+ifeq ($(BACKEND),raspberrypi)
+MODULE_OBJS += \
+	graphics/dispmanxsdl/dispmanxsdl-graphics.o
+endif
+
 ifeq ($(BACKEND),samsungtv)
 MODULE_OBJS += \
 	events/samsungtvsdl/samsungtvsdl-events.o \
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index a17a326..d87ec6b 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -34,6 +34,12 @@ MODULE_OBJS += \
 	ps3/ps3.o
 endif
 
+ifdef RASPBERRYPI
+MODULE_OBJS += \
+	raspberrypi/raspberrypi-main.o \
+	raspberrypi/raspberrypi.o
+endif
+
 # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
 MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
 OBJS := $(MODULE_OBJS) $(OBJS)
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index d07db11..0785f36 100644
--- a/backends/platform/sdl/posix/posix-main.cpp
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -22,7 +22,7 @@
 
 #include "common/scummsys.h"
 
-#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3)
+#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(RASPBERRYPI)
 
 #include "backends/platform/sdl/posix/posix.h"
 #include "backends/plugins/sdl/sdl-provider.h"
diff --git a/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp b/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
new file mode 100644
index 0000000..7d2eff9
--- /dev/null
+++ b/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "backends/platform/sdl/raspberrypi/raspberrypi.h"
+#include "backends/plugins/sdl/sdl-provider.h"
+#include "common/scummsys.h"
+#include "base/main.h"
+
+#if defined(RASPBERRYPI)
+int main(int argc, char* argv[]) {
+	
+	// Create our OSystem instance
+	g_system = new OSystem_SDL_RaspberryPi();
+	assert(g_system);
+
+	// Pre initialize the backend
+	((OSystem_SDL_RaspberryPi *)g_system)->init();
+
+#ifdef DYNAMIC_MODULES
+	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+#endif
+
+	// Invoke the actual ScummVM main entry point:
+	int res = scummvm_main(argc, argv);
+
+	// Free OSystem
+	delete (OSystem_SDL_RaspberryPi *)g_system;
+
+	return res;
+}
+
+#endif
diff --git a/backends/platform/sdl/raspberrypi/raspberrypi.cpp b/backends/platform/sdl/raspberrypi/raspberrypi.cpp
new file mode 100644
index 0000000..2405dfa
--- /dev/null
+++ b/backends/platform/sdl/raspberrypi/raspberrypi.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if defined(RASPBERRYPI)
+
+#include "backends/platform/sdl/raspberrypi/raspberrypi.h"
+#include "backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h"
+
+void OSystem_SDL_RaspberryPi::initBackend() {
+	// Create the events manager
+	if (_eventSource == 0)
+		_eventSource = new SdlEventSource();
+
+	// Create the graphics manager
+	if (_graphicsManager == 0) {
+		_graphicsManager = new DispmanXSdlGraphicsManager(_eventSource);
+	}
+
+	// Call parent implementation of this method
+	OSystem_POSIX::initBackend();
+}
+
+#endif
diff --git a/backends/platform/sdl/raspberrypi/raspberrypi.h b/backends/platform/sdl/raspberrypi/raspberrypi.h
new file mode 100644
index 0000000..b8070e8
--- /dev/null
+++ b/backends/platform/sdl/raspberrypi/raspberrypi.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SDL_RASPBERRYPI_COMMON_H
+#define SDL_RASPBERRYPI_COMMON_H
+
+#if defined(RASPBERRYPI)
+#include "backends/platform/sdl/posix/posix.h"
+
+class OSystem_SDL_RaspberryPi : public OSystem_POSIX {
+public:
+	void initBackend();
+};
+
+#endif /* RASPBERRYPI */
+#endif /* SDL_RASPBERRYPI_COMMON_H */
diff --git a/configure b/configure
index 7c4c87e..a5bb1e6 100755
--- a/configure
+++ b/configure
@@ -824,7 +824,7 @@ Configuration:
   -h, --help              display this help and exit
   --backend=BACKEND       backend to build (android, tizen, dc, dingux, ds, gcw0,
                           gph, iphone, linuxmoto, maemo, n64, null, openpandora,
-                          ps2, psp, samsungtv, sdl, webos, wii, wince) [sdl]
+                          ps2, psp, raspberrypi, samsungtv, sdl, webos, wii, wince) [sdl]
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -2980,6 +2980,33 @@ case $_backend in
 		LIBS="$LIBS -lpng"
 		LIBS="$LIBS -Wl,-Map,mapfile.txt"
 		;;
+	raspberrypi)
+		_use_dispmanx=no
+		DISPMANX_CXXFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux/ -I/opt/vc/include/interface/vcos/pthreads -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s"
+		DISPMANX_LIBS="-L/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
+		cat > $TMPC << EOF
+#include <bcm_host.h>
+
+		int main(int argc, char *argv[]) {
+	bcm_host_init();
+}
+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"
+			DEFINES="$DEFINES -DRASPBERRYPI"
+			add_line_to_config_mk 'RASPBERRYPI = 1'
+			_build_scalers=no
+			_build_hq_scalers=no	
+			_opengl=no
+			_default_optimization_level=-O3
+		else
+			echo "Can't activate DispmanX context (missing headers?)."		
+		fi
+		;;
 	samsungtv)
 		DEFINES="$DEFINES -DSAMSUNGTV"
 		LDFLAGS="$LDFLAGS -shared"
@@ -3046,7 +3073,7 @@ MODULES="$MODULES backends/platform/$_backend"
 # Setup SDL specifics for SDL based backends
 #
 case $_backend in
-	dingux | gph | linuxmoto | maemo | openpandora | samsungtv | sdl)
+	dingux | gph | linuxmoto | maemo | openpandora | raspberrypi | samsungtv | sdl)
 		find_sdlconfig
 		INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
 		LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"


Commit: b4f5dc181ef025b5a68a7fb9761f8bc3b130aec4
    https://github.com/scummvm/scummvm/commit/b4f5dc181ef025b5a68a7fb9761f8bc3b130aec4
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-03-29T21:53:10+02:00

Commit Message:
RASPBERRYPI: Updated dispmanx code with non-blocking vsync and triple buffer

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 03a10f1..4bfce88 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -38,7 +38,7 @@ struct dispvarsStruct {
 	DISPMANX_DISPLAY_HANDLE_T display;
 	DISPMANX_MODEINFO_T amode;
 	DISPMANX_UPDATE_HANDLE_T update;
-	DISPMANX_RESOURCE_HANDLE_T resources[2];
+	DISPMANX_RESOURCE_HANDLE_T resources[3];
 	DISPMANX_ELEMENT_HANDLE_T element;
 	VC_IMAGE_TYPE_T pixFormat;
 	VC_DISPMANX_ALPHA_T *alpha;    
@@ -51,6 +51,23 @@ struct dispvarsStruct {
 	uint flipPage;
 	bool aspectRatioCorrection;
 	void *pixmem;
+	
+	struct dispmanxPage *pages;
+	struct dispmanxPage *currentPage;
+	int pageflipPending;
+
+	pthread_cond_t vsync_condition;	
+	pthread_mutex_t pending_mutex;
+	pthread_mutex_t page_use_mutex;
+
+	// Mutex to isolate the vsync condition signaling
+	pthread_mutex_t vsync_cond_mutex;
+};
+
+struct dispmanxPage {
+	unsigned int numpage;
+	struct dispvarsStruct *dispvars;
+	bool used;
 };
 
 DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource)
@@ -67,8 +84,23 @@ DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager()
 
 void DispmanXSdlGraphicsManager::DispmanXInit () {
 	_dispvars->screen = 0;
-        _dispvars->flipPage = 0;
 	_dispvars->vcImagePtr = 0;
+	_dispvars->pages = (struct dispmanxPage*)calloc(3, sizeof(struct dispmanxPage));
+	_dispvars->pageflipPending = 0;	
+	_dispvars->currentPage = NULL;
+
+	// Initialize mutex and condition variable objects
+	pthread_mutex_init(&_dispvars->pending_mutex, NULL);
+	pthread_mutex_init(&_dispvars->page_use_mutex, NULL);
+	pthread_mutex_init(&_dispvars->vsync_cond_mutex, NULL);
+	pthread_cond_init(&_dispvars->vsync_condition, NULL);
+	
+	int i;
+	for (i = 0; i < 3; i++) {
+		_dispvars->pages[i].numpage = i;
+		_dispvars->pages[i].used = false;
+		_dispvars->pages[i].dispvars = _dispvars;
+	}
 	
 	// Before we call any vc_* function, we need to call this one.
 	bcm_host_init();
@@ -110,38 +142,106 @@ 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);	
 
-	// We create two resources for double buffering
+	// We create three resources for triple buffering
 	_dispvars->resources[0] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
 		&(_dispvars->vcImagePtr));
 	
 	_dispvars->resources[1] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height,
 		&(_dispvars->vcImagePtr));
 	
+	_dispvars->resources[2] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
+		&(_dispvars->vcImagePtr));
+	
 	// Add element
 	_dispvars->update = vc_dispmanx_update_start(0);
 	
 	_dispvars->element = vc_dispmanx_element_add(_dispvars->update, _dispvars->display, 0,
-		&(_dispvars->dstRect), _dispvars->resources[_dispvars->flipPage], &(_dispvars->srcRect), 
+		&(_dispvars->dstRect), _dispvars->resources[0], &(_dispvars->srcRect), 
 		DISPMANX_PROTECTION_NONE, _dispvars->alpha, 0, (DISPMANX_TRANSFORM_T)0);
 	
 	vc_dispmanx_update_submit_sync(_dispvars->update);		
 }
 
+// Find a free page, and return the page. If no free page is available when called, wait for a page flip.
+struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage()
+{
+	struct dispmanxPage *page = NULL;
+	unsigned i;
+	while (page == NULL) {
+		// Try to find a free page
+		for (i = 0; i < 3; ++i) {
+			if (!_dispvars->pages[i].used) {
+				page = (_dispvars->pages) + i;
+				break;
+			}
+		}
+		// If no page is free ATM, wait until a free page is freed by vsync CB
+		if (page == NULL) {
+			pthread_mutex_lock(&_dispvars->vsync_cond_mutex);
+			pthread_cond_wait(&_dispvars->vsync_condition, &_dispvars->vsync_cond_mutex);
+			pthread_mutex_unlock(&_dispvars->vsync_cond_mutex);
+		}
+	}
+	pthread_mutex_lock(&_dispvars->page_use_mutex);
+	page->used = true;
+	pthread_mutex_unlock(&_dispvars->page_use_mutex);
+	return page;
+}
+
 void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
-	vc_dispmanx_resource_write_data(_dispvars->resources[_dispvars->flipPage], _dispvars->pixFormat,
+	// Triple buffer update function //
+	struct dispmanxPage *page;
+      	page = DispmanXGetFreePage();
+	
+	// Frame blitting
+	vc_dispmanx_resource_write_data(_dispvars->resources[page->numpage], _dispvars->pixFormat,
 		_dispvars->pitch, _dispvars->pixmem, &(_dispvars->bmpRect));
 	
-	// Update starts
+	// Page flipping: we send the page to the dispmanx API internal flipping FIFO stack. 
+	DispmanXFlip(page);
+}
+
+void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
+	struct dispmanxPage *page = (struct dispmanxPage *) arg;
+
+	// We signal the vsync condition, just in case we're waiting for it somewhere (no free pages, etc)
+	pthread_mutex_lock(&page->dispvars->vsync_cond_mutex);
+	pthread_cond_signal(&page->dispvars->vsync_condition);
+	pthread_mutex_unlock(&page->dispvars->vsync_cond_mutex);
+
+	pthread_mutex_lock(&page->dispvars->pending_mutex);
+	page->dispvars->pageflipPending--;	
+	pthread_mutex_unlock(&page->dispvars->pending_mutex);
+		
+	// We mark as free the page that was visible until now
+	if (page->dispvars->currentPage != NULL) {
+		pthread_mutex_lock(&page->dispvars->page_use_mutex);
+		page->dispvars->currentPage->used = false;
+		pthread_mutex_unlock(&page->dispvars->page_use_mutex);
+	}
+	
+	// The page on which we just issued the flip that caused this callback becomes the visible one
+	page->dispvars->currentPage = page;
+}
+
+void DispmanXSdlGraphicsManager::DispmanXFlip (struct dispmanxPage *page) {
+	// We don't queue multiple page flips.
+	if (_dispvars->pageflipPending > 0) {
+		pthread_mutex_lock(&_dispvars->vsync_cond_mutex);
+		pthread_cond_wait(&_dispvars->vsync_condition, &_dispvars->vsync_cond_mutex);
+		pthread_mutex_unlock(&_dispvars->vsync_cond_mutex);
+	}
+
+	// Issue a page flip at the next vblank interval (will be done at vsync anyway).
 	_dispvars->update = vc_dispmanx_update_start(0);
 
 	vc_dispmanx_element_change_source(_dispvars->update, _dispvars->element,
-		_dispvars->resources[_dispvars->flipPage]);
-	
-	vc_dispmanx_update_submit_sync(_dispvars->update);		
-	// Update ends
+		_dispvars->resources[page->numpage]);
+	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, page);
 	
-	_dispvars->flipPage = !_dispvars->flipPage;
-	return;
+	pthread_mutex_lock(&_dispvars->pending_mutex);
+	_dispvars->pageflipPending++;	
+	pthread_mutex_unlock(&_dispvars->pending_mutex);
 }
 
 void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
@@ -149,6 +249,7 @@ void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
 		
     	vc_dispmanx_resource_delete(_dispvars->resources[0]);
     	vc_dispmanx_resource_delete(_dispvars->resources[1]);
+    	vc_dispmanx_resource_delete(_dispvars->resources[2]);
 	vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
 	
 	vc_dispmanx_update_submit_sync(_dispvars->update);		
@@ -156,8 +257,17 @@ void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
 
 void DispmanXSdlGraphicsManager::DispmanXVideoQuit() {
 	DispmanXFreeResources();
+	// Close display and deinit 
 	vc_dispmanx_display_close(_dispvars->display);
 	bcm_host_deinit();
+
+	// Destroy mutexes and conditions	
+	pthread_mutex_destroy(&_dispvars->pending_mutex);
+	pthread_mutex_destroy(&_dispvars->page_use_mutex);
+	pthread_mutex_destroy(&_dispvars->vsync_cond_mutex);
+	pthread_cond_destroy(&_dispvars->vsync_condition);		
+	
+	free(_dispvars->pages);
 }
 
 bool DispmanXSdlGraphicsManager::loadGFXMode() {
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index ff38283..be111af 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -26,6 +26,9 @@
 #include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
 
 struct dispvarsStruct;
+struct dispmanxPage;
+
+typedef uint32_t DISPMANX_UPDATE_HANDLE_T;
 
 class DispmanXSdlGraphicsManager : public SurfaceSdlGraphicsManager {
 public:
@@ -41,7 +44,10 @@ protected:
 	void DispmanXSetup(int width, int height, int bpp);
 	void DispmanXInit();
 	void DispmanXUpdate();
-	void DispmanXFreeResources(void);
+	void DispmanXFlip(struct dispmanxPage *page);
+	//void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg);
+	struct dispmanxPage *DispmanXGetFreePage();
+	void DispmanXFreeResources();
 	void DispmanXVideoQuit();
 	struct dispvarsStruct *_dispvars;
 };


Commit: f876fdc7f02c191afb707f2952cbdd703c7d6360
    https://github.com/scummvm/scummvm/commit/f876fdc7f02c191afb707f2952cbdd703c7d6360
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-03-29T21:53:21+02:00

Commit Message:
RASPBERRYPI: fixed some comments and spacing on the dispmanx graphics driver

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 4bfce88..d2615ad 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -189,7 +189,7 @@ struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage()
 }
 
 void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
-	// Triple buffer update function //
+	// Triple buffer update function
 	struct dispmanxPage *page;
       	page = DispmanXGetFreePage();
 	
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index be111af..b10a158 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -45,7 +45,6 @@ protected:
 	void DispmanXInit();
 	void DispmanXUpdate();
 	void DispmanXFlip(struct dispmanxPage *page);
-	//void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg);
 	struct dispmanxPage *DispmanXGetFreePage();
 	void DispmanXFreeResources();
 	void DispmanXVideoQuit();


Commit: 0855b41c0786cdb6bfb89cd2d90bfcc74f4d0c36
    https://github.com/scummvm/scummvm/commit/0855b41c0786cdb6bfb89cd2d90bfcc74f4d0c36
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-20T17:11:47+02:00

Commit Message:
RASPBERRYPI: Fixed variable names, removed gcc optimization flags, temporary decrease buffers to 2.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index d2615ad..d67cb90 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -34,11 +34,13 @@
 
 #include <bcm_host.h>
 
+#define numpages 2
+
 struct dispvarsStruct { 
 	DISPMANX_DISPLAY_HANDLE_T display;
 	DISPMANX_MODEINFO_T amode;
 	DISPMANX_UPDATE_HANDLE_T update;
-	DISPMANX_RESOURCE_HANDLE_T resources[3];
+	DISPMANX_RESOURCE_HANDLE_T resources[numpages];
 	DISPMANX_ELEMENT_HANDLE_T element;
 	VC_IMAGE_TYPE_T pixFormat;
 	VC_DISPMANX_ALPHA_T *alpha;    
@@ -56,17 +58,17 @@ struct dispvarsStruct {
 	struct dispmanxPage *currentPage;
 	int pageflipPending;
 
-	pthread_cond_t vsync_condition;	
-	pthread_mutex_t pending_mutex;
-	pthread_mutex_t page_use_mutex;
+	pthread_cond_t vsyncCondition;	
+	pthread_mutex_t pendingMutex;
 
 	// Mutex to isolate the vsync condition signaling
-	pthread_mutex_t vsync_cond_mutex;
+	pthread_mutex_t vsyncCondMutex;
 };
 
 struct dispmanxPage {
 	unsigned int numpage;
 	struct dispvarsStruct *dispvars;
+	pthread_mutex_t pageUseMutex;
 	bool used;
 };
 
@@ -85,23 +87,26 @@ DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager()
 void DispmanXSdlGraphicsManager::DispmanXInit () {
 	_dispvars->screen = 0;
 	_dispvars->vcImagePtr = 0;
-	_dispvars->pages = (struct dispmanxPage*)calloc(3, sizeof(struct dispmanxPage));
+	_dispvars->pages = (struct dispmanxPage*)calloc(numpages, sizeof(struct dispmanxPage));
 	_dispvars->pageflipPending = 0;	
 	_dispvars->currentPage = NULL;
 
 	// Initialize mutex and condition variable objects
-	pthread_mutex_init(&_dispvars->pending_mutex, NULL);
-	pthread_mutex_init(&_dispvars->page_use_mutex, NULL);
-	pthread_mutex_init(&_dispvars->vsync_cond_mutex, NULL);
-	pthread_cond_init(&_dispvars->vsync_condition, NULL);
+	pthread_mutex_init(&_dispvars->pendingMutex, NULL);
+	pthread_mutex_init(&_dispvars->vsyncCondMutex, NULL);
+	pthread_cond_init(&_dispvars->vsyncCondition, NULL);
 	
 	int i;
-	for (i = 0; i < 3; i++) {
+	for (i = 0; i < numpages; i++) {
 		_dispvars->pages[i].numpage = i;
 		_dispvars->pages[i].used = false;
 		_dispvars->pages[i].dispvars = _dispvars;
 	}
 	
+	for (i = 0; i < numpages; i++) {
+		pthread_mutex_init(&_dispvars->pages[i].pageUseMutex, NULL);
+	}	
+	
 	// Before we call any vc_* function, we need to call this one.
 	bcm_host_init();
 	
@@ -142,15 +147,11 @@ 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);	
 
-	// We create three resources for triple buffering
-	_dispvars->resources[0] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
-		&(_dispvars->vcImagePtr));
-	
-	_dispvars->resources[1] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height,
-		&(_dispvars->vcImagePtr));
-	
-	_dispvars->resources[2] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
-		&(_dispvars->vcImagePtr));
+	// We create the resources for multiple buffering
+	int i;
+	for (i = 0; i < numpages; i++)
+		_dispvars->resources[i] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
+			&(_dispvars->vcImagePtr));
 	
 	// Add element
 	_dispvars->update = vc_dispmanx_update_start(0);
@@ -169,7 +170,7 @@ struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage()
 	unsigned i;
 	while (page == NULL) {
 		// Try to find a free page
-		for (i = 0; i < 3; ++i) {
+		for (i = 0; i < numpages; ++i) {
 			if (!_dispvars->pages[i].used) {
 				page = (_dispvars->pages) + i;
 				break;
@@ -177,14 +178,14 @@ struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage()
 		}
 		// If no page is free ATM, wait until a free page is freed by vsync CB
 		if (page == NULL) {
-			pthread_mutex_lock(&_dispvars->vsync_cond_mutex);
-			pthread_cond_wait(&_dispvars->vsync_condition, &_dispvars->vsync_cond_mutex);
-			pthread_mutex_unlock(&_dispvars->vsync_cond_mutex);
+			pthread_mutex_lock(&_dispvars->vsyncCondMutex);
+			pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->vsyncCondMutex);
+			pthread_mutex_unlock(&_dispvars->vsyncCondMutex);
 		}
 	}
-	pthread_mutex_lock(&_dispvars->page_use_mutex);
+	pthread_mutex_lock(&page->pageUseMutex);
 	page->used = true;
-	pthread_mutex_unlock(&_dispvars->page_use_mutex);
+	pthread_mutex_unlock(&page->pageUseMutex);
 	return page;
 }
 
@@ -205,19 +206,19 @@ void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
 	struct dispmanxPage *page = (struct dispmanxPage *) arg;
 
 	// We signal the vsync condition, just in case we're waiting for it somewhere (no free pages, etc)
-	pthread_mutex_lock(&page->dispvars->vsync_cond_mutex);
-	pthread_cond_signal(&page->dispvars->vsync_condition);
-	pthread_mutex_unlock(&page->dispvars->vsync_cond_mutex);
+	pthread_mutex_lock(&page->dispvars->vsyncCondMutex);
+	pthread_cond_signal(&page->dispvars->vsyncCondition);
+	pthread_mutex_unlock(&page->dispvars->vsyncCondMutex);
 
-	pthread_mutex_lock(&page->dispvars->pending_mutex);
+	pthread_mutex_lock(&page->dispvars->pendingMutex);
 	page->dispvars->pageflipPending--;	
-	pthread_mutex_unlock(&page->dispvars->pending_mutex);
+	pthread_mutex_unlock(&page->dispvars->pendingMutex);
 		
 	// We mark as free the page that was visible until now
 	if (page->dispvars->currentPage != NULL) {
-		pthread_mutex_lock(&page->dispvars->page_use_mutex);
+		pthread_mutex_lock(&page->pageUseMutex);
 		page->dispvars->currentPage->used = false;
-		pthread_mutex_unlock(&page->dispvars->page_use_mutex);
+		pthread_mutex_unlock(&page->pageUseMutex);
 	}
 	
 	// The page on which we just issued the flip that caused this callback becomes the visible one
@@ -225,11 +226,11 @@ void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
 }
 
 void DispmanXSdlGraphicsManager::DispmanXFlip (struct dispmanxPage *page) {
-	// We don't queue multiple page flips.
+	// We don't queue multiple page flips because dispmanx doesn't support it.
 	if (_dispvars->pageflipPending > 0) {
-		pthread_mutex_lock(&_dispvars->vsync_cond_mutex);
-		pthread_cond_wait(&_dispvars->vsync_condition, &_dispvars->vsync_cond_mutex);
-		pthread_mutex_unlock(&_dispvars->vsync_cond_mutex);
+		pthread_mutex_lock(&_dispvars->vsyncCondMutex);
+		pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->vsyncCondMutex);
+		pthread_mutex_unlock(&_dispvars->vsyncCondMutex);
 	}
 
 	// Issue a page flip at the next vblank interval (will be done at vsync anyway).
@@ -239,17 +240,18 @@ void DispmanXSdlGraphicsManager::DispmanXFlip (struct dispmanxPage *page) {
 		_dispvars->resources[page->numpage]);
 	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, page);
 	
-	pthread_mutex_lock(&_dispvars->pending_mutex);
+	pthread_mutex_lock(&_dispvars->pendingMutex);
 	_dispvars->pageflipPending++;	
-	pthread_mutex_unlock(&_dispvars->pending_mutex);
+	pthread_mutex_unlock(&_dispvars->pendingMutex);
 }
 
 void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
+	int i;
 	_dispvars->update = vc_dispmanx_update_start(0);
 		
-    	vc_dispmanx_resource_delete(_dispvars->resources[0]);
-    	vc_dispmanx_resource_delete(_dispvars->resources[1]);
-    	vc_dispmanx_resource_delete(_dispvars->resources[2]);
+    	for (i = 0; i < numpages; i++)
+		vc_dispmanx_resource_delete(_dispvars->resources[i]);
+	
 	vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
 	
 	vc_dispmanx_update_submit_sync(_dispvars->update);		
@@ -262,11 +264,15 @@ void DispmanXSdlGraphicsManager::DispmanXVideoQuit() {
 	bcm_host_deinit();
 
 	// Destroy mutexes and conditions	
-	pthread_mutex_destroy(&_dispvars->pending_mutex);
-	pthread_mutex_destroy(&_dispvars->page_use_mutex);
-	pthread_mutex_destroy(&_dispvars->vsync_cond_mutex);
-	pthread_cond_destroy(&_dispvars->vsync_condition);		
-	
+	pthread_mutex_destroy(&_dispvars->pendingMutex);
+	pthread_mutex_destroy(&_dispvars->vsyncCondMutex);
+	pthread_cond_destroy(&_dispvars->vsyncCondition);		
+
+	int i;
+	for (i = 0; i < numpages; i++) {
+		pthread_mutex_destroy(&_dispvars->pages[i].pageUseMutex);
+	}	
+
 	free(_dispvars->pages);
 }
 
diff --git a/configure b/configure
index a5bb1e6..0edbe90 100755
--- a/configure
+++ b/configure
@@ -2982,7 +2982,7 @@ case $_backend in
 		;;
 	raspberrypi)
 		_use_dispmanx=no
-		DISPMANX_CXXFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux/ -I/opt/vc/include/interface/vcos/pthreads -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s"
+		DISPMANX_CXXFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux/ -I/opt/vc/include/interface/vcos/pthreads -mfpu=vfp -mfloat-abi=hard"
 		DISPMANX_LIBS="-L/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
 		cat > $TMPC << EOF
 #include <bcm_host.h>


Commit: eeb9ec9af9c3b1e94d4cd5854e82ef5238f9f335
    https://github.com/scummvm/scummvm/commit/eeb9ec9af9c3b1e94d4cd5854e82ef5238f9f335
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-20T17:13:19+02:00

Commit Message:
RASPBERRYPI: Corrected redundant for loop on the dispmanx graphics driver code.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index d67cb90..08379d2 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -101,11 +101,8 @@ void DispmanXSdlGraphicsManager::DispmanXInit () {
 		_dispvars->pages[i].numpage = i;
 		_dispvars->pages[i].used = false;
 		_dispvars->pages[i].dispvars = _dispvars;
-	}
-	
-	for (i = 0; i < numpages; i++) {
 		pthread_mutex_init(&_dispvars->pages[i].pageUseMutex, NULL);
-	}	
+	}
 	
 	// Before we call any vc_* function, we need to call this one.
 	bcm_host_init();
@@ -216,9 +213,9 @@ void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
 		
 	// We mark as free the page that was visible until now
 	if (page->dispvars->currentPage != NULL) {
-		pthread_mutex_lock(&page->pageUseMutex);
+		pthread_mutex_lock(&page->dispvars->currentPage->pageUseMutex);
 		page->dispvars->currentPage->used = false;
-		pthread_mutex_unlock(&page->pageUseMutex);
+		pthread_mutex_unlock(&page->dispvars->currentPage->pageUseMutex);
 	}
 	
 	// The page on which we just issued the flip that caused this callback becomes the visible one


Commit: d5862217c3a85e7bc5a148def238c3323991adf8
    https://github.com/scummvm/scummvm/commit/d5862217c3a85e7bc5a148def238c3323991adf8
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-20T17:13:19+02:00

Commit Message:
RASPBERRYPI: Fixed cross-compilation.

Changed paths:
    configure



diff --git a/configure b/configure
index 0edbe90..ec45fd4 100755
--- a/configure
+++ b/configure
@@ -856,6 +856,7 @@ Special configuration feature:
                                            tizen for Samsung Tizen
                                            caanoo for Caanoo
                                            dingux for Dingux
+                                           raspberrypi for Raspberry Pi
                                            dreamcast for Sega Dreamcast
                                            ds for Nintendo DS
                                            gamecube for Nintendo GameCube
@@ -1294,6 +1295,11 @@ arm-riscos)
 	_host_os=riscos
 	_host_cpu=arm
 	;;
+raspberrypi)
+	_host_os=linux
+	_host_cpu=arm
+	_host_alias=arm-linux-gnueabihf
+	;;
 caanoo)
 	_host_os=gph-linux
 	_host_cpu=arm
@@ -2982,8 +2988,8 @@ case $_backend in
 		;;
 	raspberrypi)
 		_use_dispmanx=no
-		DISPMANX_CXXFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux/ -I/opt/vc/include/interface/vcos/pthreads -mfpu=vfp -mfloat-abi=hard"
-		DISPMANX_LIBS="-L/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
+		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"
 		cat > $TMPC << EOF
 #include <bcm_host.h>
 
@@ -3073,7 +3079,7 @@ MODULES="$MODULES backends/platform/$_backend"
 # Setup SDL specifics for SDL based backends
 #
 case $_backend in
-	dingux | gph | linuxmoto | maemo | openpandora | raspberrypi | samsungtv | sdl)
+	dingux | gph | linuxmoto | maemo | openpandora | samsungtv | sdl)
 		find_sdlconfig
 		INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
 		LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
@@ -3142,7 +3148,17 @@ case $_backend in
 		;;
 esac
 
-
+#
+# In raspberry Pi, we don't use find_sdlconfig since we could be crosscompiling, but still we use SDL 
+#
+case $_backend in
+	raspberrypi)
+		INCLUDES="$INCLUDES -I$RPI_ROOTDIR/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT"
+		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"
+esac
+		
 #
 # Determine whether host is POSIX compliant, or at least POSIX
 # compatible enough to support our POSIX code (including dlsym(),


Commit: 2592c72cb59802607b97da562d4ccf369599d6b2
    https://github.com/scummvm/scummvm/commit/2592c72cb59802607b97da562d4ccf369599d6b2
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-20T17:13:19+02:00

Commit Message:
RASPBERRYPI: Rewrote buffering code of the dispmanx graphics driver for stability.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 08379d2..b3d03f6 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -40,7 +40,6 @@ struct dispvarsStruct {
 	DISPMANX_DISPLAY_HANDLE_T display;
 	DISPMANX_MODEINFO_T amode;
 	DISPMANX_UPDATE_HANDLE_T update;
-	DISPMANX_RESOURCE_HANDLE_T resources[numpages];
 	DISPMANX_ELEMENT_HANDLE_T element;
 	VC_IMAGE_TYPE_T pixFormat;
 	VC_DISPMANX_ALPHA_T *alpha;    
@@ -50,26 +49,19 @@ struct dispvarsStruct {
 	uint vcImagePtr;
 	uint screen;
 	uint pitch;
-	uint flipPage;
 	bool aspectRatioCorrection;
 	void *pixmem;
 	
 	struct dispmanxPage *pages;
-	struct dispmanxPage *currentPage;
-	int pageflipPending;
+	struct dispmanxPage *nextPage;
+	bool pageflipPending;
 
 	pthread_cond_t vsyncCondition;	
 	pthread_mutex_t pendingMutex;
-
-	// Mutex to isolate the vsync condition signaling
-	pthread_mutex_t vsyncCondMutex;
 };
 
 struct dispmanxPage {
-	unsigned int numpage;
-	struct dispvarsStruct *dispvars;
-	pthread_mutex_t pageUseMutex;
-	bool used;
+   	DISPMANX_RESOURCE_HANDLE_T resource;
 };
 
 DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource)
@@ -89,21 +81,12 @@ void DispmanXSdlGraphicsManager::DispmanXInit () {
 	_dispvars->vcImagePtr = 0;
 	_dispvars->pages = (struct dispmanxPage*)calloc(numpages, sizeof(struct dispmanxPage));
 	_dispvars->pageflipPending = 0;	
-	_dispvars->currentPage = NULL;
+	_dispvars->nextPage = &_dispvars->pages[0];
 
 	// Initialize mutex and condition variable objects
 	pthread_mutex_init(&_dispvars->pendingMutex, NULL);
-	pthread_mutex_init(&_dispvars->vsyncCondMutex, NULL);
 	pthread_cond_init(&_dispvars->vsyncCondition, NULL);
 	
-	int i;
-	for (i = 0; i < numpages; i++) {
-		_dispvars->pages[i].numpage = i;
-		_dispvars->pages[i].used = false;
-		_dispvars->pages[i].dispvars = _dispvars;
-		pthread_mutex_init(&_dispvars->pages[i].pageUseMutex, NULL);
-	}
-	
 	// Before we call any vc_* function, we need to call this one.
 	bcm_host_init();
 	
@@ -144,101 +127,64 @@ 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);	
 
-	// We create the resources for multiple buffering
 	int i;
 	for (i = 0; i < numpages; i++)
-		_dispvars->resources[i] = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
+		_dispvars->pages[i].resource = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
 			&(_dispvars->vcImagePtr));
 	
 	// Add element
 	_dispvars->update = vc_dispmanx_update_start(0);
 	
 	_dispvars->element = vc_dispmanx_element_add(_dispvars->update, _dispvars->display, 0,
-		&(_dispvars->dstRect), _dispvars->resources[0], &(_dispvars->srcRect), 
+		&(_dispvars->dstRect), _dispvars->pages[0].resource, &(_dispvars->srcRect), 
 		DISPMANX_PROTECTION_NONE, _dispvars->alpha, 0, (DISPMANX_TRANSFORM_T)0);
 	
 	vc_dispmanx_update_submit_sync(_dispvars->update);		
 }
 
-// Find a free page, and return the page. If no free page is available when called, wait for a page flip.
-struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage()
-{
-	struct dispmanxPage *page = NULL;
-	unsigned i;
-	while (page == NULL) {
-		// Try to find a free page
-		for (i = 0; i < numpages; ++i) {
-			if (!_dispvars->pages[i].used) {
-				page = (_dispvars->pages) + i;
-				break;
-			}
-		}
-		// If no page is free ATM, wait until a free page is freed by vsync CB
-		if (page == NULL) {
-			pthread_mutex_lock(&_dispvars->vsyncCondMutex);
-			pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->vsyncCondMutex);
-			pthread_mutex_unlock(&_dispvars->vsyncCondMutex);
-		}
-	}
-	pthread_mutex_lock(&page->pageUseMutex);
-	page->used = true;
-	pthread_mutex_unlock(&page->pageUseMutex);
-	return page;
-}
+void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
+	struct dispvarsStruct *_dispvars = (struct dispvarsStruct*) arg;
 
-void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
-	// Triple buffer update function
-	struct dispmanxPage *page;
-      	page = DispmanXGetFreePage();
+	// Changing the page to write must be done before the signaling
+	// so we have the right page in nextPage when update_main continues
+	if (_dispvars->nextPage == &_dispvars->pages[0])	
+	   _dispvars->nextPage = &_dispvars->pages[1];
+	else 
+	   _dispvars->nextPage = &_dispvars->pages[0];
+
+	// These two things must be isolated "atomically" to avoid getting 
+        // a false positive in the pending_mutex test in update_main.
+	pthread_mutex_lock(&_dispvars->pendingMutex);
 	
-	// Frame blitting
-	vc_dispmanx_resource_write_data(_dispvars->resources[page->numpage], _dispvars->pixFormat,
-		_dispvars->pitch, _dispvars->pixmem, &(_dispvars->bmpRect));
+	pthread_cond_signal(&_dispvars->vsyncCondition);
+	_dispvars->pageflipPending = false;	
 	
-	// Page flipping: we send the page to the dispmanx API internal flipping FIFO stack. 
-	DispmanXFlip(page);
+	pthread_mutex_unlock(&_dispvars->pendingMutex);
+		
 }
 
-void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void * arg){
-	struct dispmanxPage *page = (struct dispmanxPage *) arg;
-
-	// We signal the vsync condition, just in case we're waiting for it somewhere (no free pages, etc)
-	pthread_mutex_lock(&page->dispvars->vsyncCondMutex);
-	pthread_cond_signal(&page->dispvars->vsyncCondition);
-	pthread_mutex_unlock(&page->dispvars->vsyncCondMutex);
+void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
+	pthread_mutex_lock(&_dispvars->pendingMutex);
 
-	pthread_mutex_lock(&page->dispvars->pendingMutex);
-	page->dispvars->pageflipPending--;	
-	pthread_mutex_unlock(&page->dispvars->pendingMutex);
-		
-	// We mark as free the page that was visible until now
-	if (page->dispvars->currentPage != NULL) {
-		pthread_mutex_lock(&page->dispvars->currentPage->pageUseMutex);
-		page->dispvars->currentPage->used = false;
-		pthread_mutex_unlock(&page->dispvars->currentPage->pageUseMutex);
+	if (_dispvars->pageflipPending) {
+		pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->pendingMutex);
 	}
 	
-	// The page on which we just issued the flip that caused this callback becomes the visible one
-	page->dispvars->currentPage = page;
-}
-
-void DispmanXSdlGraphicsManager::DispmanXFlip (struct dispmanxPage *page) {
-	// We don't queue multiple page flips because dispmanx doesn't support it.
-	if (_dispvars->pageflipPending > 0) {
-		pthread_mutex_lock(&_dispvars->vsyncCondMutex);
-		pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->vsyncCondMutex);
-		pthread_mutex_unlock(&_dispvars->vsyncCondMutex);
-	}
+	pthread_mutex_unlock(&_dispvars->pendingMutex);
 
+	// Frame blitting
+	vc_dispmanx_resource_write_data(_dispvars->nextPage->resource, _dispvars->pixFormat,
+		_dispvars->pitch, _dispvars->pixmem, &(_dispvars->bmpRect));
+	
 	// Issue a page flip at the next vblank interval (will be done at vsync anyway).
 	_dispvars->update = vc_dispmanx_update_start(0);
 
 	vc_dispmanx_element_change_source(_dispvars->update, _dispvars->element,
-		_dispvars->resources[page->numpage]);
-	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, page);
+		_dispvars->nextPage->resource);
+	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, _dispvars);
 	
 	pthread_mutex_lock(&_dispvars->pendingMutex);
-	_dispvars->pageflipPending++;	
+	_dispvars->pageflipPending = true;	
 	pthread_mutex_unlock(&_dispvars->pendingMutex);
 }
 
@@ -247,7 +193,7 @@ void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
 	_dispvars->update = vc_dispmanx_update_start(0);
 		
     	for (i = 0; i < numpages; i++)
-		vc_dispmanx_resource_delete(_dispvars->resources[i]);
+		vc_dispmanx_resource_delete(_dispvars->pages[i].resource);
 	
 	vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
 	
@@ -262,14 +208,8 @@ void DispmanXSdlGraphicsManager::DispmanXVideoQuit() {
 
 	// Destroy mutexes and conditions	
 	pthread_mutex_destroy(&_dispvars->pendingMutex);
-	pthread_mutex_destroy(&_dispvars->vsyncCondMutex);
 	pthread_cond_destroy(&_dispvars->vsyncCondition);		
 
-	int i;
-	for (i = 0; i < numpages; i++) {
-		pthread_mutex_destroy(&_dispvars->pages[i].pageUseMutex);
-	}	
-
 	free(_dispvars->pages);
 }
 
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index b10a158..23a091f 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -44,8 +44,6 @@ protected:
 	void DispmanXSetup(int width, int height, int bpp);
 	void DispmanXInit();
 	void DispmanXUpdate();
-	void DispmanXFlip(struct dispmanxPage *page);
-	struct dispmanxPage *DispmanXGetFreePage();
 	void DispmanXFreeResources();
 	void DispmanXVideoQuit();
 	struct dispvarsStruct *_dispvars;


Commit: bf68de9aa7c3131ffac65b15d5e971788c7fe9c9
    https://github.com/scummvm/scummvm/commit/bf68de9aa7c3131ffac65b15d5e971788c7fe9c9
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-20T17:13:19+02:00

Commit Message:
RASPBERRYPI: Changed the RGB code for the game screen surface and added RaspberryPi information file.

Changed paths:
  A backends/platform/sdl/raspberrypi/README.RASPBERRYPI
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
    configure
    ports.mk



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index b3d03f6..f2df0e0 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 23a091f..a5abb86 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 0000000..f714380
--- /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 ec45fd4..92aa145 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 fdab7e2..c31a523 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


Commit: 6320a008ec27499b3174cd2ea8b3926a59f2e117
    https://github.com/scummvm/scummvm/commit/6320a008ec27499b3174cd2ea8b3926a59f2e117
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-20T17:15:04+02:00

Commit Message:
SDL/DISPMANX: Updated rendering code for better buffers management.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index f2df0e0..af48fce 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -34,180 +34,277 @@
 
 #include <bcm_host.h>
 
-#define NUMPAGES 2
-
 struct dispvarsStruct { 
 	DISPMANX_DISPLAY_HANDLE_T display;
-	DISPMANX_MODEINFO_T amode;
 	DISPMANX_UPDATE_HANDLE_T update;
 	DISPMANX_ELEMENT_HANDLE_T element;
 	VC_IMAGE_TYPE_T pixFormat;
-	VC_DISPMANX_ALPHA_T *alpha;    
-	VC_RECT_T srcRect;
-	VC_RECT_T dstRect; 
+	VC_DISPMANX_ALPHA_T alpha;    
+
 	VC_RECT_T bmpRect;
-	uint vcImagePtr;
-	uint screen;
-	uint pitch;
+	VC_RECT_T srcRect;
+	VC_RECT_T dstRect;
+	uint32_t vcImagePtr;
+	int screen;
+	int pitch;
+	unsigned int dispmanxWidth;
+	unsigned int dispmanxHeight;
 	bool aspectRatioCorrection;
 	void *pixmem;
-	
+
+	int numpages;	
 	struct dispmanxPage *pages;
-	struct dispmanxPage *nextPage;
-	bool pageflipPending;
+	struct dispmanxPage *currentPage;
+	int pageflipPending;
 
 	pthread_cond_t vsyncCondition;	
+	pthread_mutex_t vsyncCondMutex;	
 	pthread_mutex_t pendingMutex;
+
+	SDL_Surface *fscreen;
 };
 
 struct dispmanxPage {
-   	DISPMANX_RESOURCE_HANDLE_T resource;
+	DISPMANX_RESOURCE_HANDLE_T resource;
+	bool used;
+	// Each page has it's own mutex for
+	// isolating the access to it's "used" flag.
+	pthread_mutex_t pageUsedMutex;
+
+	// This field will allow us to access the 
+	// main dispvars struct, for the vsync cb.
+	struct dispvarsStruct *dispvars;	
 };
 
 DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource)
  : SurfaceSdlGraphicsManager(sdlEventSource) {
-	_dispvars = new dispvarsStruct;
+	_dispvars = new(dispvarsStruct);
 	DispmanXInit();
 }
 
 DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager() {
 	DispmanXVideoQuit();
-	delete _dispvars;
+	delete(_dispvars);
 }
 
 void DispmanXSdlGraphicsManager::DispmanXInit() {
 	_dispvars->screen = 0;
 	_dispvars->vcImagePtr = 0;
-	_dispvars->pages = (struct dispmanxPage *)calloc(NUMPAGES, sizeof(struct dispmanxPage));
+	_dispvars->numpages = 3;
+	_dispvars->pages = (struct dispmanxPage *)calloc(_dispvars->numpages, sizeof(struct dispmanxPage));
 	_dispvars->pageflipPending = 0;	
-	_dispvars->nextPage = &_dispvars->pages[0];
+	_dispvars->currentPage = NULL;
+	_dispvars->pixFormat = VC_IMAGE_RGB565;
+	
+	/* Transparency disabled */
+	_dispvars->alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
+	_dispvars->alpha.opacity = 255;
+	_dispvars->alpha.mask = 0;
+	_dispvars->element = 0;
+
+	// Init each page's variables
+	for (int i = 0; i < _dispvars->numpages; i++) {
+		_dispvars->pages[i].used = false;   
+		_dispvars->pages[i].dispvars = _dispvars;   
+		_dispvars->pages[i].resource = 0;
+		pthread_mutex_init(&_dispvars->pages[i].pageUsedMutex, NULL); 
+	}
 
-	// Initialize mutex and condition variable objects
-	pthread_mutex_init(&_dispvars->pendingMutex, NULL);
+	// Initialize the other mutex and condition variables
 	pthread_cond_init(&_dispvars->vsyncCondition, NULL);
+	pthread_mutex_init(&_dispvars->pendingMutex, NULL);
+	pthread_mutex_init(&_dispvars->vsyncCondMutex, NULL);
 	
 	// Before we call any vc_* function, we need to call this one.
 	bcm_host_init();
 	
 	_dispvars->display = vc_dispmanx_display_open(_dispvars->screen);
-}
+	graphics_get_display_size(_dispvars->display, &_dispvars->dispmanxWidth, &_dispvars->dispmanxHeight);
 
-void DispmanXSdlGraphicsManager::DispmanXSetup(int width, int height, int bpp) {
-	DispmanXFreeResources();
-	vc_dispmanx_display_get_info(_dispvars->display, &_dispvars->amode);
+	// We need this so SDL_SetVideoMode() is called once.
+	_dispvars->fscreen = NULL;
+}
 
-	_dispvars->pitch = width * (bpp / 8);
-	_dispvars->pixFormat = VC_IMAGE_RGB565;	       
+void DispmanXSdlGraphicsManager::DispmanXSetup(int srcWidth, int srcHeight) {
+	unsigned int dstWidth, dstHeight, dstXpos, dstYpos;
 
-	// Transparency disabled
-	VC_DISPMANX_ALPHA_T layerAlpha;    
-	layerAlpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
-	layerAlpha.opacity = 255;
-	layerAlpha.mask = 0;
-	_dispvars->alpha = &layerAlpha;	
+	// If we have an element, we have to free it along with it's resources.
+	if (_dispvars->element) {
+		DispmanXFreeResources();
+	}
 
+	// We do this for 2 bytes per pixel which is default on the Rpi.
+	_dispvars->pitch  = srcWidth * 2;
 	if (_dispvars->aspectRatioCorrection) {
-		float orig_ratio = ((float)width / (float)height); 
-		int dst_width = _dispvars->amode.height * orig_ratio;	
-		
-		// If we obtain an scaled image width that is bigger than the physical screen width,
-		// then we keep the physical screen width as our maximun width.	
-		if (dst_width > _dispvars->amode.width) 
-			dst_width = _dispvars->amode.width;
-		int dst_ypos  = (_dispvars->amode.width - dst_width) / 2; 
-		vc_dispmanx_rect_set(&(_dispvars->dstRect), dst_ypos, 0, 
-	   		dst_width, _dispvars->amode.height);
+		float aspect = ((float)srcWidth / (float)srcHeight);
+		dstWidth  = _dispvars->dispmanxHeight * aspect;	
 	} else {
-		vc_dispmanx_rect_set(&(_dispvars->dstRect), 0, 0, 
-	   		_dispvars->amode.width, _dispvars->amode.height);
+		dstWidth  = _dispvars->dispmanxWidth;	
+	}
+	dstHeight = _dispvars->dispmanxHeight;
+	
+	// If we obtain a scaled image width that is bigger than the physical screen width,
+	// then we keep the physical screen width as our maximun width.
+	if (dstWidth > _dispvars->dispmanxWidth) {
+		dstWidth = _dispvars->dispmanxWidth;
 	}
 
-	// We configure the rects now	
-	vc_dispmanx_rect_set(&(_dispvars->bmpRect), 0, 0, width, height);	
-	vc_dispmanx_rect_set(&(_dispvars->srcRect), 0, 0, width << 16, height << 16);	
+	dstXpos = (_dispvars->dispmanxWidth - dstWidth) / 2;
+	dstYpos = (_dispvars->dispmanxHeight - dstHeight) / 2;
 
-	for (int i = 0; i < NUMPAGES; i++)
-		_dispvars->pages[i].resource = vc_dispmanx_resource_create(_dispvars->pixFormat, width, height, 
-			&(_dispvars->vcImagePtr));
-	
-	// Add element
+	// Remember we have to transfer the whole bitmap even if we would have
+	// interest in a part of it! Blitting is done by the GPU.
+	vc_dispmanx_rect_set(&_dispvars->dstRect, dstXpos, dstYpos, dstWidth, dstHeight);
+	vc_dispmanx_rect_set(&_dispvars->bmpRect, 0, 0, srcWidth, srcHeight);	
+	vc_dispmanx_rect_set(&_dispvars->srcRect, 0, 0, srcWidth << 16, srcHeight << 16);	
+
+	for (int i = 0; i < _dispvars->numpages; i++) {
+		_dispvars->pages[i].resource = vc_dispmanx_resource_create(_dispvars->pixFormat, 
+			srcWidth, srcHeight, &(_dispvars->vcImagePtr));
+	}
+
+	// Add the element. Has to be removed before getting here again.
 	_dispvars->update = vc_dispmanx_update_start(0);
-	
-	_dispvars->element = vc_dispmanx_element_add(_dispvars->update, _dispvars->display, 0,
-		&(_dispvars->dstRect), _dispvars->pages[0].resource, &(_dispvars->srcRect), 
-		DISPMANX_PROTECTION_NONE, _dispvars->alpha, 0, (DISPMANX_TRANSFORM_T)0);
-	
-	vc_dispmanx_update_submit_sync(_dispvars->update);		
+
+	_dispvars->element = vc_dispmanx_element_add(
+		_dispvars->update,_dispvars->display, 0, 
+		&_dispvars->dstRect, 0, 
+		&_dispvars->srcRect, DISPMANX_PROTECTION_NONE,
+		&_dispvars->alpha, 0, (DISPMANX_TRANSFORM_T)0);
+
+	vc_dispmanx_update_submit_sync(_dispvars->update);
 }
 
 void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void *arg) {
-	struct dispvarsStruct *_dispvars = (struct dispvarsStruct*)arg;
+	struct dispmanxPage *page = (struct dispmanxPage*)arg;
+	struct dispvarsStruct *dispvars = page->dispvars;
+
+	// Marking the page as free must be done before the signaling
+	// so when the update function continues (it won't continue until we signal) 
+	// we can chose this page as free.
+	if (dispvars->currentPage) {
+		pthread_mutex_lock(&dispvars->currentPage->pageUsedMutex);
+
+		// We mark as free the page that was visible until now.
+		page->dispvars->currentPage->used = false;
+
+		pthread_mutex_unlock(&dispvars->currentPage->pageUsedMutex);
+	}
 
-	// Changing the page to write must be done before the signaling
-	// so we have the right page in nextPage when update_main continues
-	if (_dispvars->nextPage == &_dispvars->pages[0])	
-	   _dispvars->nextPage = &_dispvars->pages[1];
-	else 
-	   _dispvars->nextPage = &_dispvars->pages[0];
+	// The page on which we issued the flip that
+	// caused this callback becomes the visible one
+	dispvars->currentPage = page;
 
 	// These two things must be isolated "atomically" to avoid getting 
-        // a false positive in the pending_mutex test in update_main.
-	pthread_mutex_lock(&_dispvars->pendingMutex);
-	
-	pthread_cond_signal(&_dispvars->vsyncCondition);
-	_dispvars->pageflipPending = false;	
-	
-	pthread_mutex_unlock(&_dispvars->pendingMutex);
-		
+	// a false positive in the pending_mutex test in update function.
+	pthread_mutex_lock(&dispvars->pendingMutex);
+
+	dispvars->pageflipPending--;	
+	pthread_cond_signal(&dispvars->vsyncCondition);
+
+	pthread_mutex_unlock(&dispvars->pendingMutex);
 }
 
 void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
+	// Wait until last issued flip completes to get a free page. Also, 
+	// dispmanx doesn't support issuing more than one pageflip.
 	pthread_mutex_lock(&_dispvars->pendingMutex);
 
-	if (_dispvars->pageflipPending) {
+	if (_dispvars->pageflipPending > 0) {
 		pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->pendingMutex);
 	}
 	
 	pthread_mutex_unlock(&_dispvars->pendingMutex);
 
+	struct dispmanxPage *page = DispmanXGetFreePage();
+
 	// Frame blitting
-	vc_dispmanx_resource_write_data(_dispvars->nextPage->resource, _dispvars->pixFormat,
-		_dispvars->pitch, _dispvars->pixmem, &(_dispvars->bmpRect));
+	vc_dispmanx_resource_write_data(page->resource, _dispvars->pixFormat,
+		_dispvars->pitch, _dispvars->pixmem, &_dispvars->bmpRect);
 	
 	// Issue a page flip at the next vblank interval (will be done at vsync anyway).
 	_dispvars->update = vc_dispmanx_update_start(0);
 
 	vc_dispmanx_element_change_source(_dispvars->update, _dispvars->element,
-		_dispvars->nextPage->resource);
-	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, _dispvars);
+		page->resource);
+	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, page);
 	
 	pthread_mutex_lock(&_dispvars->pendingMutex);
-	_dispvars->pageflipPending = true;	
+	_dispvars->pageflipPending++;	
 	pthread_mutex_unlock(&_dispvars->pendingMutex);
 }
 
+struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage(void) {
+	struct dispmanxPage *page = NULL;
+
+	while (!page)
+	{
+		// Try to find a free page
+		for (int i = 0; i < _dispvars->numpages; ++i) {
+			if (!_dispvars->pages[i].used)
+			{
+				page = (_dispvars->pages) + i;
+				break;
+			}
+		}
+
+		// If no page is free at the moment,
+		// wait until a free page is freed by vsync CB.
+		if (!page) {
+			pthread_mutex_lock(&_dispvars->vsyncCondMutex);
+			pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->vsyncCondMutex);
+			pthread_mutex_unlock(&_dispvars->vsyncCondMutex);
+		}
+	}
+
+	// We mark the choosen page as used
+	pthread_mutex_lock(&page->pageUsedMutex);
+	page->used = true;
+	pthread_mutex_unlock(&page->pageUsedMutex);
+
+	return page;
+}
+
 void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
-	_dispvars->update = vc_dispmanx_update_start(0);
-		
-    	for (int i = 0; i < NUMPAGES; i++)
+	// What if we run into the vsync cb code after freeing the resources? 
+	pthread_mutex_lock(&_dispvars->pendingMutex);
+	if (_dispvars->pageflipPending > 0)
+	{
+	     pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->pendingMutex);
+	}
+	pthread_mutex_unlock(&_dispvars->pendingMutex);
+
+	for (int i = 0; i < _dispvars->numpages; i++) { 
 		vc_dispmanx_resource_delete(_dispvars->pages[i].resource);
-	
+		_dispvars->pages[i].resource = 0;
+		_dispvars->pages[i].used = false;
+	}
+
+	_dispvars->update = vc_dispmanx_update_start(0);
 	vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
-	
 	vc_dispmanx_update_submit_sync(_dispvars->update);		
+	// We use this on the setup function to know if we have to free resources and element.
+	_dispvars->element = 0;
 }
 
 void DispmanXSdlGraphicsManager::DispmanXVideoQuit() {
+	// This also waits for pending flips to complete, that's needed before
+	// we destroy the mutexes and condition.
 	DispmanXFreeResources();
-	// Close display and deinit 
-	vc_dispmanx_display_close(_dispvars->display);
-	bcm_host_deinit();
-
-	// Destroy mutexes and conditions	
+	
+	// Destroy the mutexes and conditions	
+	for (int i = 0; i < _dispvars->numpages; i++) {
+		pthread_mutex_destroy(&_dispvars->pages[i].pageUsedMutex); 
+	}
 	pthread_mutex_destroy(&_dispvars->pendingMutex);
+	pthread_mutex_destroy(&_dispvars->vsyncCondMutex);
 	pthread_cond_destroy(&_dispvars->vsyncCondition);		
 
 	free(_dispvars->pages);
+
+	// Close display and deinit 
+	vc_dispmanx_display_close(_dispvars->display);
+	bcm_host_deinit();
 }
 
 bool DispmanXSdlGraphicsManager::loadGFXMode() {
@@ -216,10 +313,10 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 	// In DispmanX, we manage aspect ratio correction, so for scummvm it's always disabled.
 	_videoMode.aspectRatioCorrection = false;
 	
-	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
-	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
-	_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
-	_videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+	_videoMode.overlayWidth = _videoMode.screenWidth;
+	_videoMode.overlayHeight = _videoMode.screenHeight;
+	_videoMode.hardwareWidth = _videoMode.screenWidth;
+	_videoMode.hardwareHeight = _videoMode.screenHeight;
 
 	//
 	// Create the surface that contains the 8 bit game data
@@ -236,59 +333,30 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 	// Avoid having SDL_SRCALPHA set even if we supplied an alpha-channel in the format.
 	SDL_SetAlpha(_screen, 0, 255);
 	
-	// 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.
-	// SDL_SetColors does nothing for non indexed surfaces.
+	// We set our own default palette to all black.
 	SDL_SetColors(_screen, _currentPalette, 0, 256);
 
 	//
 	// Create the surface that contains the scaled graphics in 16 bit mode
 	//
 
-	// We call DispmanXSetup() before SDL_SetVideoMode() because we use _hwscreen == null
-	// to know inside DispmanXSetup() if we've been there before and need to free resources.
-	DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight, 16);	
-	// _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, SDL_FULLSCREEN);
+	DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight);	
+	
 	_hwscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
 		0, 0, 0, 0);
-	
-	_dispvars->pixmem = _hwscreen->pixels;
-
-	// We draw on a RAM surface, but we make this call just to get SDL input initialized. 
-	// Even if we don't use the returned SDL_Surface *, we still need to use the right dimensions
-	// for mouse pointer adjustment to work correctly.
-	SDL_SetVideoMode(_videoMode.screenWidth, _videoMode.screenHeight, 16, SDL_FULLSCREEN);
-
-	detectSupportedFormats();
 
+	// This is just so SDL 1.x input is initialized. Only once!
+	if (_dispvars->fscreen == NULL)		
+		_dispvars->fscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, SDL_FULLSCREEN);
 	if (_hwscreen == NULL) {
-		// DON'T use error(), as this tries to bring up the debug
-		// console, which WON'T WORK now that _hwscreen is hosed.
-
-		if (!_oldVideoMode.setup) {
-			warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
-			g_system->quit();
-		} else {
-			return false;
-		}
+		// Don't use error here because we don't have access to the debug console
+		warning("Allocating surface for DispmanX rendering _hwscreen failed");
+		g_system->quit();
 	}
 
-	//
-	// Create the surface used for the graphics in 16 bit before scaling, and also the overlay
-	//
-
-	// Need some extra bytes around when using 2xSaI
-	_tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3,
-						16,
-						_hwscreen->format->Rmask,
-						_hwscreen->format->Gmask,
-						_hwscreen->format->Bmask,
-						_hwscreen->format->Amask);
-
-	if (_tmpscreen == NULL)
-		error("allocating _tmpscreen failed");
-
+	// We render to dispmanx resources from _hwscreen pixels array
+	_dispvars->pixmem = _hwscreen->pixels;
+	
 	_overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth, _videoMode.overlayHeight,
 						16,
 						_hwscreen->format->Rmask,
@@ -311,16 +379,6 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 	_overlayFormat.bShift = _overlayscreen->format->Bshift;
 	_overlayFormat.aShift = _overlayscreen->format->Ashift;
 
-	_tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + 3, _videoMode.overlayHeight + 3,
-						16,
-						_hwscreen->format->Rmask,
-						_hwscreen->format->Gmask,
-						_hwscreen->format->Bmask,
-						_hwscreen->format->Amask);
-
-	if (_tmpscreen2 == NULL)
-		error("allocating _tmpscreen2 failed");
-
 #ifdef USE_OSD
 	_osdSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA,
 						_hwscreen->w,
@@ -336,29 +394,51 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 #endif
 
 	_eventSource->resetKeyboadEmulation(
-		_videoMode.screenWidth * _videoMode.scaleFactor - 1,
-		effectiveScreenHeight() - 1);
-
-	// Distinguish 555 and 565 mode
-	if (_hwscreen->format->Rmask == 0x7C00)
-		InitScalers(555);
-	else
-		InitScalers(565);
+		_videoMode.screenWidth, effectiveScreenHeight());
 
 	return true;
 }
 
+void DispmanXSdlGraphicsManager::clearOverlay() {
+	//assert(_transactionMode == kTransactionNone);
+	
+	Common::StackLock lock(_graphicsMutex);	// Lock the mutex until this function ends
+
+	if (!_overlayVisible)
+		return;
+
+	// Clear the overlay by making the game screen "look through" everywhere.
+	SDL_Rect src, dst;
+	src.x = src.y = 0;
+	dst.x = dst.y = 0;
+	src.w = dst.w = _videoMode.screenWidth;
+	src.h = dst.h = _videoMode.screenHeight;
+	if (SDL_BlitSurface(_screen, &src, _hwscreen, &dst) != 0)
+		error("SDL_BlitSurface failed: %s", SDL_GetError());
+
+	SDL_LockSurface(_hwscreen);
+	SDL_LockSurface(_overlayscreen);
+	Normal1x((byte *)(_hwscreen->pixels), _hwscreen->pitch,
+	(byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight);
+
+	SDL_UnlockSurface(_hwscreen);
+	SDL_UnlockSurface(_overlayscreen);
+
+	_forceFull = true;
+}
+
 void DispmanXSdlGraphicsManager::internUpdateScreen() {
 	SDL_Surface *srcSurf, *origSurf;
 	int height, width;
-	ScalerProc *scalerProc;
-	int scale1;
 
 	// If the shake position changed, fill the dirty area with blackness
 	if (_currentShakePos != _newShakePos ||
 		(_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
 		SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_newShakePos * _videoMode.scaleFactor)};
 
+		if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+			blackrect.h = real2Aspect(blackrect.h - 1) + 1;
+
 		SDL_FillRect(_hwscreen, &blackrect, 0);
 
 		_currentShakePos = _newShakePos;
@@ -400,19 +480,14 @@ void DispmanXSdlGraphicsManager::internUpdateScreen() {
 
 	if (!_overlayVisible) {
 		origSurf = _screen;
-		srcSurf = _tmpscreen;
+		srcSurf = _hwscreen;
 		width = _videoMode.screenWidth;
 		height = _videoMode.screenHeight;
-		scalerProc = _scalerProc;
-		scale1 = _videoMode.scaleFactor;
 	} else {
 		origSurf = _overlayscreen;
-		srcSurf = _tmpscreen2;
+		srcSurf = _hwscreen;
 		width = _videoMode.overlayWidth;
 		height = _videoMode.overlayHeight;
-		scalerProc = Normal1x;
-
-		scale1 = 1;
 	}
 
 	// Add the area covered by the mouse cursor to the list of dirty rects if
@@ -433,50 +508,15 @@ void DispmanXSdlGraphicsManager::internUpdateScreen() {
 	if (_numDirtyRects > 0 || _mouseNeedsRedraw) {
 		SDL_Rect *r;
 		SDL_Rect dst;
-		uint32 srcPitch, dstPitch;
 		SDL_Rect *lastRect = _dirtyRectList + _numDirtyRects;
 
 		for (r = _dirtyRectList; r != lastRect; ++r) {
 			dst = *r;
-			dst.x++;	// Shift rect by one since 2xSai needs to access the data around
-			dst.y++;	// any pixel to scale it, and we want to avoid mem access crashes.
 
 			if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
 				error("SDL_BlitSurface failed: %s", SDL_GetError());
 		}
 
-		SDL_LockSurface(srcSurf);
-		SDL_LockSurface(_hwscreen);
-
-		srcPitch = srcSurf->pitch;
-		dstPitch = _hwscreen->pitch;
-
-		for (r = _dirtyRectList; r != lastRect; ++r) {
-			register int dst_y = r->y + _currentShakePos;
-			register int dst_h = 0;
-			register int rx1 = r->x * scale1;
-
-			if (dst_y < height) {
-				dst_h = r->h;
-				if (dst_h > height - dst_y)
-					dst_h = height - dst_y;
-
-				dst_y = dst_y * scale1;
-
-				assert(scalerProc != NULL);
-				scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
-					(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
-			}
-
-			r->x = rx1;
-			r->y = dst_y;
-			r->w = r->w * scale1;
-			r->h = dst_h * scale1;
-
-		}
-		SDL_UnlockSurface(srcSurf);
-		SDL_UnlockSurface(_hwscreen);
-
 		// Readjust the dirty rect list in case we are doing a full update.
 		// This is necessary if shaking is active.
 		if (_forceFull) {
@@ -491,6 +531,7 @@ void DispmanXSdlGraphicsManager::internUpdateScreen() {
 			SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0);
 		}
 #endif
+
 		// Finally, blit all our changes to the screen
 		if (!_displayDisabled) {
 			SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
@@ -531,15 +572,13 @@ void DispmanXSdlGraphicsManager::setFullscreenMode(bool enable) {
 
 void DispmanXSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
 	Common::StackLock lock(_graphicsMutex);
-	// Ratio correction is managed externally by dispmanx, so we disable it at the SDL level but take note,
-	// so it's effectively taken into account at the dispmanx level in DispmanXSetup().
-	if (_oldVideoMode.setup && _dispvars->aspectRatioCorrection == enable)
-		return;
+	// We simply take note on what's the aspect ratio correction activation state.
+	_dispvars->aspectRatioCorrection = enable;
 	
-	if (_transactionMode == kTransactionActive) {
-		_dispvars->aspectRatioCorrection = enable;
-		_transactionDetails.needHotswap = false;
-		DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight, 16);	
+	// If we have a videomode setup already, call DispmanXSetup() again so aspect ratio
+	// correction activation/deactivation works from the menu. 
+	if (_oldVideoMode.setup && _dispvars->aspectRatioCorrection == enable) {
+		DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight);	
 	}
 }
 
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index a5abb86..c41f84e 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -37,11 +37,13 @@ public:
 	bool handleScalerHotkeys(Common::KeyCode key);
 	void setFullscreenMode(bool enable);
 	void setAspectRatioCorrection(bool enable);
+	void clearOverlay();
 protected:	
 	// Raspberry Pi Dispmanx API
-	void DispmanXSetup(int dwidth, int dheight, int dbpp);
+	void DispmanXSetup(int width, int height);
 	void DispmanXInit();
 	void DispmanXUpdate();
+	struct dispmanxPage *DispmanXGetFreePage();
 	void DispmanXFreeResources();
 	void DispmanXVideoQuit();
 	struct dispvarsStruct *_dispvars;
diff --git a/configure b/configure
index 92aa145..5e50d1c 100755
--- a/configure
+++ b/configure
@@ -124,6 +124,7 @@ _faad=auto
 _fluidsynth=auto
 _opengl=auto
 _opengles=auto
+_dispmanx=no
 _readline=auto
 _freetype2=auto
 _taskbar=auto
@@ -824,7 +825,7 @@ Configuration:
   -h, --help              display this help and exit
   --backend=BACKEND       backend to build (android, tizen, dc, dingux, ds, gcw0,
                           gph, iphone, linuxmoto, maemo, n64, null, openpandora,
-                          ps2, psp, raspberrypi, samsungtv, sdl, webos, wii, wince) [sdl]
+                          ps2, psp, samsungtv, sdl, webos, wii, wince) [sdl]
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -945,6 +946,8 @@ Optional Libraries:
   --with-opengl-prefix=DIR Prefix where OpenGL (ES) is installed (optional)
   --disable-opengl         disable OpenGL (ES) support [autodetect]
 
+  --with-dispmanx          enable dispmanx (Raspberry Pi native 2D API) rendering 
+
   --with-jpeg-prefix=DIR   Prefix where libjpeg is installed (optional)
   --disable-jpeg           disable JPEG decoder [autodetect]
 
@@ -1049,6 +1052,8 @@ for ac_option in $@; do
 	--disable-libunity)       _libunity=no    ;;
 	--enable-opengl)          _opengl=yes     ;;
 	--disable-opengl)         _opengl=no      ;;
+	--enable-dispmanx)	  _dispmanx=yes   ;;
+	--disable-dispmanx)	  _dispmanx=no    ;;
 	--enable-bink)            _bink=yes       ;;
 	--disable-bink)           _bink=no        ;;
 	--enable-verbose-build)   _verbose_build=yes ;;
@@ -1299,6 +1304,7 @@ raspberrypi)
 	_host_os=linux
 	_host_cpu=arm
 	_host_alias=arm-linux-gnueabihf
+	_backend=raspberrypi
 	;;
 caanoo)
 	_host_os=gph-linux
@@ -2987,30 +2993,6 @@ 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"
-		cat > $TMPC << EOF
-#include <bcm_host.h>
-
-		int main(int argc, char *argv[]) {
-	bcm_host_init();
-}
-EOF
-		cc_check $DISPMANX_CXXFLAGS $DISPMANX_LIBS && _use_dispmanx=yes
-		if test "$_use_dispmanx" = "yes"; then
-			CXXFLAGS="$CXXFLAGS $DISPMANX_CXXFLAGS"
-			LIBS="$LIBS $DISPMANX_LIBS"
-			MODULES="$MODULES backends/platform/sdl"
-			DEFINES="$DEFINES -DRASPBERRYPI"
-			add_line_to_config_mk 'RASPBERRYPI = 1'
-			_build_scalers=no
-			_build_hq_scalers=no	
-			_opengl=no
-			_default_optimization_level=-O3
-			echo $_use_dispmanx
-		fi
 		;;
 	samsungtv)
 		DEFINES="$DEFINES -DSAMSUNGTV"
@@ -3148,7 +3130,7 @@ case $_backend in
 esac
 
 #
-# In raspberry Pi, we don't use find_sdlconfig since we could be crosscompiling, but still we use SDL 
+# In raspberry Pi, we don't use find_sdlconfig since we could be crosscompiling, but still we use SDL
 #
 case $_backend in
 	raspberrypi)
@@ -3159,8 +3141,11 @@ case $_backend in
 		_16bit=yes
 		_savegame_timestamp=no
 		_eventrec=no
+		_build_scalers=no
+		_build_hq_scalers=no	
+	;;
 esac
-		
+
 #
 # Determine whether host is POSIX compliant, or at least POSIX
 # compatible enough to support our POSIX code (including dlsym(),
@@ -4094,6 +4079,31 @@ fi
 define_in_config_if_yes "$_opengl" "USE_OPENGL"
 define_in_config_if_yes "$_opengles" "USE_GLES"
 
+# Check if Raspberry Pi dispmanx has been activated. 
+if test "$_dispmanx" = "yes" ; then
+		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"
+		cat > $TMPC << EOF
+#include <bcm_host.h>
+
+		int main(int argc, char *argv[]) {
+	bcm_host_init();
+}
+EOF
+		cc_check $DISPMANX_CXXFLAGS $DISPMANX_LIBS && _use_dispmanx=yes
+		if test "$_use_dispmanx" = "yes"; then
+			CXXFLAGS="$CXXFLAGS $DISPMANX_CXXFLAGS"
+			LIBS="$LIBS $DISPMANX_LIBS"
+			MODULES="$MODULES backends/platform/sdl"
+			DEFINES="$DEFINES -DRASPBERRYPI"
+			add_line_to_config_mk 'RASPBERRYPI = 1'
+			_opengl=no
+			_opengles=no
+			echo $_use_dispmanx
+		fi
+fi
 
 #
 # Check for nasm


Commit: b706ca36f1e40d01e50d99d3e1296470f0727f3f
    https://github.com/scummvm/scummvm/commit/b706ca36f1e40d01e50d99d3e1296470f0727f3f
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-22T13:00:45+02:00

Commit Message:
SDL/DISPMANX: Updated class member names, configure script and asociated files and docs to conform to fingolfin's corrections.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
    backends/module.mk
    backends/platform/sdl/raspberrypi/README.RASPBERRYPI
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index af48fce..3f4a5ea 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -20,7 +20,7 @@
  *
  */
 
-//Needed for Raspberry Pi header incussion
+// Needed for Raspberry Pi header inclusion
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include "common/scummsys.h"
@@ -34,12 +34,12 @@
 
 #include <bcm_host.h>
 
-struct dispvarsStruct { 
+struct dispvarsStruct {
 	DISPMANX_DISPLAY_HANDLE_T display;
 	DISPMANX_UPDATE_HANDLE_T update;
 	DISPMANX_ELEMENT_HANDLE_T element;
 	VC_IMAGE_TYPE_T pixFormat;
-	VC_DISPMANX_ALPHA_T alpha;    
+	VC_DISPMANX_ALPHA_T alpha;
 
 	VC_RECT_T bmpRect;
 	VC_RECT_T srcRect;
@@ -52,13 +52,13 @@ struct dispvarsStruct {
 	bool aspectRatioCorrection;
 	void *pixmem;
 
-	int numpages;	
-	struct dispmanxPage *pages;
-	struct dispmanxPage *currentPage;
+	int numpages;
+	dispmanxPage *pages;
+	dispmanxPage *currentPage;
 	int pageflipPending;
 
-	pthread_cond_t vsyncCondition;	
-	pthread_mutex_t vsyncCondMutex;	
+	pthread_cond_t vsyncCondition;
+	pthread_mutex_t vsyncCondMutex;
 	pthread_mutex_t pendingMutex;
 
 	SDL_Surface *fscreen;
@@ -71,31 +71,31 @@ struct dispmanxPage {
 	// isolating the access to it's "used" flag.
 	pthread_mutex_t pageUsedMutex;
 
-	// This field will allow us to access the 
+	// This field will allow us to access the
 	// main dispvars struct, for the vsync cb.
-	struct dispvarsStruct *dispvars;	
+	struct dispvarsStruct *dispvars;
 };
 
 DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource)
  : SurfaceSdlGraphicsManager(sdlEventSource) {
 	_dispvars = new(dispvarsStruct);
-	DispmanXInit();
+	dispmanXInit();
 }
 
 DispmanXSdlGraphicsManager::~DispmanXSdlGraphicsManager() {
-	DispmanXVideoQuit();
+	dispmanXVideoQuit();
 	delete(_dispvars);
 }
 
-void DispmanXSdlGraphicsManager::DispmanXInit() {
+void DispmanXSdlGraphicsManager::dispmanXInit() {
 	_dispvars->screen = 0;
 	_dispvars->vcImagePtr = 0;
 	_dispvars->numpages = 3;
 	_dispvars->pages = (struct dispmanxPage *)calloc(_dispvars->numpages, sizeof(struct dispmanxPage));
-	_dispvars->pageflipPending = 0;	
+	_dispvars->pageflipPending = 0;
 	_dispvars->currentPage = NULL;
 	_dispvars->pixFormat = VC_IMAGE_RGB565;
-	
+
 	/* Transparency disabled */
 	_dispvars->alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
 	_dispvars->alpha.opacity = 255;
@@ -104,20 +104,20 @@ void DispmanXSdlGraphicsManager::DispmanXInit() {
 
 	// Init each page's variables
 	for (int i = 0; i < _dispvars->numpages; i++) {
-		_dispvars->pages[i].used = false;   
-		_dispvars->pages[i].dispvars = _dispvars;   
+		_dispvars->pages[i].used = false;
+		_dispvars->pages[i].dispvars = _dispvars;
 		_dispvars->pages[i].resource = 0;
-		pthread_mutex_init(&_dispvars->pages[i].pageUsedMutex, NULL); 
+		pthread_mutex_init(&_dispvars->pages[i].pageUsedMutex, NULL);
 	}
 
 	// Initialize the other mutex and condition variables
 	pthread_cond_init(&_dispvars->vsyncCondition, NULL);
 	pthread_mutex_init(&_dispvars->pendingMutex, NULL);
 	pthread_mutex_init(&_dispvars->vsyncCondMutex, NULL);
-	
+
 	// Before we call any vc_* function, we need to call this one.
 	bcm_host_init();
-	
+
 	_dispvars->display = vc_dispmanx_display_open(_dispvars->screen);
 	graphics_get_display_size(_dispvars->display, &_dispvars->dispmanxWidth, &_dispvars->dispmanxHeight);
 
@@ -125,24 +125,24 @@ void DispmanXSdlGraphicsManager::DispmanXInit() {
 	_dispvars->fscreen = NULL;
 }
 
-void DispmanXSdlGraphicsManager::DispmanXSetup(int srcWidth, int srcHeight) {
+void DispmanXSdlGraphicsManager::dispmanXSetup(int srcWidth, int srcHeight) {
 	unsigned int dstWidth, dstHeight, dstXpos, dstYpos;
 
 	// If we have an element, we have to free it along with it's resources.
 	if (_dispvars->element) {
-		DispmanXFreeResources();
+		dispmanXFreeResources();
 	}
 
 	// We do this for 2 bytes per pixel which is default on the Rpi.
 	_dispvars->pitch  = srcWidth * 2;
 	if (_dispvars->aspectRatioCorrection) {
 		float aspect = ((float)srcWidth / (float)srcHeight);
-		dstWidth  = _dispvars->dispmanxHeight * aspect;	
+		dstWidth  = _dispvars->dispmanxHeight * aspect;
 	} else {
-		dstWidth  = _dispvars->dispmanxWidth;	
+		dstWidth  = _dispvars->dispmanxWidth;
 	}
 	dstHeight = _dispvars->dispmanxHeight;
-	
+
 	// If we obtain a scaled image width that is bigger than the physical screen width,
 	// then we keep the physical screen width as our maximun width.
 	if (dstWidth > _dispvars->dispmanxWidth) {
@@ -155,11 +155,11 @@ void DispmanXSdlGraphicsManager::DispmanXSetup(int srcWidth, int srcHeight) {
 	// Remember we have to transfer the whole bitmap even if we would have
 	// interest in a part of it! Blitting is done by the GPU.
 	vc_dispmanx_rect_set(&_dispvars->dstRect, dstXpos, dstYpos, dstWidth, dstHeight);
-	vc_dispmanx_rect_set(&_dispvars->bmpRect, 0, 0, srcWidth, srcHeight);	
-	vc_dispmanx_rect_set(&_dispvars->srcRect, 0, 0, srcWidth << 16, srcHeight << 16);	
+	vc_dispmanx_rect_set(&_dispvars->bmpRect, 0, 0, srcWidth, srcHeight);
+	vc_dispmanx_rect_set(&_dispvars->srcRect, 0, 0, srcWidth << 16, srcHeight << 16);
 
 	for (int i = 0; i < _dispvars->numpages; i++) {
-		_dispvars->pages[i].resource = vc_dispmanx_resource_create(_dispvars->pixFormat, 
+		_dispvars->pages[i].resource = vc_dispmanx_resource_create(_dispvars->pixFormat,
 			srcWidth, srcHeight, &(_dispvars->vcImagePtr));
 	}
 
@@ -167,20 +167,20 @@ void DispmanXSdlGraphicsManager::DispmanXSetup(int srcWidth, int srcHeight) {
 	_dispvars->update = vc_dispmanx_update_start(0);
 
 	_dispvars->element = vc_dispmanx_element_add(
-		_dispvars->update,_dispvars->display, 0, 
-		&_dispvars->dstRect, 0, 
+		_dispvars->update,_dispvars->display, 0,
+		&_dispvars->dstRect, 0,
 		&_dispvars->srcRect, DISPMANX_PROTECTION_NONE,
 		&_dispvars->alpha, 0, (DISPMANX_TRANSFORM_T)0);
 
 	vc_dispmanx_update_submit_sync(_dispvars->update);
 }
 
-void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void *arg) {
+void dispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void *arg) {
 	struct dispmanxPage *page = (struct dispmanxPage*)arg;
 	struct dispvarsStruct *dispvars = page->dispvars;
 
 	// Marking the page as free must be done before the signaling
-	// so when the update function continues (it won't continue until we signal) 
+	// so when the update function continues (it won't continue until we signal)
 	// we can chose this page as free.
 	if (dispvars->currentPage) {
 		pthread_mutex_lock(&dispvars->currentPage->pageUsedMutex);
@@ -195,46 +195,46 @@ void DispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void *arg) {
 	// caused this callback becomes the visible one
 	dispvars->currentPage = page;
 
-	// These two things must be isolated "atomically" to avoid getting 
+	// These two things must be isolated "atomically" to avoid getting
 	// a false positive in the pending_mutex test in update function.
 	pthread_mutex_lock(&dispvars->pendingMutex);
 
-	dispvars->pageflipPending--;	
+	dispvars->pageflipPending--;
 	pthread_cond_signal(&dispvars->vsyncCondition);
 
 	pthread_mutex_unlock(&dispvars->pendingMutex);
 }
 
-void DispmanXSdlGraphicsManager::DispmanXUpdate() {	
-	// Wait until last issued flip completes to get a free page. Also, 
+void DispmanXSdlGraphicsManager::dispmanXUpdate() {
+	// Wait until last issued flip completes to get a free page. Also,
 	// dispmanx doesn't support issuing more than one pageflip.
 	pthread_mutex_lock(&_dispvars->pendingMutex);
 
 	if (_dispvars->pageflipPending > 0) {
 		pthread_cond_wait(&_dispvars->vsyncCondition, &_dispvars->pendingMutex);
 	}
-	
+
 	pthread_mutex_unlock(&_dispvars->pendingMutex);
 
-	struct dispmanxPage *page = DispmanXGetFreePage();
+	struct dispmanxPage *page = dispmanXGetFreePage();
 
 	// Frame blitting
 	vc_dispmanx_resource_write_data(page->resource, _dispvars->pixFormat,
 		_dispvars->pitch, _dispvars->pixmem, &_dispvars->bmpRect);
-	
+
 	// Issue a page flip at the next vblank interval (will be done at vsync anyway).
 	_dispvars->update = vc_dispmanx_update_start(0);
 
 	vc_dispmanx_element_change_source(_dispvars->update, _dispvars->element,
 		page->resource);
-	vc_dispmanx_update_submit(_dispvars->update, &DispmanXVSyncCallback, page);
-	
+	vc_dispmanx_update_submit(_dispvars->update, &dispmanXVSyncCallback, page);
+
 	pthread_mutex_lock(&_dispvars->pendingMutex);
-	_dispvars->pageflipPending++;	
+	_dispvars->pageflipPending++;
 	pthread_mutex_unlock(&_dispvars->pendingMutex);
 }
 
-struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage(void) {
+struct dispmanxPage *DispmanXSdlGraphicsManager::dispmanXGetFreePage(void) {
 	struct dispmanxPage *page = NULL;
 
 	while (!page)
@@ -265,8 +265,8 @@ struct dispmanxPage *DispmanXSdlGraphicsManager::DispmanXGetFreePage(void) {
 	return page;
 }
 
-void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
-	// What if we run into the vsync cb code after freeing the resources? 
+void DispmanXSdlGraphicsManager::dispmanXFreeResources(void) {
+	// What if we run into the vsync cb code after freeing the resources?
 	pthread_mutex_lock(&_dispvars->pendingMutex);
 	if (_dispvars->pageflipPending > 0)
 	{
@@ -274,7 +274,7 @@ void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
 	}
 	pthread_mutex_unlock(&_dispvars->pendingMutex);
 
-	for (int i = 0; i < _dispvars->numpages; i++) { 
+	for (int i = 0; i < _dispvars->numpages; i++) {
 		vc_dispmanx_resource_delete(_dispvars->pages[i].resource);
 		_dispvars->pages[i].resource = 0;
 		_dispvars->pages[i].used = false;
@@ -282,37 +282,37 @@ void DispmanXSdlGraphicsManager::DispmanXFreeResources(void) {
 
 	_dispvars->update = vc_dispmanx_update_start(0);
 	vc_dispmanx_element_remove(_dispvars->update, _dispvars->element);
-	vc_dispmanx_update_submit_sync(_dispvars->update);		
+	vc_dispmanx_update_submit_sync(_dispvars->update);
 	// We use this on the setup function to know if we have to free resources and element.
 	_dispvars->element = 0;
 }
 
-void DispmanXSdlGraphicsManager::DispmanXVideoQuit() {
+void DispmanXSdlGraphicsManager::dispmanXVideoQuit() {
 	// This also waits for pending flips to complete, that's needed before
 	// we destroy the mutexes and condition.
-	DispmanXFreeResources();
-	
-	// Destroy the mutexes and conditions	
+	dispmanXFreeResources();
+
+	// Destroy the mutexes and conditions
 	for (int i = 0; i < _dispvars->numpages; i++) {
-		pthread_mutex_destroy(&_dispvars->pages[i].pageUsedMutex); 
+		pthread_mutex_destroy(&_dispvars->pages[i].pageUsedMutex);
 	}
 	pthread_mutex_destroy(&_dispvars->pendingMutex);
 	pthread_mutex_destroy(&_dispvars->vsyncCondMutex);
-	pthread_cond_destroy(&_dispvars->vsyncCondition);		
+	pthread_cond_destroy(&_dispvars->vsyncCondition);
 
 	free(_dispvars->pages);
 
-	// Close display and deinit 
+	// Close display and deinit
 	vc_dispmanx_display_close(_dispvars->display);
 	bcm_host_deinit();
 }
 
 bool DispmanXSdlGraphicsManager::loadGFXMode() {
 	_forceFull = true;
-	
-	// In DispmanX, we manage aspect ratio correction, so for scummvm it's always disabled.
+
+	// In dispmanX, we manage aspect ratio correction, so for scummvm it's always disabled.
 	_videoMode.aspectRatioCorrection = false;
-	
+
 	_videoMode.overlayWidth = _videoMode.screenWidth;
 	_videoMode.overlayHeight = _videoMode.screenHeight;
 	_videoMode.hardwareWidth = _videoMode.screenWidth;
@@ -332,7 +332,7 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 			error("allocating _screen failed");
 	// Avoid having SDL_SRCALPHA set even if we supplied an alpha-channel in the format.
 	SDL_SetAlpha(_screen, 0, 255);
-	
+
 	// We set our own default palette to all black.
 	SDL_SetColors(_screen, _currentPalette, 0, 256);
 
@@ -340,23 +340,23 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 	// Create the surface that contains the scaled graphics in 16 bit mode
 	//
 
-	DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight);	
-	
+	dispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight);
+
 	_hwscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
 		0, 0, 0, 0);
 
 	// This is just so SDL 1.x input is initialized. Only once!
-	if (_dispvars->fscreen == NULL)		
+	if (_dispvars->fscreen == NULL)
 		_dispvars->fscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, SDL_FULLSCREEN);
 	if (_hwscreen == NULL) {
 		// Don't use error here because we don't have access to the debug console
-		warning("Allocating surface for DispmanX rendering _hwscreen failed");
+		warning("Allocating surface for dispmanX rendering _hwscreen failed");
 		g_system->quit();
 	}
 
 	// We render to dispmanx resources from _hwscreen pixels array
 	_dispvars->pixmem = _hwscreen->pixels;
-	
+
 	_overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth, _videoMode.overlayHeight,
 						16,
 						_hwscreen->format->Rmask,
@@ -401,7 +401,7 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 
 void DispmanXSdlGraphicsManager::clearOverlay() {
 	//assert(_transactionMode == kTransactionNone);
-	
+
 	Common::StackLock lock(_graphicsMutex);	// Lock the mutex until this function ends
 
 	if (!_overlayVisible)
@@ -436,7 +436,7 @@ void DispmanXSdlGraphicsManager::internUpdateScreen() {
 		(_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
 		SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_newShakePos * _videoMode.scaleFactor)};
 
-		if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+		if (_dispvars->aspectRatioCorrection && !_overlayVisible)
 			blackrect.h = real2Aspect(blackrect.h - 1) + 1;
 
 		SDL_FillRect(_hwscreen, &blackrect, 0);
@@ -535,7 +535,7 @@ void DispmanXSdlGraphicsManager::internUpdateScreen() {
 		// Finally, blit all our changes to the screen
 		if (!_displayDisabled) {
 			SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
-			DispmanXUpdate();
+			dispmanXUpdate();
 		}
 	}
 
@@ -548,9 +548,7 @@ bool DispmanXSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
 
 	// Ctrl-Alt-a toggles aspect ratio correction
 	if (key == 'a') {
-		beginGFXTransaction();
-			setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_dispvars->aspectRatioCorrection);
-		endGFXTransaction();
+		setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_dispvars->aspectRatioCorrection);
 #ifdef USE_OSD
 		char buffer[128];
 		if (_dispvars->aspectRatioCorrection)
@@ -574,11 +572,11 @@ void DispmanXSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
 	Common::StackLock lock(_graphicsMutex);
 	// We simply take note on what's the aspect ratio correction activation state.
 	_dispvars->aspectRatioCorrection = enable;
-	
-	// If we have a videomode setup already, call DispmanXSetup() again so aspect ratio
-	// correction activation/deactivation works from the menu. 
+
+	// If we have a videomode setup already, call dispmanXSetup() again so aspect ratio
+	// correction activation/deactivation works from the menu.
 	if (_oldVideoMode.setup && _dispvars->aspectRatioCorrection == enable) {
-		DispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight);	
+		dispmanXSetup(_videoMode.screenWidth, _videoMode.screenHeight);
 	}
 }
 
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index c41f84e..d2a52f5 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -31,22 +31,22 @@ struct dispmanxPage;
 class DispmanXSdlGraphicsManager : public SurfaceSdlGraphicsManager {
 public:
 	DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource);
-	~DispmanXSdlGraphicsManager(); 
+	~DispmanXSdlGraphicsManager();
 	bool loadGFXMode();
 	void internUpdateScreen();
 	bool handleScalerHotkeys(Common::KeyCode key);
 	void setFullscreenMode(bool enable);
 	void setAspectRatioCorrection(bool enable);
 	void clearOverlay();
-protected:	
+protected:
 	// Raspberry Pi Dispmanx API
-	void DispmanXSetup(int width, int height);
-	void DispmanXInit();
-	void DispmanXUpdate();
-	struct dispmanxPage *DispmanXGetFreePage();
-	void DispmanXFreeResources();
-	void DispmanXVideoQuit();
-	struct dispvarsStruct *_dispvars;
+	void dispmanXSetup(int width, int height);
+	void dispmanXInit();
+	void dispmanXUpdate();
+	dispmanxPage *dispmanXGetFreePage();
+	void dispmanXFreeResources();
+	void dispmanXVideoQuit();
+	dispvarsStruct *_dispvars;
 };
 
 #endif /* BACKENDS_GRAPHICS_SDL_DISPMANX_H */
diff --git a/backends/module.mk b/backends/module.mk
index 645b5ed..979bce5 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -127,6 +127,11 @@ MODULE_OBJS += \
 	mixer/sdl13/sdl13-mixer.o
 endif
 
+ifdef RASPBERRYPI
+MODULE_OBJS += \
+	graphics/dispmanxsdl/dispmanxsdl-graphics.o
+endif
+
 ifeq ($(BACKEND),tizen)
 MODULE_OBJS += \
 	timer/tizen/timer.o
@@ -193,11 +198,6 @@ MODULE_OBJS += \
 	timer/psp/timer.o
 endif
 
-ifeq ($(BACKEND),raspberrypi)
-MODULE_OBJS += \
-	graphics/dispmanxsdl/dispmanxsdl-graphics.o
-endif
-
 ifeq ($(BACKEND),samsungtv)
 MODULE_OBJS += \
 	events/samsungtvsdl/samsungtvsdl-events.o \
diff --git a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
index f714380..d67a5ab 100644
--- a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
+++ b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
@@ -8,7 +8,7 @@ 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.
+on a clunky, software-scaled and desynced X11 environment using the X11 API.
 Thus, running this version under an X11 session is not supported.
 
 Requirements
@@ -77,7 +77,7 @@ Local compilation would simply consist of the "standard" GNU/Linux building proc
 
 cd <sources_dir>
 
-./configure ./configure --backend=raspberrypi -disable-debug --enable-release 
+./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
 
@@ -86,7 +86,7 @@ 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,
+2) If we want 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 
diff --git a/configure b/configure
index 5e50d1c..85f59f0 100755
--- a/configure
+++ b/configure
@@ -1052,9 +1052,9 @@ for ac_option in $@; do
 	--disable-libunity)       _libunity=no    ;;
 	--enable-opengl)          _opengl=yes     ;;
 	--disable-opengl)         _opengl=no      ;;
-	--enable-dispmanx)	  _dispmanx=yes   ;;
-	--disable-dispmanx)	  _dispmanx=no    ;;
-	--enable-bink)            _bink=yes       ;;
+        --enable-dispmanx)        _dispmanx=yes   ;;
+        --disable-dispmanx)       _dispmanx=no    ;;
+        --enable-bink)            _bink=yes       ;;
 	--disable-bink)           _bink=no        ;;
 	--enable-verbose-build)   _verbose_build=yes ;;
 	--enable-plugins)         _dynamic_modules=yes ;;
@@ -1304,7 +1304,6 @@ raspberrypi)
 	_host_os=linux
 	_host_cpu=arm
 	_host_alias=arm-linux-gnueabihf
-	_backend=raspberrypi
 	;;
 caanoo)
 	_host_os=gph-linux
@@ -2549,6 +2548,17 @@ if test -n "$_host"; then
 			_seq_midi=no
 			_port_mk="backends/platform/dingux/dingux.mk"
 			;;
+		raspberrypi)
+			# We should have setup raspberrypi-sdl-config with modified prefix as part of 
+			# the cross-building enviroment.	
+			_savegame_timestamp=no
+			_eventrec=no
+			_build_scalers=no
+			_build_hq_scalers=no
+			# It makes no sense to have both GL and dispmanx rendering support.
+			_opengl=no
+			_opengles=no
+			;;
 		dreamcast)
 			DEFINES="$DEFINES -DDISABLE_DEFAULT_SAVEFILEMANAGER"
 			DEFINES="$DEFINES -DDISABLE_TEXT_CONSOLE"
@@ -2993,6 +3003,8 @@ case $_backend in
 		LIBS="$LIBS -Wl,-Map,mapfile.txt"
 		;;
 	raspberrypi)
+		LIBS="$LIBS -L$RPI_ROOT/usr/lib"
+		LIBS="$LIBS -L$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
 		;;
 	samsungtv)
 		DEFINES="$DEFINES -DSAMSUNGTV"
@@ -3130,23 +3142,6 @@ case $_backend in
 esac
 
 #
-# In raspberry Pi, we don't use find_sdlconfig since we could be crosscompiling, but still we use SDL
-#
-case $_backend in
-	raspberrypi)
-		INCLUDES="$INCLUDES -I$RPI_ROOTDIR/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT"
-		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
-		_build_scalers=no
-		_build_hq_scalers=no	
-	;;
-esac
-
-#
 # Determine whether host is POSIX compliant, or at least POSIX
 # compatible enough to support our POSIX code (including dlsym(),
 # mkdir() and some other APIs).
@@ -4083,8 +4078,8 @@ define_in_config_if_yes "$_opengles" "USE_GLES"
 if test "$_dispmanx" = "yes" ; then
 		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"
+		DISPMANX_CXXFLAGS="-I$RPI_ROOT/opt/vc/include -I$RPI_ROOT/opt/vc/include/interface/vmcs_host/linux/ -I$RPI_ROOT/opt/vc/include/interface/vcos/pthreads -I$RPI_ROOT/opt/rpi_root/usr/include/SDL"
+		DISPMANX_LIBS="--sysroot=$RPI_ROOT -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
 		cat > $TMPC << EOF
 #include <bcm_host.h>
 
@@ -4096,11 +4091,8 @@ EOF
 		if test "$_use_dispmanx" = "yes"; then
 			CXXFLAGS="$CXXFLAGS $DISPMANX_CXXFLAGS"
 			LIBS="$LIBS $DISPMANX_LIBS"
-			MODULES="$MODULES backends/platform/sdl"
 			DEFINES="$DEFINES -DRASPBERRYPI"
 			add_line_to_config_mk 'RASPBERRYPI = 1'
-			_opengl=no
-			_opengles=no
 			echo $_use_dispmanx
 		fi
 fi


Commit: 8cf5f96b9e497803f2fb79b771c3f1c05ee1c554
    https://github.com/scummvm/scummvm/commit/8cf5f96b9e497803f2fb79b771c3f1c05ee1c554
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-22T13:33:19+02:00

Commit Message:
SDL/DISPMANX: Make hasFeature(kFeatureFullscreenMode) return false since dispmanx graphics always run in accelerated fullscreen mode.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 3f4a5ea..e333684 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -564,6 +564,12 @@ bool DispmanXSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
 	return true;
 }
 
+bool DispmanXSdlGraphicsManager::hasFeature(OSystem::Feature f) {
+	if (f == OSystem::kFeatureFullscreenMode) {
+		return false;
+	}
+}
+
 void DispmanXSdlGraphicsManager::setFullscreenMode(bool enable) {
 	_videoMode.fullscreen = enable;
 }
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index d2a52f5..1866ec14 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -38,6 +38,7 @@ public:
 	void setFullscreenMode(bool enable);
 	void setAspectRatioCorrection(bool enable);
 	void clearOverlay();
+	bool hasFeature(OSystem::Feature f);
 protected:
 	// Raspberry Pi Dispmanx API
 	void dispmanXSetup(int width, int height);


Commit: 8382e87baad83d0a9c4201f2fa3851f653f3bbb5
    https://github.com/scummvm/scummvm/commit/8382e87baad83d0a9c4201f2fa3851f653f3bbb5
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-24T11:48:21+02:00

Commit Message:
SDL/DISPMANX: Made minor corrections sugested by fingolfin.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index e333684..7760005 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -175,7 +175,7 @@ void DispmanXSdlGraphicsManager::dispmanXSetup(int srcWidth, int srcHeight) {
 	vc_dispmanx_update_submit_sync(_dispvars->update);
 }
 
-void dispmanXVSyncCallback (DISPMANX_UPDATE_HANDLE_T u, void *arg) {
+void dispmanXVSyncCallback(DISPMANX_UPDATE_HANDLE_T u, void *arg) {
 	struct dispmanxPage *page = (struct dispmanxPage*)arg;
 	struct dispvarsStruct *dispvars = page->dispvars;
 
@@ -237,12 +237,10 @@ void DispmanXSdlGraphicsManager::dispmanXUpdate() {
 struct dispmanxPage *DispmanXSdlGraphicsManager::dispmanXGetFreePage(void) {
 	struct dispmanxPage *page = NULL;
 
-	while (!page)
-	{
+	while (!page) {
 		// Try to find a free page
 		for (int i = 0; i < _dispvars->numpages; ++i) {
-			if (!_dispvars->pages[i].used)
-			{
+			if (!_dispvars->pages[i].used) {
 				page = (_dispvars->pages) + i;
 				break;
 			}
@@ -328,8 +326,9 @@ bool DispmanXSdlGraphicsManager::loadGFXMode() {
 		((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");
+	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);
 
diff --git a/configure b/configure
index 85f59f0..2631a29 100755
--- a/configure
+++ b/configure
@@ -2549,8 +2549,8 @@ if test -n "$_host"; then
 			_port_mk="backends/platform/dingux/dingux.mk"
 			;;
 		raspberrypi)
-			# We should have setup raspberrypi-sdl-config with modified prefix as part of 
-			# the cross-building enviroment.	
+			# For proper cross-compilation, we assume that the cross-building environment provides 
+			# an sdl-config executable with modified prefix pointing to $RPI_ROOT/usr.
 			_savegame_timestamp=no
 			_eventrec=no
 			_build_scalers=no


Commit: fcbecdeaf6adb87424d44abe9a338ddd58257774
    https://github.com/scummvm/scummvm/commit/fcbecdeaf6adb87424d44abe9a338ddd58257774
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-07-24T12:04:51+02:00

Commit Message:
SDL/DISPMANX: Corrected hasFeature() return values and made setFullScreenMode() ignore the enable value.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 7760005..28f1cc1 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -566,11 +566,13 @@ bool DispmanXSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
 bool DispmanXSdlGraphicsManager::hasFeature(OSystem::Feature f) {
 	if (f == OSystem::kFeatureFullscreenMode) {
 		return false;
+	} else {
+		return SurfaceSdlGraphicsManager::hasFeature(f);
 	}
 }
 
 void DispmanXSdlGraphicsManager::setFullscreenMode(bool enable) {
-	_videoMode.fullscreen = enable;
+	// Since we're always in fullscreen mode, we do nothing here.
 }
 
 void DispmanXSdlGraphicsManager::setAspectRatioCorrection(bool enable) {


Commit: aa7734a643a7553788617700f40d37057c34ec70
    https://github.com/scummvm/scummvm/commit/aa7734a643a7553788617700f40d37057c34ec70
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-10-18T13:02:29+02:00

Commit Message:
SDL/DISPMANX Corrected configure script so Scummvm cross-compiles with modern Raspbian that uses multiarch.

Changed paths:
    configure



diff --git a/configure b/configure
index 2631a29..3f39841 100755
--- a/configure
+++ b/configure
@@ -1303,7 +1303,9 @@ arm-riscos)
 raspberrypi)
 	_host_os=linux
 	_host_cpu=arm
-	_host_alias=arm-linux-gnueabihf
+	# This tuple is the one used by the official Rpi toolchain.
+	# It may change in the future.
+	_host_alias=bcm2708hardfp
 	;;
 caanoo)
 	_host_os=gph-linux
@@ -2549,8 +2551,18 @@ if test -n "$_host"; then
 			_port_mk="backends/platform/dingux/dingux.mk"
 			;;
 		raspberrypi)
-			# For proper cross-compilation, we assume that the cross-building environment provides 
-			# an sdl-config executable with modified prefix pointing to $RPI_ROOT/usr.
+			# This is needed because the official cross compiler doesn't have multiarch enabled
+			# but Raspbian does.
+			# Be careful as it's the linker (LDFLAGS) which must know about sysroot.	
+			# These are needed to build against Raspbian's libSDL even if we don't activate 
+			# dispmanx support. 
+			LDFLAGS="$LDFLAGS --sysroot=$RPI_ROOT"
+			LDFLAGS="$LDFLAGS -B$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
+			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
+			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf"
+			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib"
+			LDFLAGS="$LDFLAGS -L$RPI_ROOT/opt/vc/lib"
+			LDFLAGS="$LDFLAGS -L/opt/rpi_root/lib/arm-linux-gnueabihf -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos"
 			_savegame_timestamp=no
 			_eventrec=no
 			_build_scalers=no
@@ -3002,10 +3014,6 @@ case $_backend in
 		LIBS="$LIBS -lpng"
 		LIBS="$LIBS -Wl,-Map,mapfile.txt"
 		;;
-	raspberrypi)
-		LIBS="$LIBS -L$RPI_ROOT/usr/lib"
-		LIBS="$LIBS -L$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
-		;;
 	samsungtv)
 		DEFINES="$DEFINES -DSAMSUNGTV"
 		LDFLAGS="$LDFLAGS -shared"
@@ -4074,12 +4082,16 @@ fi
 define_in_config_if_yes "$_opengl" "USE_OPENGL"
 define_in_config_if_yes "$_opengles" "USE_GLES"
 
-# Check if Raspberry Pi dispmanx has been activated. 
+# Check if Raspberry Pi's Dispmanx graphics have been enabled and everything is in place. 
 if test "$_dispmanx" = "yes" ; then
 		echocheck "DispmanX graphics"
 		_use_dispmanx=no
-		DISPMANX_CXXFLAGS="-I$RPI_ROOT/opt/vc/include -I$RPI_ROOT/opt/vc/include/interface/vmcs_host/linux/ -I$RPI_ROOT/opt/vc/include/interface/vcos/pthreads -I$RPI_ROOT/opt/rpi_root/usr/include/SDL"
-		DISPMANX_LIBS="--sysroot=$RPI_ROOT -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
+
+		# These are only needed if, appart from cross-building for Raspberry Pi,
+		# we are activating dispmanx support.
+		DISPMANX_CXXFLAGS="-I$RPI_ROOT/usr/include/arm-linux-gnueabihf -I$RPI_ROOT/opt/vc/include -I$RPI_ROOT/opt/vc/include/interface/vmcs_host/linux -I$RPI_ROOT/opt/vc/include/interface/vcos/pthreads -I$RPI_ROOT/usr/include/SDL"
+		DISPMANX_LIBS="$RPI_LIBS -L/opt/rpi_root/lib/arm-linux-gnueabihf -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
+		
 		cat > $TMPC << EOF
 #include <bcm_host.h>
 
@@ -4094,6 +4106,7 @@ EOF
 			DEFINES="$DEFINES -DRASPBERRYPI"
 			add_line_to_config_mk 'RASPBERRYPI = 1'
 			echo $_use_dispmanx
+		else echo "no"
 		fi
 fi
 


Commit: a4bfef8c53021c85d3d0c36cd5cc8c08e6139b0a
    https://github.com/scummvm/scummvm/commit/a4bfef8c53021c85d3d0c36cd5cc8c08e6139b0a
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-10-18T19:31:08+02:00

Commit Message:
SDL/DISPMANX Removed a redundant and unused configure parameter info related to dispmanx.

Changed paths:
    configure



diff --git a/configure b/configure
index 3f39841..b6e2104 100755
--- a/configure
+++ b/configure
@@ -946,8 +946,6 @@ Optional Libraries:
   --with-opengl-prefix=DIR Prefix where OpenGL (ES) is installed (optional)
   --disable-opengl         disable OpenGL (ES) support [autodetect]
 
-  --with-dispmanx          enable dispmanx (Raspberry Pi native 2D API) rendering 
-
   --with-jpeg-prefix=DIR   Prefix where libjpeg is installed (optional)
   --disable-jpeg           disable JPEG decoder [autodetect]
 


Commit: c362119572228721e45087d1a835231512b8edab
    https://github.com/scummvm/scummvm/commit/c362119572228721e45087d1a835231512b8edab
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-10-18T20:25:53+02:00

Commit Message:
SDL/DISPMANX Renamed the RASBERRYPI define to the less confusing name of DISPMANX because it controls whether dispmanx rendering backend is enabled or not on the Raspberry Pi.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/module.mk
    backends/platform/sdl/module.mk
    backends/platform/sdl/posix/posix-main.cpp
    backends/platform/sdl/raspberrypi/README.RASPBERRYPI
    backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
    backends/platform/sdl/raspberrypi/raspberrypi.cpp
    backends/platform/sdl/raspberrypi/raspberrypi.h
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 28f1cc1..7e208db 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -25,7 +25,7 @@
 
 #include "common/scummsys.h"
 
-#if defined(RASPBERRYPI)
+#if defined(DISPMANX)
 
 #include "backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h"
 #include "graphics/scaler/aspect.h"
diff --git a/backends/module.mk b/backends/module.mk
index 979bce5..8f3677f 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -127,7 +127,7 @@ MODULE_OBJS += \
 	mixer/sdl13/sdl13-mixer.o
 endif
 
-ifdef RASPBERRYPI
+ifdef DISPMANX
 MODULE_OBJS += \
 	graphics/dispmanxsdl/dispmanxsdl-graphics.o
 endif
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index d87ec6b..04911f8 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -34,7 +34,7 @@ MODULE_OBJS += \
 	ps3/ps3.o
 endif
 
-ifdef RASPBERRYPI
+ifdef DISPMANX
 MODULE_OBJS += \
 	raspberrypi/raspberrypi-main.o \
 	raspberrypi/raspberrypi.o
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index 0785f36..492da70 100644
--- a/backends/platform/sdl/posix/posix-main.cpp
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -22,7 +22,7 @@
 
 #include "common/scummsys.h"
 
-#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(RASPBERRYPI)
+#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(DISPMANX)
 
 #include "backends/platform/sdl/posix/posix.h"
 #include "backends/plugins/sdl/sdl-provider.h"
diff --git a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
index d67a5ab..1b3a30c 100644
--- a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
+++ b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
@@ -95,6 +95,5 @@ NOTE: Distcc is my preferred method as it does cross-compiling totally transpare
 (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/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp b/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
index 7d2eff9..cddbcb7 100644
--- a/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
+++ b/backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
@@ -25,7 +25,7 @@
 #include "common/scummsys.h"
 #include "base/main.h"
 
-#if defined(RASPBERRYPI)
+#if defined(DISPMANX)
 int main(int argc, char* argv[]) {
 	
 	// Create our OSystem instance
diff --git a/backends/platform/sdl/raspberrypi/raspberrypi.cpp b/backends/platform/sdl/raspberrypi/raspberrypi.cpp
index 2405dfa..a3f79fd 100644
--- a/backends/platform/sdl/raspberrypi/raspberrypi.cpp
+++ b/backends/platform/sdl/raspberrypi/raspberrypi.cpp
@@ -20,7 +20,7 @@
  *
  */
 
-#if defined(RASPBERRYPI)
+#if defined(DISPMANX)
 
 #include "backends/platform/sdl/raspberrypi/raspberrypi.h"
 #include "backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h"
diff --git a/backends/platform/sdl/raspberrypi/raspberrypi.h b/backends/platform/sdl/raspberrypi/raspberrypi.h
index b8070e8..45e2c50 100644
--- a/backends/platform/sdl/raspberrypi/raspberrypi.h
+++ b/backends/platform/sdl/raspberrypi/raspberrypi.h
@@ -20,10 +20,10 @@
  *
  */
 
-#ifndef SDL_RASPBERRYPI_COMMON_H
-#define SDL_RASPBERRYPI_COMMON_H
+#ifndef SDL_DISPMANX_COMMON_H
+#define SDL_DISPMANX_COMMON_H
 
-#if defined(RASPBERRYPI)
+#if defined(DISPMANX)
 #include "backends/platform/sdl/posix/posix.h"
 
 class OSystem_SDL_RaspberryPi : public OSystem_POSIX {
@@ -31,5 +31,5 @@ public:
 	void initBackend();
 };
 
-#endif /* RASPBERRYPI */
-#endif /* SDL_RASPBERRYPI_COMMON_H */
+#endif /* DISPMANX */
+#endif /* SDL_DISPMANX_COMMON_H */
diff --git a/configure b/configure
index b6e2104..11c4f1c 100755
--- a/configure
+++ b/configure
@@ -4081,6 +4081,7 @@ define_in_config_if_yes "$_opengl" "USE_OPENGL"
 define_in_config_if_yes "$_opengles" "USE_GLES"
 
 # Check if Raspberry Pi's Dispmanx graphics have been enabled and everything is in place. 
+# If dispmanx is disabled, we fall back to plain SDL rendering.
 if test "$_dispmanx" = "yes" ; then
 		echocheck "DispmanX graphics"
 		_use_dispmanx=no
@@ -4101,8 +4102,8 @@ EOF
 		if test "$_use_dispmanx" = "yes"; then
 			CXXFLAGS="$CXXFLAGS $DISPMANX_CXXFLAGS"
 			LIBS="$LIBS $DISPMANX_LIBS"
-			DEFINES="$DEFINES -DRASPBERRYPI"
-			add_line_to_config_mk 'RASPBERRYPI = 1'
+			DEFINES="$DEFINES -DDISPMANX"
+			add_line_to_config_mk 'DISPMANX = 1'
 			echo $_use_dispmanx
 		else echo "no"
 		fi


Commit: c2c95cc95b779113a6af43a40d8f1ea486e572d8
    https://github.com/scummvm/scummvm/commit/c2c95cc95b779113a6af43a40d8f1ea486e572d8
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-10-19T12:12:54+02:00

Commit Message:
SDL/DISPMANX Fixed dispmanx activation parameter on README.RASPBERRYPI

Changed paths:
    backends/platform/sdl/raspberrypi/README.RASPBERRYPI



diff --git a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
index 1b3a30c..82217b7 100644
--- a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
+++ b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
@@ -77,7 +77,7 @@ Local compilation would simply consist of the "standard" GNU/Linux building proc
 
 cd <sources_dir>
 
-./configure --backend=raspberrypi -disable-debug --enable-release 
+./configure --enable-dispmanx -disable-debug --enable-release 
 --enable-optimizations --disable-mt32emu --disable-flac --disable-mad --disable-vorbis 
 --disable-tremor --disable-fluidsynth --disable-taskbar --disable-timidity --disable-alsa
 


Commit: 37e157a11c3fc731dfdcf6ec6b6a5a448550219b
    https://github.com/scummvm/scummvm/commit/37e157a11c3fc731dfdcf6ec6b6a5a448550219b
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-10-20T21:15:26+02:00

Commit Message:
SDL/DISPMANX Make additional notes on README.RASPBERRYPI telling users to manually disable some features that are sub-optimal on the Pi when they don't pass a host parameter

Changed paths:
    backends/platform/sdl/raspberrypi/README.RASPBERRYPI



diff --git a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
index 82217b7..f8d872b 100644
--- a/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
+++ b/backends/platform/sdl/raspberrypi/README.RASPBERRYPI
@@ -79,10 +79,17 @@ cd <sources_dir>
 
 ./configure --enable-dispmanx -disable-debug --enable-release 
 --enable-optimizations --disable-mt32emu --disable-flac --disable-mad --disable-vorbis 
---disable-tremor --disable-fluidsynth --disable-taskbar --disable-timidity --disable-alsa
+--disable-tremor --disable-fluidsynth --disable-taskbar --disable-timidity --disable-alsa 
+--disable-scalers --disable-hq-scalers --disable-savegame-timestamp --disable-eventrecorder
 
 make
 
+As you can see, we're manually disabling scalers because we prefer dispmanx for that, which 
+makes scalers unnecessary on a CPU limited platform like this, timestamps because most people
+doesn't have an RTC on the Raspberry Pi, and event recorder to save SD card write cycles.
+All these are automatically disabled when we crosscompile by passing "--host=raspberrypi",
+which is not the case.
+
 ¡¡It will be an SLOW process, taking several hours to complete, unless you
 are running distcc against a fast compilation server!!
 


Commit: 99739a13fe844c807d3cdd87e67e207e888fd48a
    https://github.com/scummvm/scummvm/commit/99739a13fe844c807d3cdd87e67e207e888fd48a
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-11-11T17:56:12+01:00

Commit Message:
Merge branch 'master' into dispmanx

Changed paths:
  A audio/adlib.cpp
  A audio/alsa_opl.cpp
  A audio/decoders/3do.cpp
  A audio/decoders/3do.h
  A audio/miles.h
  A audio/miles_adlib.cpp
  A audio/miles_mt32.cpp
  A backends/platform/sdl/sdl-window.cpp
  A backends/platform/sdl/sdl-window.h
  A backends/platform/sdl/win32/win32-window.cpp
  A backends/platform/sdl/win32/win32-window.h
  A devtools/create_project/msvc14/create_project.sln
  A devtools/create_project/msvc14/create_project.vcxproj
  A devtools/create_project/msvc14/create_project.vcxproj.filters
  A dists/engine-data/testbed-audiocd-files/TESTBED
  A dists/msvc14/create_msvc14.bat
  A dists/msvc14/readme.txt
  A doc/de/Spieletitel Original-Deutsch Deutsch-Original
  A engines/access/martian/martian_player.cpp
  A engines/access/martian/martian_player.h
  A engines/agos/drivers/accolade/adlib.cpp
  A engines/agos/drivers/accolade/driverfile.cpp
  A engines/agos/drivers/accolade/mididriver.h
  A engines/agos/drivers/accolade/mt32.cpp
  A engines/agos/drivers/simon1/adlib.cpp
  A engines/agos/drivers/simon1/adlib.h
  A engines/mads/phantom/globals_phantom.cpp
  A engines/mads/phantom/globals_phantom.h
  A engines/mads/phantom/phantom_scenes1.cpp
  A engines/mads/phantom/phantom_scenes1.h
  A engines/queen/midiadlib.h
  A engines/sherlock/animation.cpp
  A engines/sherlock/animation.h
  A engines/sherlock/configure.engine
  A engines/sherlock/debugger.cpp
  A engines/sherlock/debugger.h
  A engines/sherlock/decompress.cpp
  A engines/sherlock/detection.cpp
  A engines/sherlock/detection_tables.h
  A engines/sherlock/events.cpp
  A engines/sherlock/events.h
  A engines/sherlock/fixed_text.cpp
  A engines/sherlock/fixed_text.h
  A engines/sherlock/fonts.cpp
  A engines/sherlock/fonts.h
  A engines/sherlock/image_file.cpp
  A engines/sherlock/image_file.h
  A engines/sherlock/inventory.cpp
  A engines/sherlock/inventory.h
  A engines/sherlock/journal.cpp
  A engines/sherlock/journal.h
  A engines/sherlock/map.cpp
  A engines/sherlock/map.h
  A engines/sherlock/module.mk
  A engines/sherlock/music.cpp
  A engines/sherlock/music.h
  A engines/sherlock/objects.cpp
  A engines/sherlock/objects.h
  A engines/sherlock/people.cpp
  A engines/sherlock/people.h
  A engines/sherlock/resources.cpp
  A engines/sherlock/resources.h
  A engines/sherlock/saveload.cpp
  A engines/sherlock/saveload.h
  A engines/sherlock/scalpel/3do/movie_decoder.cpp
  A engines/sherlock/scalpel/3do/movie_decoder.h
  A engines/sherlock/scalpel/drivers/adlib.cpp
  A engines/sherlock/scalpel/drivers/mididriver.h
  A engines/sherlock/scalpel/drivers/mt32.cpp
  A engines/sherlock/scalpel/scalpel.cpp
  A engines/sherlock/scalpel/scalpel.h
  A engines/sherlock/scalpel/scalpel_darts.cpp
  A engines/sherlock/scalpel/scalpel_darts.h
  A engines/sherlock/scalpel/scalpel_debugger.cpp
  A engines/sherlock/scalpel/scalpel_debugger.h
  A engines/sherlock/scalpel/scalpel_fixed_text.cpp
  A engines/sherlock/scalpel/scalpel_fixed_text.h
  A engines/sherlock/scalpel/scalpel_inventory.cpp
  A engines/sherlock/scalpel/scalpel_inventory.h
  A engines/sherlock/scalpel/scalpel_journal.cpp
  A engines/sherlock/scalpel/scalpel_journal.h
  A engines/sherlock/scalpel/scalpel_map.cpp
  A engines/sherlock/scalpel/scalpel_map.h
  A engines/sherlock/scalpel/scalpel_people.cpp
  A engines/sherlock/scalpel/scalpel_people.h
  A engines/sherlock/scalpel/scalpel_saveload.cpp
  A engines/sherlock/scalpel/scalpel_saveload.h
  A engines/sherlock/scalpel/scalpel_scene.cpp
  A engines/sherlock/scalpel/scalpel_scene.h
  A engines/sherlock/scalpel/scalpel_screen.cpp
  A engines/sherlock/scalpel/scalpel_screen.h
  A engines/sherlock/scalpel/scalpel_talk.cpp
  A engines/sherlock/scalpel/scalpel_talk.h
  A engines/sherlock/scalpel/scalpel_user_interface.cpp
  A engines/sherlock/scalpel/scalpel_user_interface.h
  A engines/sherlock/scalpel/settings.cpp
  A engines/sherlock/scalpel/settings.h
  A engines/sherlock/scalpel/tsage/logo.cpp
  A engines/sherlock/scalpel/tsage/logo.h
  A engines/sherlock/scalpel/tsage/resources.cpp
  A engines/sherlock/scalpel/tsage/resources.h
  A engines/sherlock/scene.cpp
  A engines/sherlock/scene.h
  A engines/sherlock/screen.cpp
  A engines/sherlock/screen.h
  A engines/sherlock/sherlock.cpp
  A engines/sherlock/sherlock.h
  A engines/sherlock/sound.cpp
  A engines/sherlock/sound.h
  A engines/sherlock/surface.cpp
  A engines/sherlock/surface.h
  A engines/sherlock/talk.cpp
  A engines/sherlock/talk.h
  A engines/sherlock/tattoo/tattoo.cpp
  A engines/sherlock/tattoo/tattoo.h
  A engines/sherlock/tattoo/tattoo_darts.cpp
  A engines/sherlock/tattoo/tattoo_darts.h
  A engines/sherlock/tattoo/tattoo_debugger.cpp
  A engines/sherlock/tattoo/tattoo_debugger.h
  A engines/sherlock/tattoo/tattoo_fixed_text.cpp
  A engines/sherlock/tattoo/tattoo_fixed_text.h
  A engines/sherlock/tattoo/tattoo_inventory.cpp
  A engines/sherlock/tattoo/tattoo_inventory.h
  A engines/sherlock/tattoo/tattoo_journal.cpp
  A engines/sherlock/tattoo/tattoo_journal.h
  A engines/sherlock/tattoo/tattoo_map.cpp
  A engines/sherlock/tattoo/tattoo_map.h
  A engines/sherlock/tattoo/tattoo_people.cpp
  A engines/sherlock/tattoo/tattoo_people.h
  A engines/sherlock/tattoo/tattoo_resources.cpp
  A engines/sherlock/tattoo/tattoo_resources.h
  A engines/sherlock/tattoo/tattoo_scene.cpp
  A engines/sherlock/tattoo/tattoo_scene.h
  A engines/sherlock/tattoo/tattoo_talk.cpp
  A engines/sherlock/tattoo/tattoo_talk.h
  A engines/sherlock/tattoo/tattoo_user_interface.cpp
  A engines/sherlock/tattoo/tattoo_user_interface.h
  A engines/sherlock/tattoo/widget_base.cpp
  A engines/sherlock/tattoo/widget_base.h
  A engines/sherlock/tattoo/widget_credits.cpp
  A engines/sherlock/tattoo/widget_credits.h
  A engines/sherlock/tattoo/widget_files.cpp
  A engines/sherlock/tattoo/widget_files.h
  A engines/sherlock/tattoo/widget_foolscap.cpp
  A engines/sherlock/tattoo/widget_foolscap.h
  A engines/sherlock/tattoo/widget_inventory.cpp
  A engines/sherlock/tattoo/widget_inventory.h
  A engines/sherlock/tattoo/widget_lab.cpp
  A engines/sherlock/tattoo/widget_lab.h
  A engines/sherlock/tattoo/widget_options.cpp
  A engines/sherlock/tattoo/widget_options.h
  A engines/sherlock/tattoo/widget_password.cpp
  A engines/sherlock/tattoo/widget_password.h
  A engines/sherlock/tattoo/widget_quit.cpp
  A engines/sherlock/tattoo/widget_quit.h
  A engines/sherlock/tattoo/widget_talk.cpp
  A engines/sherlock/tattoo/widget_talk.h
  A engines/sherlock/tattoo/widget_text.cpp
  A engines/sherlock/tattoo/widget_text.h
  A engines/sherlock/tattoo/widget_tooltip.cpp
  A engines/sherlock/tattoo/widget_tooltip.h
  A engines/sherlock/tattoo/widget_verbs.cpp
  A engines/sherlock/tattoo/widget_verbs.h
  A engines/sherlock/user_interface.cpp
  A engines/sherlock/user_interface.h
  A engines/tsage/sherlock/sherlock_logo.cpp
  A engines/tsage/sherlock/sherlock_logo.h
  A engines/zvision/detection_tables.h
  A gui/filebrowser-dialog.cpp
  A gui/filebrowser-dialog.h
  A image/codecs/cinepak_tables.h
  R audio/softsynth/adlib.cpp
  R backends/platform/android/org/scummvm/scummvm/PluginProvider.java
  R backends/platform/android/org/scummvm/scummvm/ScummVMApplication.java
  R backends/platform/android/org/scummvm/scummvm/Unpacker.java
  R dists/android/mkplugin.sh
  R dists/android/plugin-manifest.xml
  R dists/android/plugin-manifest.xml.in
  R dists/android/plugin-strings.xml
  R dists/android/res/drawable/gradient.xml
  R dists/android/res/layout/splash.xml
  R dists/iphone/readme.txt
  R dists/iphone/scummvm.xcodeproj/project.pbxproj
  R engines/zvision/detection.h
    AUTHORS
    COPYRIGHT
    Makefile
    NEWS
    README
    audio/audiostream.cpp
    audio/audiostream.h
    audio/decoders/adpcm.cpp
    audio/decoders/adpcm.h
    audio/decoders/aiff.cpp
    audio/decoders/aiff.h
    audio/decoders/codec.h
    audio/decoders/mp3.cpp
    audio/decoders/mp3.h
    audio/decoders/quicktime.cpp
    audio/decoders/raw.cpp
    audio/decoders/raw.h
    audio/decoders/wave.h
    audio/fmopl.cpp
    audio/fmopl.h
    audio/midiparser.h
    audio/midiparser_xmidi.cpp
    audio/mods/protracker.cpp
    audio/module.mk
    audio/rate.cpp
    audio/rate_arm.cpp
    audio/rate_arm_asm.s
    audio/softsynth/fmtowns_pc98/towns_audio.cpp
    audio/softsynth/fmtowns_pc98/towns_euphony.cpp
    audio/softsynth/fmtowns_pc98/towns_euphony.h
    audio/softsynth/opl/dosbox.cpp
    audio/softsynth/opl/dosbox.h
    audio/softsynth/opl/mame.cpp
    audio/softsynth/opl/mame.h
    backends/audiocd/sdl/sdl-audiocd.cpp
    backends/audiocd/sdl/sdl-audiocd.h
    backends/events/sdl/sdl-events.cpp
    backends/events/sdl/sdl-events.h
    backends/events/symbiansdl/symbiansdl-events.cpp
    backends/fs/amigaos4/amigaos4-fs.cpp
    backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
    backends/graphics/dinguxsdl/dinguxsdl-graphics.h
    backends/graphics/gph/gph-graphics.cpp
    backends/graphics/gph/gph-graphics.h
    backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
    backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
    backends/graphics/maemosdl/maemosdl-graphics.cpp
    backends/graphics/maemosdl/maemosdl-graphics.h
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/openglsdl/openglsdl-graphics.h
    backends/graphics/openpandora/op-graphics.cpp
    backends/graphics/openpandora/op-graphics.h
    backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
    backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h
    backends/graphics/sdl/sdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/graphics/symbiansdl/symbiansdl-graphics.cpp
    backends/graphics/symbiansdl/symbiansdl-graphics.h
    backends/graphics/wincesdl/wincesdl-graphics.cpp
    backends/graphics/wincesdl/wincesdl-graphics.h
    backends/log/log.cpp
    backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp
    backends/mixer/sdl/sdl-mixer.cpp
    backends/module.mk
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/android.mk
    backends/platform/android/jni.cpp
    backends/platform/android/jni.h
    backends/platform/android/org/scummvm/scummvm/ScummVM.java
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
    backends/platform/dingux/dingux.cpp
    backends/platform/gph/gph-backend.cpp
    backends/platform/linuxmoto/linuxmoto-sdl.cpp
    backends/platform/maemo/maemo.cpp
    backends/platform/maemo/maemo.h
    backends/platform/openpandora/op-backend.cpp
    backends/platform/samsungtv/samsungtv.cpp
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx.h
    backends/platform/sdl/module.mk
    backends/platform/sdl/sdl-sys.h
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/sdl.h
    backends/platform/sdl/win32/win32-main.cpp
    backends/platform/sdl/win32/win32.cpp
    backends/platform/sdl/win32/win32.h
    backends/platform/symbian/README
    backends/platform/symbian/S60/ScummVM_S60.mmp.in
    backends/platform/symbian/S60/ScummVM_S60_App.mmp
    backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
    backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
    backends/platform/symbian/S80/ScummVM_S80.mmp.in
    backends/platform/symbian/S80/ScummVM_S80_App.mmp
    backends/platform/symbian/S90/Scummvm_S90.mmp.in
    backends/platform/symbian/S90/Scummvm_S90_App.mmp
    backends/platform/symbian/UIQ2/ScummVM.rss
    backends/platform/symbian/UIQ3/ScummVM.rss
    backends/platform/symbian/UIQ3/ScummVM_A0000658.rss
    backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in
    backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
    backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss
    backends/platform/symbian/mmp/config.mmh
    backends/platform/symbian/mmp/scummvm_agi.mmp.in
    backends/platform/symbian/mmp/scummvm_agos.mmp.in
    backends/platform/symbian/mmp/scummvm_avalanche.mmp.in
    backends/platform/symbian/mmp/scummvm_base.mmp.in
    backends/platform/symbian/mmp/scummvm_bbvs.mmp.in
    backends/platform/symbian/mmp/scummvm_cge.mmp.in
    backends/platform/symbian/mmp/scummvm_cge2.mmp.in
    backends/platform/symbian/mmp/scummvm_cine.mmp.in
    backends/platform/symbian/mmp/scummvm_composer.mmp.in
    backends/platform/symbian/mmp/scummvm_cruise.mmp.in
    backends/platform/symbian/mmp/scummvm_draci.mmp.in
    backends/platform/symbian/mmp/scummvm_drascula.mmp.in
    backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in
    backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in
    backends/platform/symbian/mmp/scummvm_gob.mmp.in
    backends/platform/symbian/mmp/scummvm_groovie.mmp.in
    backends/platform/symbian/mmp/scummvm_hopkins.mmp.in
    backends/platform/symbian/mmp/scummvm_hugo.mmp.in
    backends/platform/symbian/mmp/scummvm_kyra.mmp.in
    backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in
    backends/platform/symbian/mmp/scummvm_lure.mmp.in
    backends/platform/symbian/mmp/scummvm_m4.mmp.in
    backends/platform/symbian/mmp/scummvm_made.mmp.in
    backends/platform/symbian/mmp/scummvm_mads.mmp.in
    backends/platform/symbian/mmp/scummvm_mohawk.mmp.in
    backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in
    backends/platform/symbian/mmp/scummvm_neverhood.mmp.in
    backends/platform/symbian/mmp/scummvm_parallaction.mmp.in
    backends/platform/symbian/mmp/scummvm_pegasus.mmp.in
    backends/platform/symbian/mmp/scummvm_queen.mmp.in
    backends/platform/symbian/mmp/scummvm_saga.mmp.in
    backends/platform/symbian/mmp/scummvm_sci.mmp.in
    backends/platform/symbian/mmp/scummvm_scumm.mmp.in
    backends/platform/symbian/mmp/scummvm_sky.mmp.in
    backends/platform/symbian/mmp/scummvm_sword1.mmp.in
    backends/platform/symbian/mmp/scummvm_sword2.mmp.in
    backends/platform/symbian/mmp/scummvm_sword25.mmp.in
    backends/platform/symbian/mmp/scummvm_teenagent.mmp.in
    backends/platform/symbian/mmp/scummvm_testbed.mmp.in
    backends/platform/symbian/mmp/scummvm_tinsel.mmp.in
    backends/platform/symbian/mmp/scummvm_toltecs.mmp.in
    backends/platform/symbian/mmp/scummvm_tony.mmp.in
    backends/platform/symbian/mmp/scummvm_toon.mmp.in
    backends/platform/symbian/mmp/scummvm_touche.mmp.in
    backends/platform/symbian/mmp/scummvm_tsage.mmp.in
    backends/platform/symbian/mmp/scummvm_tucker.mmp.in
    backends/platform/symbian/mmp/scummvm_voyeur.mmp.in
    backends/platform/symbian/mmp/scummvm_wintermute.mmp.in
    backends/platform/symbian/mmp/scummvm_zvision.mmp.in
    backends/platform/symbian/res/ScummVmAif.rss
    backends/platform/symbian/res/scummvm.rss
    backends/platform/symbian/res/scummvm_A0000658.rss
    backends/platform/symbian/src/ScummVm.hrh
    backends/platform/symbian/src/SymbianOS.cpp
    backends/platform/symbian/src/SymbianOS.h
    backends/platform/symbian/src/portdefs.h
    backends/platform/wince/wince-sdl.cpp
    backends/saves/default/default-saves.cpp
    backends/taskbar/win32/win32-taskbar.cpp
    backends/taskbar/win32/win32-taskbar.h
    base/main.cpp
    common/algorithm.h
    common/dcl.cpp
    common/dcl.h
    common/endian.h
    common/fft.cpp
    common/fft.h
    common/scummsys.h
    common/xmlparser.cpp
    configure
    devtools/README
    devtools/create_kyradat/create_kyradat.cpp
    devtools/create_kyradat/resources/lok_pc98_japanese.h
    devtools/create_mortdat/create_mortdat.cpp
    devtools/create_mortdat/menudata.h
    devtools/create_project/create_project.cpp
    devtools/create_project/msbuild.cpp
    devtools/create_project/msbuild.h
    devtools/create_project/msvc.cpp
    devtools/create_project/msvc.h
    devtools/create_project/visualstudio.cpp
    devtools/create_project/xcode.cpp
    devtools/create_project/xcode.h
    devtools/credits.pl
    devtools/scumm-md5.txt
    dists/android/AndroidManifest.xml
    dists/android/AndroidManifest.xml.in
    dists/android/jni/Android.mk
    dists/codeblocks/readme.txt
    dists/debian/copyright
    dists/engine-data/kyra.dat
    dists/engine-data/mort.dat
    dists/macosx/Info.plist
    dists/macosx/Info.plist.in
    dists/scummvm.rc
    dists/scummvm.rc.in
    dists/win32/scummvm.nsi
    dists/win32/scummvm.nsi.in
    doc/cz/PrectiMe
    doc/de/Liesmich
    doc/de/Neues
    engines/access/access.cpp
    engines/access/access.h
    engines/access/amazon/amazon_game.cpp
    engines/access/amazon/amazon_logic.cpp
    engines/access/amazon/amazon_player.cpp
    engines/access/amazon/amazon_resources.cpp
    engines/access/amazon/amazon_resources.h
    engines/access/amazon/amazon_scripts.cpp
    engines/access/amazon/amazon_scripts.h
    engines/access/asurface.cpp
    engines/access/asurface.h
    engines/access/bubble_box.cpp
    engines/access/bubble_box.h
    engines/access/char.cpp
    engines/access/char.h
    engines/access/decompress.cpp
    engines/access/decompress.h
    engines/access/detection_tables.h
    engines/access/files.cpp
    engines/access/files.h
    engines/access/inventory.cpp
    engines/access/inventory.h
    engines/access/martian/martian_game.cpp
    engines/access/martian/martian_game.h
    engines/access/martian/martian_resources.cpp
    engines/access/martian/martian_resources.h
    engines/access/martian/martian_room.cpp
    engines/access/martian/martian_room.h
    engines/access/martian/martian_scripts.cpp
    engines/access/martian/martian_scripts.h
    engines/access/module.mk
    engines/access/player.cpp
    engines/access/player.h
    engines/access/resources.cpp
    engines/access/resources.h
    engines/access/room.cpp
    engines/access/room.h
    engines/access/screen.cpp
    engines/access/screen.h
    engines/access/scripts.cpp
    engines/access/scripts.h
    engines/access/sound.cpp
    engines/access/sound.h
    engines/access/video.cpp
    engines/access/video.h
    engines/agi/agi.cpp
    engines/agi/agi.h
    engines/agi/detection.cpp
    engines/agi/detection_tables.h
    engines/agi/font.h
    engines/agi/graphics.cpp
    engines/agi/graphics.h
    engines/agi/preagi.cpp
    engines/agi/preagi_mickey.cpp
    engines/agi/sound_pcjr.cpp
    engines/agi/text.cpp
    engines/agos/agos.cpp
    engines/agos/detection_tables.h
    engines/agos/gfx.cpp
    engines/agos/input.cpp
    engines/agos/midi.cpp
    engines/agos/midi.h
    engines/agos/midiparser_s1d.cpp
    engines/agos/module.mk
    engines/agos/res_snd.cpp
    engines/agos/rooms.cpp
    engines/agos/saveload.cpp
    engines/agos/sound.cpp
    engines/agos/zones.cpp
    engines/bbvs/minigames/bbairguitar.cpp
    engines/bbvs/minigames/bbairguitar.h
    engines/bbvs/sound.h
    engines/cine/cine.cpp
    engines/cine/cine.h
    engines/cine/detection_tables.h
    engines/cine/main_loop.cpp
    engines/cine/saveload.cpp
    engines/cine/script_fw.cpp
    engines/cine/sound.cpp
    engines/cine/sound.h
    engines/cruise/sound.cpp
    engines/drascula/actors.cpp
    engines/drascula/talk.cpp
    engines/fullpipe/gameloader.cpp
    engines/fullpipe/interaction.cpp
    engines/fullpipe/lift.cpp
    engines/fullpipe/messagehandlers.cpp
    engines/fullpipe/modal.cpp
    engines/fullpipe/motion.cpp
    engines/fullpipe/motion.h
    engines/fullpipe/scene.cpp
    engines/fullpipe/scenes.cpp
    engines/fullpipe/scenes/scene04.cpp
    engines/fullpipe/scenes/scene06.cpp
    engines/fullpipe/scenes/scene08.cpp
    engines/fullpipe/scenes/scene09.cpp
    engines/fullpipe/scenes/scene10.cpp
    engines/fullpipe/scenes/scene11.cpp
    engines/fullpipe/scenes/scene14.cpp
    engines/fullpipe/scenes/scene16.cpp
    engines/fullpipe/scenes/scene18and19.cpp
    engines/fullpipe/scenes/scene22.cpp
    engines/fullpipe/scenes/scene23.cpp
    engines/fullpipe/scenes/scene25.cpp
    engines/fullpipe/scenes/scene26.cpp
    engines/fullpipe/scenes/scene27.cpp
    engines/fullpipe/scenes/scene28.cpp
    engines/fullpipe/scenes/scene29.cpp
    engines/fullpipe/scenes/scene32.cpp
    engines/fullpipe/scenes/scene34.cpp
    engines/fullpipe/scenes/sceneFinal.cpp
    engines/gob/gob.cpp
    engines/gob/map_v2.cpp
    engines/gob/sound/adlib.cpp
    engines/gob/sound/adlib.h
    engines/gob/sound/adlplayer.cpp
    engines/gob/sound/adlplayer.h
    engines/gob/sound/cdrom.cpp
    engines/gob/sound/musplayer.cpp
    engines/gob/sound/musplayer.h
    engines/gob/sound/sound.cpp
    engines/gob/sound/sound.h
    engines/gob/surface.cpp
    engines/gob/surface.h
    engines/groovie/music.cpp
    engines/groovie/music.h
    engines/hopkins/computer.cpp
    engines/hopkins/lines.cpp
    engines/hugo/mouse.cpp
    engines/kyra/sound_adlib.cpp
    engines/kyra/sound_intern.h
    engines/kyra/sound_towns.cpp
    engines/kyra/staticres.cpp
    engines/lastexpress/data/snd.cpp
    engines/lastexpress/data/snd.h
    engines/lure/res.h
    engines/made/database.cpp
    engines/made/made.cpp
    engines/made/music.cpp
    engines/made/music.h
    engines/made/pmvplayer.cpp
    engines/made/redreader.cpp
    engines/made/resource.cpp
    engines/made/screenfx.cpp
    engines/made/screenfx.h
    engines/made/script.cpp
    engines/made/script.h
    engines/made/scriptfuncs.cpp
    engines/made/sound.cpp
    engines/made/sound.h
    engines/mads/action.cpp
    engines/mads/action.h
    engines/mads/animation.cpp
    engines/mads/animation.h
    engines/mads/assets.cpp
    engines/mads/assets.h
    engines/mads/audio.cpp
    engines/mads/audio.h
    engines/mads/compression.cpp
    engines/mads/compression.h
    engines/mads/debugger.cpp
    engines/mads/debugger.h
    engines/mads/detection.cpp
    engines/mads/detection_tables.h
    engines/mads/dialogs.cpp
    engines/mads/dialogs.h
    engines/mads/dragonsphere/dragonsphere_scenes.cpp
    engines/mads/dragonsphere/dragonsphere_scenes.h
    engines/mads/dragonsphere/game_dragonsphere.cpp
    engines/mads/dragonsphere/game_dragonsphere.h
    engines/mads/events.cpp
    engines/mads/events.h
    engines/mads/font.cpp
    engines/mads/font.h
    engines/mads/game.cpp
    engines/mads/game.h
    engines/mads/game_data.cpp
    engines/mads/game_data.h
    engines/mads/globals.cpp
    engines/mads/globals.h
    engines/mads/hotspots.cpp
    engines/mads/hotspots.h
    engines/mads/inventory.cpp
    engines/mads/inventory.h
    engines/mads/mads.cpp
    engines/mads/mads.h
    engines/mads/menu_views.cpp
    engines/mads/menu_views.h
    engines/mads/messages.cpp
    engines/mads/messages.h
    engines/mads/module.mk
    engines/mads/msurface.cpp
    engines/mads/msurface.h
    engines/mads/nebular/dialogs_nebular.cpp
    engines/mads/nebular/dialogs_nebular.h
    engines/mads/nebular/game_nebular.cpp
    engines/mads/nebular/game_nebular.h
    engines/mads/nebular/globals_nebular.cpp
    engines/mads/nebular/globals_nebular.h
    engines/mads/nebular/menu_nebular.cpp
    engines/mads/nebular/menu_nebular.h
    engines/mads/nebular/nebular_scenes.cpp
    engines/mads/nebular/nebular_scenes.h
    engines/mads/nebular/nebular_scenes1.cpp
    engines/mads/nebular/nebular_scenes1.h
    engines/mads/nebular/nebular_scenes2.cpp
    engines/mads/nebular/nebular_scenes2.h
    engines/mads/nebular/nebular_scenes3.cpp
    engines/mads/nebular/nebular_scenes3.h
    engines/mads/nebular/nebular_scenes4.cpp
    engines/mads/nebular/nebular_scenes4.h
    engines/mads/nebular/nebular_scenes5.cpp
    engines/mads/nebular/nebular_scenes5.h
    engines/mads/nebular/nebular_scenes6.cpp
    engines/mads/nebular/nebular_scenes6.h
    engines/mads/nebular/nebular_scenes7.cpp
    engines/mads/nebular/nebular_scenes7.h
    engines/mads/nebular/nebular_scenes8.cpp
    engines/mads/nebular/nebular_scenes8.h
    engines/mads/nebular/sound_nebular.cpp
    engines/mads/nebular/sound_nebular.h
    engines/mads/palette.cpp
    engines/mads/palette.h
    engines/mads/phantom/game_phantom.cpp
    engines/mads/phantom/game_phantom.h
    engines/mads/phantom/phantom_scenes.cpp
    engines/mads/phantom/phantom_scenes.h
    engines/mads/player.cpp
    engines/mads/player.h
    engines/mads/rails.cpp
    engines/mads/rails.h
    engines/mads/resources.cpp
    engines/mads/resources.h
    engines/mads/scene.cpp
    engines/mads/scene.h
    engines/mads/scene_data.cpp
    engines/mads/scene_data.h
    engines/mads/screen.cpp
    engines/mads/screen.h
    engines/mads/sequence.cpp
    engines/mads/sequence.h
    engines/mads/sound.cpp
    engines/mads/sound.h
    engines/mads/sprites.cpp
    engines/mads/sprites.h
    engines/mads/staticres.cpp
    engines/mads/staticres.h
    engines/mads/user_interface.cpp
    engines/mads/user_interface.h
    engines/mohawk/configure.engine
    engines/mohawk/console.cpp
    engines/mohawk/cursors.cpp
    engines/mohawk/detection_tables.h
    engines/mohawk/livingbooks.cpp
    engines/mohawk/livingbooks_code.cpp
    engines/mohawk/livingbooks_code.h
    engines/mohawk/myst.cpp
    engines/mohawk/myst_areas.cpp
    engines/mohawk/myst_graphics.cpp
    engines/mohawk/myst_graphics.h
    engines/mohawk/myst_stacks/channelwood.cpp
    engines/mohawk/myst_stacks/dni.cpp
    engines/mohawk/myst_stacks/intro.cpp
    engines/mohawk/myst_stacks/mechanical.cpp
    engines/mohawk/myst_stacks/myst.cpp
    engines/mohawk/myst_stacks/stoneship.cpp
    engines/mohawk/riven.cpp
    engines/mohawk/riven_external.cpp
    engines/mohawk/riven_scripts.cpp
    engines/mohawk/sound.cpp
    engines/mohawk/sound.h
    engines/mohawk/video.cpp
    engines/mohawk/video.h
    engines/mortevielle/actions.cpp
    engines/mortevielle/detection_tables.h
    engines/mortevielle/dialogs.cpp
    engines/mortevielle/graphics.cpp
    engines/mortevielle/menu.cpp
    engines/mortevielle/mortevielle.h
    engines/mortevielle/outtext.cpp
    engines/mortevielle/sound.cpp
    engines/mortevielle/utils.cpp
    engines/neverhood/menumodule.cpp
    engines/neverhood/menumodule.h
    engines/neverhood/modules/module2700.cpp
    engines/neverhood/modules/module2700.h
    engines/parallaction/adlib.cpp
    engines/pegasus/menu.cpp
    engines/pegasus/sound.cpp
    engines/queen/midiadlib.cpp
    engines/queen/music.cpp
    engines/queen/walk.cpp
    engines/saga/detection_tables.h
    engines/saga/introproc_ihnm.cpp
    engines/saga/introproc_ite.cpp
    engines/saga/music.cpp
    engines/saga/music.h
    engines/saga/saga.cpp
    engines/saga/saga.h
    engines/saga/scene.cpp
    engines/saga/scene.h
    engines/saga/script.cpp
    engines/saga/sndres.cpp
    engines/sci/console.cpp
    engines/sci/console.h
    engines/sci/detection.cpp
    engines/sci/detection_tables.h
    engines/sci/engine/file.cpp
    engines/sci/engine/kernel.cpp
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kevent.cpp
    engines/sci/engine/kfile.cpp
    engines/sci/engine/kgraphics.cpp
    engines/sci/engine/kmovement.cpp
    engines/sci/engine/kparse.cpp
    engines/sci/engine/kvideo.cpp
    engines/sci/engine/savegame.cpp
    engines/sci/engine/savegame.h
    engines/sci/engine/script.cpp
    engines/sci/engine/script.h
    engines/sci/engine/script_patches.cpp
    engines/sci/engine/script_patches.h
    engines/sci/engine/state.cpp
    engines/sci/engine/state.h
    engines/sci/engine/vm.cpp
    engines/sci/engine/workarounds.cpp
    engines/sci/engine/workarounds.h
    engines/sci/graphics/paint16.cpp
    engines/sci/graphics/portrait.cpp
    engines/sci/graphics/screen.cpp
    engines/sci/graphics/screen.h
    engines/sci/graphics/transitions.cpp
    engines/sci/graphics/transitions.h
    engines/sci/parser/vocabulary.cpp
    engines/sci/parser/vocabulary.h
    engines/sci/resource.h
    engines/sci/resource_audio.cpp
    engines/sci/sci.cpp
    engines/sci/sci.h
    engines/sci/sound/audio.cpp
    engines/sci/sound/drivers/adlib.cpp
    engines/sci/sound/midiparser_sci.cpp
    engines/sci/sound/music.cpp
    engines/sci/sound/music.h
    engines/sci/sound/soundcmd.cpp
    engines/sci/sound/soundcmd.h
    engines/scumm/POTFILES
    engines/scumm/debugger.cpp
    engines/scumm/detection_tables.h
    engines/scumm/help.cpp
    engines/scumm/imuse_digi/dimuse.cpp
    engines/scumm/imuse_digi/dimuse_track.cpp
    engines/scumm/input.cpp
    engines/scumm/players/player_ad.cpp
    engines/scumm/players/player_ad.h
    engines/scumm/players/player_towns.cpp
    engines/scumm/players/player_towns.h
    engines/scumm/scumm-md5.h
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h
    engines/scumm/smush/smush_player.cpp
    engines/scumm/string.cpp
    engines/sky/music/adlibchannel.cpp
    engines/sky/music/adlibchannel.h
    engines/sky/music/adlibmusic.cpp
    engines/sky/music/adlibmusic.h
    engines/sword25/fmv/movieplayer.cpp
    engines/sword25/util/double_serialization.cpp
    engines/tinsel/music.cpp
    engines/tinsel/music.h
    engines/tinsel/tinsel.cpp
    engines/toltecs/music.cpp
    engines/toltecs/music.h
    engines/tony/mpal/mpal.cpp
    engines/tony/window.cpp
    engines/toon/anim.cpp
    engines/toon/character.cpp
    engines/toon/font.cpp
    engines/toon/toon.cpp
    engines/toon/toon.h
    engines/tsage/blue_force/blueforce_scenes8.cpp
    engines/tsage/blue_force/blueforce_scenes8.h
    engines/tsage/blue_force/blueforce_scenes9.cpp
    engines/tsage/core.cpp
    engines/tsage/detection.cpp
    engines/tsage/detection_tables.h
    engines/tsage/globals.cpp
    engines/tsage/graphics.cpp
    engines/tsage/graphics.h
    engines/tsage/module.mk
    engines/tsage/resources.h
    engines/tsage/ringworld/ringworld_scenes3.cpp
    engines/tsage/ringworld/ringworld_scenes3.h
    engines/tsage/sound.cpp
    engines/tsage/sound.h
    engines/tsage/tsage.cpp
    engines/tsage/tsage.h
    engines/tucker/staticres.cpp
    engines/tucker/tucker.h
    engines/voyeur/events.cpp
    engines/voyeur/files_threads.cpp
    engines/wintermute/base/base_file_manager.cpp
    engines/wintermute/base/base_keyboard_state.cpp
    engines/wintermute/base/base_keyboard_state.h
    engines/wintermute/base/base_script_holder.cpp
    engines/wintermute/base/file/base_file.cpp
    engines/wintermute/base/gfx/base_surface.cpp
    engines/wintermute/debugger.cpp
    engines/wintermute/detection_tables.h
    engines/wintermute/utils/convert_utf.cpp
    engines/wintermute/utils/convert_utf.h
    engines/zvision/POTFILES
    engines/zvision/configure.engine
    engines/zvision/core/clock.h
    engines/zvision/core/console.cpp
    engines/zvision/core/console.h
    engines/zvision/core/events.cpp
    engines/zvision/detection.cpp
    engines/zvision/file/lzss_read_stream.cpp
    engines/zvision/file/save_manager.cpp
    engines/zvision/file/save_manager.h
    engines/zvision/file/search_manager.cpp
    engines/zvision/graphics/cursors/cursor_manager.cpp
    engines/zvision/graphics/effects/fog.cpp
    engines/zvision/graphics/effects/wave.cpp
    engines/zvision/graphics/render_manager.cpp
    engines/zvision/graphics/render_manager.h
    engines/zvision/scripting/actions.cpp
    engines/zvision/scripting/actions.h
    engines/zvision/scripting/controls/fist_control.cpp
    engines/zvision/scripting/controls/input_control.cpp
    engines/zvision/scripting/controls/input_control.h
    engines/zvision/scripting/controls/lever_control.cpp
    engines/zvision/scripting/controls/safe_control.cpp
    engines/zvision/scripting/controls/titler_control.cpp
    engines/zvision/scripting/effects/distort_effect.cpp
    engines/zvision/scripting/effects/music_effect.cpp
    engines/zvision/scripting/effects/music_effect.h
    engines/zvision/scripting/effects/ttytext_effect.cpp
    engines/zvision/scripting/effects/ttytext_effect.h
    engines/zvision/scripting/menu.cpp
    engines/zvision/scripting/menu.h
    engines/zvision/scripting/scr_file_handling.cpp
    engines/zvision/scripting/script_manager.cpp
    engines/zvision/scripting/script_manager.h
    engines/zvision/scripting/scripting_effect.h
    engines/zvision/sound/zork_raw.cpp
    engines/zvision/text/string_manager.h
    engines/zvision/text/subtitles.cpp
    engines/zvision/text/subtitles.h
    engines/zvision/text/text.cpp
    engines/zvision/text/text.h
    engines/zvision/text/truetype_font.cpp
    engines/zvision/text/truetype_font.h
    engines/zvision/video/rlf_decoder.cpp
    engines/zvision/video/video.cpp
    engines/zvision/video/zork_avi_decoder.cpp
    engines/zvision/video/zork_avi_decoder.h
    engines/zvision/zvision.cpp
    engines/zvision/zvision.h
    graphics/fonts/ttf.cpp
    gui/ThemeEngine.cpp
    gui/Tooltip.cpp
    gui/Tooltip.h
    gui/about.cpp
    gui/credits.h
    gui/debugger.cpp
    gui/debugger.h
    gui/dialog.cpp
    gui/launcher.cpp
    gui/module.mk
    gui/options.cpp
    gui/recorderdialog.cpp
    gui/themes/default.inc
    gui/themes/scummclassic.zip
    gui/themes/scummclassic/classic_layout.stx
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern.zip
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummmodern/scummmodern_layout_lowres.stx
    gui/themes/scummtheme.py
    gui/themes/translations.dat
    gui/widgets/editable.cpp
    gui/widgets/edittext.cpp
    icons/scummvm.info
    icons/scummvm_drawer.info
    image/codecs/cinepak.cpp
    image/codecs/cinepak.h
    image/codecs/codec.cpp
    image/codecs/codec.h
    image/codecs/qtrle.cpp
    image/codecs/qtrle.h
    image/codecs/rpza.cpp
    image/codecs/rpza.h
    po/POTFILES
    po/be_BY.po
    po/ca_ES.po
    po/cs_CZ.po
    po/da_DA.po
    po/de_DE.po
    po/es_ES.po
    po/eu.po
    po/fi_FI.po
    po/fr_FR.po
    po/gl_ES.po
    po/hu_HU.po
    po/it_IT.po
    po/nb_NO.po
    po/nl_NL.po
    po/nn_NO.po
    po/pl_PL.po
    po/pt_BR.po
    po/ru_RU.po
    po/scummvm.pot
    po/se_SE.po
    po/uk_UA.po
    ports.mk
    test/common/algorithm.h
    test/cxxtest/cxxtestgen.py
    video/avi_decoder.cpp
    video/avi_decoder.h
    video/mpegps_decoder.cpp
    video/mpegps_decoder.h
    video/qt_decoder.cpp
    video/qt_decoder.h
    video/theora_decoder.cpp
    video/theora_decoder.h
    video/video_decoder.cpp
    video/video_decoder.h



diff --cc configure
index 11c4f1c,a2f7364..99006e4
--- a/configure
+++ b/configure
@@@ -2548,42 -2559,21 +2570,42 @@@ if test -n "$_host"; the
  			_seq_midi=no
  			_port_mk="backends/platform/dingux/dingux.mk"
  			;;
 +		raspberrypi)
 +			# This is needed because the official cross compiler doesn't have multiarch enabled
 +			# but Raspbian does.
 +			# Be careful as it's the linker (LDFLAGS) which must know about sysroot.	
 +			# These are needed to build against Raspbian's libSDL even if we don't activate 
 +			# dispmanx support. 
 +			LDFLAGS="$LDFLAGS --sysroot=$RPI_ROOT"
 +			LDFLAGS="$LDFLAGS -B$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
 +			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
 +			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf"
 +			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib"
 +			LDFLAGS="$LDFLAGS -L$RPI_ROOT/opt/vc/lib"
 +			LDFLAGS="$LDFLAGS -L/opt/rpi_root/lib/arm-linux-gnueabihf -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos"
 +			_savegame_timestamp=no
 +			_eventrec=no
 +			_build_scalers=no
 +			_build_hq_scalers=no
 +			# It makes no sense to have both GL and dispmanx rendering support.
 +			_opengl=no
 +			_opengles=no
 +			;;
  		dreamcast)
- 			DEFINES="$DEFINES -DDISABLE_DEFAULT_SAVEFILEMANAGER"
- 			DEFINES="$DEFINES -DDISABLE_TEXT_CONSOLE"
- 			DEFINES="$DEFINES -DDISABLE_COMMAND_LINE"
+ 			append_var DEFINES "-DDISABLE_DEFAULT_SAVEFILEMANAGER"
+ 			append_var DEFINES "-DDISABLE_TEXT_CONSOLE"
+ 			append_var DEFINES "-DDISABLE_COMMAND_LINE"
  			# Enable serial debugging output only when --enable-debug is passed
  			if test "$_release_build" = yes -o "$_debug_build" != yes; then
- 				DEFINES="$DEFINES -DNOSERIAL"
+ 				append_var DEFINES "-DNOSERIAL"
  			fi
  			_optimization_level=-O3
- 			CXXFLAGS="$CXXFLAGS -funroll-loops"
- 			CXXFLAGS="$CXXFLAGS -fschedule-insns2"
- 			CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
- 			CXXFLAGS="$CXXFLAGS -fdelete-null-pointer-checks"
+ 			append_var CXXFLAGS "-funroll-loops"
+ 			append_var CXXFLAGS "-fschedule-insns2"
+ 			append_var CXXFLAGS "-fomit-frame-pointer"
+ 			append_var CXXFLAGS "-fdelete-null-pointer-checks"
  			# no-delayed-branch is a workaround for GCC bug #42841 - "SH: Assembler complains pcrel too far."
- 			CXXFLAGS="$CXXFLAGS -fno-delayed-branch"
+ 			append_var CXXFLAGS "-fno-delayed-branch"
  			_backend="dc"
  			_build_scalers=no
  			_mad=yes
diff --cc ports.mk
index c31a523,398a0c4..0ffc4bf
--- a/ports.mk
+++ b/ports.mk
@@@ -327,15 -329,7 +329,15 @@@ endi
  	@echo
  	@echo All is done.
  	@echo Now run
- 	@echo "\tgit commit 'DISTS: Generated Code::Blocks and MSVC project files'"
+ 	@echo "\tgit commit -m '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


Commit: 9d831d0c428df4f21272a3b7df2d1016f657b63f
    https://github.com/scummvm/scummvm/commit/9d831d0c428df4f21272a3b7df2d1016f657b63f
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-11-12T14:03:14+01:00

Commit Message:
SDL/DISPMANX Fixed small issues with merging: Use append_var, fix spacing issues and changed SurfaceSdlGraphicsManager constructor call parameters on DispmanXSdlGraphicsManager constructor.

Changed paths:
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
    backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
    backends/platform/sdl/raspberrypi/raspberrypi.cpp
    configure



diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
index 7e208db..3da536b 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
@@ -76,8 +76,8 @@ struct dispmanxPage {
 	struct dispvarsStruct *dispvars;
 };
 
-DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SurfaceSdlGraphicsManager(sdlEventSource) {
+DispmanXSdlGraphicsManager::DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window)
+ : SurfaceSdlGraphicsManager(sdlEventSource, window) {
 	_dispvars = new(dispvarsStruct);
 	dispmanXInit();
 }
diff --git a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
index 1866ec14..6a2ede2 100644
--- a/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
+++ b/backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
@@ -30,7 +30,7 @@ struct dispmanxPage;
 
 class DispmanXSdlGraphicsManager : public SurfaceSdlGraphicsManager {
 public:
-	DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource);
+	DispmanXSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window);
 	~DispmanXSdlGraphicsManager();
 	bool loadGFXMode();
 	void internUpdateScreen();
diff --git a/backends/platform/sdl/raspberrypi/raspberrypi.cpp b/backends/platform/sdl/raspberrypi/raspberrypi.cpp
index a3f79fd..206203d 100644
--- a/backends/platform/sdl/raspberrypi/raspberrypi.cpp
+++ b/backends/platform/sdl/raspberrypi/raspberrypi.cpp
@@ -32,7 +32,7 @@ void OSystem_SDL_RaspberryPi::initBackend() {
 
 	// Create the graphics manager
 	if (_graphicsManager == 0) {
-		_graphicsManager = new DispmanXSdlGraphicsManager(_eventSource);
+		_graphicsManager = new DispmanXSdlGraphicsManager(_eventSource, _window);
 	}
 
 	// Call parent implementation of this method
diff --git a/configure b/configure
index 99006e4..ad513e0 100755
--- a/configure
+++ b/configure
@@ -1061,9 +1061,9 @@ for ac_option in $@; do
 	--disable-libunity)       _libunity=no    ;;
 	--enable-opengl)          _opengl=yes     ;;
 	--disable-opengl)         _opengl=no      ;;
-        --enable-dispmanx)        _dispmanx=yes   ;;
-        --disable-dispmanx)       _dispmanx=no    ;;
-        --enable-bink)            _bink=yes       ;;
+	--enable-dispmanx)        _dispmanx=yes   ;;
+	--disable-dispmanx)       _dispmanx=no    ;;
+	--enable-bink)            _bink=yes       ;;
 	--disable-bink)           _bink=no        ;;
 	--enable-verbose-build)   _verbose_build=yes ;;
 	--enable-plugins)         _dynamic_modules=yes ;;
@@ -2576,13 +2576,13 @@ if test -n "$_host"; then
 			# Be careful as it's the linker (LDFLAGS) which must know about sysroot.	
 			# These are needed to build against Raspbian's libSDL even if we don't activate 
 			# dispmanx support. 
-			LDFLAGS="$LDFLAGS --sysroot=$RPI_ROOT"
-			LDFLAGS="$LDFLAGS -B$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
-			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
-			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf"
-			LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib"
-			LDFLAGS="$LDFLAGS -L$RPI_ROOT/opt/vc/lib"
-			LDFLAGS="$LDFLAGS -L/opt/rpi_root/lib/arm-linux-gnueabihf -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos"
+			append_var LDFLAGS "--sysroot=$RPI_ROOT"
+			append_var LDFLAGS "-B$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
+			append_var LDFLAGS "-Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf"
+			append_var LDFLAGS "-Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf"
+			append_var LDFLAGS "-Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib"
+			append_var LDFLAGS "-L$RPI_ROOT/opt/vc/lib"
+			append_var LDFLAGS "-L/opt/rpi_root/lib/arm-linux-gnueabihf -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos"
 			_savegame_timestamp=no
 			_eventrec=no
 			_build_scalers=no
@@ -4112,7 +4112,7 @@ if test "$_dispmanx" = "yes" ; then
 
 		# These are only needed if, appart from cross-building for Raspberry Pi,
 		# we are activating dispmanx support.
-		DISPMANX_CXXFLAGS="-I$RPI_ROOT/usr/include/arm-linux-gnueabihf -I$RPI_ROOT/opt/vc/include -I$RPI_ROOT/opt/vc/include/interface/vmcs_host/linux -I$RPI_ROOT/opt/vc/include/interface/vcos/pthreads -I$RPI_ROOT/usr/include/SDL"
+		DISPMANX_CXXFLAGS="-I$RPI_ROOT/usr/include -I$RPI_ROOT/usr/include/arm-linux-gnueabihf -I$RPI_ROOT/opt/vc/include -I$RPI_ROOT/opt/vc/include/interface/vmcs_host/linux -I$RPI_ROOT/opt/vc/include/interface/vcos/pthreads -I$RPI_ROOT/usr/include/SDL"
 		DISPMANX_LIBS="$RPI_LIBS -L/opt/rpi_root/lib/arm-linux-gnueabihf -L$RPI_ROOT/usr/lib -L$RPI_ROOT/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm"
 		
 		cat > $TMPC << EOF
@@ -4124,9 +4124,9 @@ if test "$_dispmanx" = "yes" ; then
 EOF
 		cc_check $DISPMANX_CXXFLAGS $DISPMANX_LIBS && _use_dispmanx=yes
 		if test "$_use_dispmanx" = "yes"; then
-			CXXFLAGS="$CXXFLAGS $DISPMANX_CXXFLAGS"
-			LIBS="$LIBS $DISPMANX_LIBS"
-			DEFINES="$DEFINES -DDISPMANX"
+			append_var CXXFLAGS "$DISPMANX_CXXFLAGS"
+			append_var LIBS "$DISPMANX_LIBS"
+			append_var DEFINES "-DDISPMANX"
 			add_line_to_config_mk 'DISPMANX = 1'
 			echo $_use_dispmanx
 		else echo "no"


Commit: c2c7225bbf007614eb9ac502ae9d824f431a9e03
    https://github.com/scummvm/scummvm/commit/c2c7225bbf007614eb9ac502ae9d824f431a9e03
Author: vanfanel (redwindwanderer at gmail.com)
Date: 2015-11-19T16:06:23+01:00

Commit Message:
SDL/DISPMANX Added myself to credits.pl

Changed paths:
    devtools/credits.pl



diff --git a/devtools/credits.pl b/devtools/credits.pl
index 41c2d4f..6f58528 100755
--- a/devtools/credits.pl
+++ b/devtools/credits.pl
@@ -877,6 +877,10 @@ begin_credits("Credits");
 				add_person("Andre Heider", "dhewg", "");
 			end_section();
 
+			begin_section("Raspberry Pi");
+				add_person("Manuel Alfayate", "vanfanel", "");
+			end_section();
+
 		end_section();
 
 		begin_section("Other subsystems");


Commit: b1545d6162abe5e455d6c1fe882e233be3480442
    https://github.com/scummvm/scummvm/commit/b1545d6162abe5e455d6c1fe882e233be3480442
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2015-11-21T00:12:52+01:00

Commit Message:
Merge pull request #575 from vanfanel/dispmanx

Added Raspberry Pi native 2D API support (dispmanx)

Changed paths:
  A backends/graphics/dispmanxsdl/dispmanxsdl-graphics.cpp
  A backends/graphics/dispmanxsdl/dispmanxsdl-graphics.h
  A backends/platform/sdl/raspberrypi/README.RASPBERRYPI
  A backends/platform/sdl/raspberrypi/raspberrypi-main.cpp
  A backends/platform/sdl/raspberrypi/raspberrypi.cpp
  A backends/platform/sdl/raspberrypi/raspberrypi.h
    backends/module.mk
    backends/platform/sdl/module.mk
    backends/platform/sdl/posix/posix-main.cpp
    configure
    devtools/credits.pl
    ports.mk









More information about the Scummvm-git-logs mailing list