Vanfanel
Posts: 408
Joined: Sat Aug 18, 2012 5:58 pm

Scummvm DISPMANX for Raspberry Pi

Sat Jan 10, 2015 7:56 pm

Hi!

I've added Rpi Dispmanx context support to Scummvm so GPU is used for stretching and no more tearing is present in games with scrolling sequences.
Also, vsync waiting isn't blocking anymore so you get perfectly smooth scrolls even in Ween (DOS) intro.
It's the way these games are inteded to be played on the Pi :)
No need to install any special libraries. DON'T INSTALL my custom SDL version. Stock Raspbian SDL will do!!

Instructions:
-Clone my repo here:

Code: Select all

git clone --depth 1 -b dispmanx https://github.com/vanfanel/scummvm.git
-Change to the scummm directory and run the configure script. This is how I run it, because I like to disable a lot of stuff that is NOT needed on the Pi at all, and engines I don't use.

Code: Select all

./configure --backend=raspberrypi --disable-debug --enable-release --enable-optimizations --disable-mt32emu --enable-f    lac --disable-mad --disable-vorbis --disable-tremor \
  2 --disable-fluidsynth --disable-taskbar --disable-timidity --disable-alsa \
--disable-engine="hugo,avalanche,bbvs,cge,cge2,cine,composer,cruise,draci,drascula,fullpipe,groovie,groovie2,hopkins,    lastexpress,lure,made,mads,mohawk,cstime,mortevielle,parallaction,pegasus,sci32,sword1,sword2,sword25,teenagent,testbe    d,tinsel,toltecs,tony,toon,touche,tsage,tucker,voyeur,wintermute,zvision"
-Build!

Code: Select all

make 
..and wait, if you're not using DISTCC :)

I hope I can get it merged into mainstream scummvm soon. Enjoy!

You can also cross compile. Cross-compilation instructions follow (*these are for PC, don't do this on a Rpi, it would make no sense at all*):
-Clone the raspberry pi tools repository:

Code: Select all

git clone git://github.com/raspberrypi/tools.git
-Add it to the path. For example, the tools repo ended in /home/manuel/raspberrypi on my system, so I'd have to do:

Code: Select all

PATH=$PATH:/home/manuel/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
After adding the crosscompiler executables directory to the path, we should be able to run arm-linux-gnueabihf-gcc, arm-linux-gnueabihf-g++, etc... just try. They should yield an error because you pass them no input files, but that's expected. It's just a test so we know we've the crosscompiler installed and accesible.

-Copy over the /usr, /lib and /opt directories from your Raspbian SD to your PC (the computer were you will do the cross-compilation). I copied them to /home/manuel/rpi_root:

Code: Select all

cp -R <SD_mountpoint_directory>/usr /home/manuel/rpi_root
cp -R <SD_mountpoint_directory>/lib /home/manuel/rpi_root
cp -R <SD_mountpoint_directory>/opt /home/manuel/rpi_root 
-Now we configure scummvm buildsystem so it knows what backend we want and where is our raspberry pi local sysroot living, containing the Raspberry Pi headers and libs the cross-compiler and linker will need:

Code: Select all

RPI_ROOTDIR="/home/manuel/rpi_root" ./configure --backend=raspberrypi --host=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 \
--disable-engine="hugo,avalanche,bbvs,cge,cge2,cine,composer,cruise,draci,drascula,fullpipe,groovie,groovie2,hopkins,    lastexpress,lure,made,mads,mohawk,cstime,mortevielle,parallaction,pegasus,sci32,sword1,sword2,sword25,teenagent,testbe    d,tinsel,toltecs,tony,toon,touche,tsage,tucker,voyeur,wintermute,zvision"
-Build and link! I use -j8 because I have a 4-cores i3 machine for compilation. Use whatever it fits better with your system:

Code: Select all

make -j8 VERBOSE_BUILD=1
We're done!
Last edited by Vanfanel on Sat Mar 21, 2015 6:53 pm, edited 6 times in total.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4689
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Scummvm GLES for Raspberry Pi

Sat Jan 10, 2015 9:54 pm

Nice!

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Scummvm GLES for Raspberry Pi

Sun Jan 11, 2015 4:24 pm

Thank you i will give it a try :)

Vanfanel
Posts: 408
Joined: Sat Aug 18, 2012 5:58 pm

Re: Scummvm GLES for Raspberry Pi

Tue Jan 13, 2015 12:29 pm

Update building instructions. Now the --enable-gles-rpi parameter must be passed to the configure script since the scummvm team said autodetecting CPU isn't a good idea.

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Tue Jan 13, 2015 8:22 pm

Thanks :)

BTW I think --enable-release should also enable optimizations according to configure help

For retropie we also do

--enable-vkeybd --disable-eventrecorder --enable-keymapper

for onscreen keyboard, and ability to remap some keys - could be useful for people with controllers perhaps (it was requested by someone for retropie)

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Tue Jan 13, 2015 10:00 pm

On my pi (composite output) I am getting

OpenGLGraphicsManager::endGFXTransaction: Could not load any graphics mode!!

[edit] oh Looks like it has enabled the opengl backend - probably because I have the libraries installed. will try with --disable-opengl also - so that might be needed too.

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Tue Jan 13, 2015 10:24 pm

ok. built and running - very nice.

If there is no reason that you would need the opengl backend as well as the pi, perhaps enabling the rpi backend should disable opengl ? not that it is an issue to add --disable-opengl anyway.

AmigaGamer
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm

Re: Scummvm GLES for Raspberry Pi

Wed Jan 14, 2015 12:02 am

Vanfanel,

Great to see you back with a nice release.

Good timing - Now i can catch up on some old Lucasarts Tim Schafer games in anticipation of Grim Fandango HD on the 27th.

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Wed Jan 14, 2015 3:36 am

hmm a problem. It works fine on composite out, but when I plug the same Pi via HDMI into a lcd (1024x768) I get a black screen on launch.

KitchUK
Posts: 256
Joined: Fri Jul 19, 2013 5:40 pm

Re: Scummvm GLES for Raspberry Pi

Wed Jan 14, 2015 9:03 am

exobuzz wrote:hmm a problem. It works fine on composite out, but when I plug the same Pi via HDMI into a lcd (1024x768) I get a black screen on launch.
I can confirm this. HDMI 720p TV mode black screen.

Vanfanel
Posts: 408
Joined: Sat Aug 18, 2012 5:58 pm

Re: Scummvm GLES for Raspberry Pi

Fri Jan 16, 2015 11:47 am

KitchUK, exobuzz: sorry guys, but I can't reproduce this issue. I've tried both video modes (by setting them in config.txt) and scummvm on gles works well here.
Can you give me any more details that could help me reproduce the issue?
You are not using X, are you?

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Fri Jan 16, 2015 12:08 pm

not running x no - I built it as part of retropie (have reverted for now), but the same pi/binary worked fine on composite output, but failed when I plugged the pi into hdmi screen (1024x768). I also tried it on another Pi - perhaps we can swap builds for comparison.

I will also remove some of my other build options to rule out anything else and try and duplicate your build exactly.

I note that you did not need to disable-opengl - which was required for me as raspbian sdl1.2-dev has dependencies on the opengl headers etc and so scummvm enabled it during configure. I'm assuming scummvm still needs sdl for input etc ?

I built with

./configure --enable-vkeybd --enable-release --disable-debug --enable-keymapper --disable-eventrecorder --enable-gles-rpi --prefix="/opt/retropie/emulators/scummvm"

I had these packages installed beforehand

libsdl1.2-dev libjpeg8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng12-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev

here is our module before I reverted back - https://github.com/petrockblog/RetroPie ... scummvm.sh

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Fri Jan 16, 2015 12:13 pm

which firmware version are you running btw so I can make sure I'm also running the same for testing?

Vanfanel
Posts: 408
Joined: Sat Aug 18, 2012 5:58 pm

Re: Scummvm GLES for Raspberry Pi

Fri Jan 16, 2015 1:36 pm

exobuzz wrote:which firmware version are you running btw so I can make sure I'm also running the same for testing?
This is what runs on my system:
pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.12.32+ #721 PREEMPT Fri Nov 7 16:50:31 GMT 2014 armv6l GNU/Linux
pi@raspberrypi ~ $ vcgencmd version
Nov 13 2014 17:26:15
Copyright (c) 2012 Broadcom
version 4b43a6c1fb32bd23b26f999eef78312d71df9b7a (clean) (release)

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Fri Jan 16, 2015 1:56 pm

thanks. I'll get back to you.

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 1:34 am

I downgraded firmware to a version from the beg nov 2013, and still the same.

Not looked at the code yet but I believe something is failing on init, as scummvm exits right after setting up the display (leaving the screen blank).

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 1:53 am

Please can you paste me the output of configure on your system also so I can compare that.

Will build with debugging also and have a go with gdb.

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 2:30 am

your configure changes override CXXFLAGS making it impossible to enable a debug build.

Currently building with this change

Code: Select all

diff --git a/configure b/configure
index 096e7d9..c86240b 100755
--- a/configure
+++ b/configure
@@ -4112,7 +4112,7 @@ EOF
                cc_check $GLES_RPI_CXXFLAGS $GLES_RPI_LIBS && _use_gles_rpi=yes
                if test "$_use_gles_rpi" = "yes"; then
                        echo "Activating custom GLES context for Raspberry Pi"
-                       CXXFLAGS="$INCLUDES $GLES_RPI_CXXFLAGS"
+                       CXXFLAGS="$CXXFLAGS $GLES_RPI_CXXFLAGS"
                        LIBS="$LIBS $GLES_RPI_LIBS"
                        add_line_to_config_mk "USE_GLES_RPI = 1"
                        add_line_to_config_h "#define USE_GLES_RPI"

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 3:01 am

Here's a backtrace. Segfaults in SDL :/ - after a call to SetVideoMode

Code: Select all

(gdb) backtrace
#0  0xb6f61010 in SDL_FillRect () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
#1  0xb6f63d44 in SDL_SetVideoMode () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
#2  0x000a57f8 in OpenGLCustomGraphicsManager::setupMode(unsigned int, unsigned int) ()
    at backends/graphics/gles-custom/gles-custom.cpp:526
#3  0x000a57a4 in OpenGLCustomGraphicsManager::loadVideoMode(unsigned int, unsigned int, Graphics::PixelFormat const&) ()
    at backends/graphics/gles-custom/gles-custom.cpp:516
#4  0x000a80e8 in OpenGL::OpenGLGraphicsManager::endGFXTransaction() () at backends/graphics/opengl/opengl-graphics.cpp:212
#5  0x0008d9cc in ModularBackend::endGFXTransaction() () at backends/modular-backend.cpp:113
#6  0x00010834 in setupGraphics (system=...) at base/main.cpp:277
#7  0x00011300 in scummvm_main (argc=2, argv=0xbefff864) at base/main.cpp:433
#8  0x0000ee20 in main (argc=2, argv=0xbefff864) at backends/platform/sdl/posix/posix-main.cpp:45

Vanfanel
Posts: 408
Joined: Sat Aug 18, 2012 5:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 11:12 am

Ok, can you please change

_hwScreen = SDL_SetVideoMode(0, 0, 32, 0);

to

_hwScreen = SDL_SetVideoMode(eglInfo.width, eglInfo.height, 32, 0);

and rebuild?

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 12:25 pm

Doesn't help I'm afraid.

Vanfanel
Posts: 408
Joined: Sat Aug 18, 2012 5:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 12:45 pm

Can you please try with sudo or running scummvm as root?

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 12:49 pm

are you able to provide me a working image with it built for testing - just to rule out something at my end that is wrong. Also - the backtrace was made when using ssh, so it's also possible that it's a different issue I'm seeing when running it like that - I need to set it up so I can debug it remotely whilst running it directly on the pi.

Running as root doesn't help.

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 1:16 pm

I have it working! - it requires though that I set the framebuffer depth to 32 first with fbset -depth 32

some framebuffer / sdl compatibility issue ?

exobuzz
Posts: 135
Joined: Mon Nov 26, 2012 6:58 pm

Re: Scummvm GLES for Raspberry Pi

Sat Jan 17, 2015 1:29 pm

I can reproduce the issue with this short piece of code which only works if the framebuffer is 32bit on my system (unless I'm using composite output)

Code: Select all

#include <SDL/SDL.h>

int main()
{
  SDL_Init(SDL_INIT_VIDEO);
  SDL_Surface* screen = SDL_SetVideoMode(0,0, 32, SDL_SWSURFACE);
  SDL_Quit();

  return 0;
}

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 10 guests