steev
Posts: 87
Joined: Fri Jan 27, 2012 5:08 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 12:13 am

How did you get mupen64plus-libretro to work?

I tried 2 ways:

1) Leave Makefile alone, run 'make platform=rpi' (no NEON)
= Black screen with just the audio

2) Edit rpi section of Makefile, remove '-DARMV5_ONLY' and add 'HAVE_NEON=1'

Code: Select all

else ifneq (,$(findstring rpi,$(platform)))
    TARGET := $(TARGET_NAME)_libretro.so
    LDFLAGS += -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T
    fpic = -fPIC
    GLES = 1
    GL_LIB := -L/opt/vc/lib -lGLESv2
    INCFLAGS += -I/opt/vc/include
    CPUFLAGS += -DNO_ASM
    PLATFORM_EXT := unix
    WITH_DYNAREC=arm
    HAVE_NEON=1
CC=gcc-4.8 \
CXX=g++-4.8 \
CFLAGS="-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" \
CXXFLAGS="$CFLAGS" \
make platform=rpi

= Segfault when launching game
Last edited by steev on Sat Feb 07, 2015 12:18 am, edited 1 time in total.

fishxz
Posts: 71
Joined: Thu Feb 14, 2013 7:38 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 12:18 am

which game u try to run? i get also black screen with mario 64 (u can see picture while in retroarch menu). try mario kart 64 and u will get a screen. otherwise i can send you my makefile tomorrow. i compiled it as arm not as rpi, but it this makes no difference with the black screen thing.

steev
Posts: 87
Joined: Fri Jan 27, 2012 5:08 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 12:20 am

fishxz wrote:which game u try to run? i get also black screen with mario 64 (u can see picture while in retroarch menu). try mario kart 64 and u will get a screen. otherwise i can send you my makefile tomorrow. i compiled it as arm not as rpi, but it this makes no different with the black screen thing.
Oh, it was Super Mario 64. I also had the same problem with Mario Party so I assumed it was happening with all games.

Thanks

edit:
Yep, Mario Kart works, but only with the NEON optimizations turned off which I suspect is why it's running so slow.
Still segfaults with HAVE_NEON=1

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 30212
Joined: Sat Jul 30, 2011 7:41 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 10:14 am

Sounds like the code isn't multithreaded and cannot take advantage of the 4 cores. You will see some improvement as graphics tasks can be pushed to another core, and the A7 is inherently faster, but NEON really would be necessary to get a decent speed boost if not multithreaded. Someone needs to do some debugging!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

fishxz
Posts: 71
Joined: Thu Feb 14, 2013 7:38 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 10:31 am

i changed the "# ARM" part to this.

Code: Select all

# ARM
else ifneq (,$(findstring armv,$(platform)))
        CC = gcc
        CXX = g++
        TARGET := $(TARGET_NAME)_libretro.so
        fpic := -fPIC
        LDFLAGS += -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined
        INCFLAGS += -I.
        CPUFLAGS += -DNO_ASM
        WITH_DYNAREC=arm
        ifneq (,$(findstring gles,$(platform)))
                GLES := 1
                GL_LIB := -L/opt/vc/lib -lGLESv2
        else
                GL_LIB := -lGL
        endif
        ifneq (,$(findstring cortexa7,$(platform)))
                CPUFLAGS += -marm -mcpu=cortex-a7
        else ifneq (,$(findstring cortexa7,$(platform)))
                CPUFLAGS += -marm -mcpu=cortex-a7
        endif
        CPUFLAGS += -marm
        ifneq (,$(findstring neon,$(platform)))
                CPUFLAGS += -mfpu=neon-vfpv4
                HAVE_NEON = 1
        endif
        ifneq (,$(findstring softfloat,$(platform)))
                CPUFLAGS += -mfloat-abi=softfp
        else ifneq (,$(findstring hardfloat,$(platform)))
                CPUFLAGS += -mfloat-abi=hard
        endif
        PLATCFLAGS += -DARM
if you run "make platform=armv-gles-cortexa7-neon-hardfloat" u will get a optimized build, but for me this change nothing. performance is still poor.

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

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 11:03 am

Little video of 32X games and PSX games on RPI2 :
https://www.youtube.com/watch?v=G4YJni-sybU

Running on recalbox, compiled with armv7+neon flags, no overclock.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 30212
Joined: Sat Jul 30, 2011 7:41 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 12:35 pm

DigitalLumberjack wrote:Little video of 32X games and PSX games on RPI2 :
https://www.youtube.com/watch?v=G4YJni-sybU

Running on recalbox, compiled with armv7+neon flags, no overclock.
That looks pretty awesome!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

Hiradur
Posts: 96
Joined: Fri Mar 01, 2013 10:59 am

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 2:56 pm

Without much knowledge of how emulators work, what exactly can be vectorized to make use of NEON instructions?

ric_rpi
Posts: 207
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 3:21 pm

jamesh wrote:Sounds like the code isn't multithreaded and cannot take advantage of the 4 cores.
Unfortunately that is the case.

Processing of sound can be done in another thread when using audio-sdl but sound only accounts for 5-10% of the processing load. Pushing graphics into another thread will require major changes and there would be issues with thread-safe emulated memory writing.

fishxz
Posts: 71
Joined: Thu Feb 14, 2013 7:38 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Feb 07, 2015 3:37 pm

ric_rpi wrote:
jamesh wrote:Sounds like the code isn't multithreaded and cannot take advantage of the 4 cores.
Unfortunately that is the case.

Processing of sound can be done in another thread when using audio-sdl but sound only accounts for 5-10% of the processing load. Pushing graphics into another thread will require major changes and there would be issues with thread-safe emulated memory writing.
do gameboy advance cores have same problem? i cant get them to work with acceptable framerate. i guess snes9x also runs not perfect (sound stutter a little bit)

steev
Posts: 87
Joined: Fri Jan 27, 2012 5:08 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sun Feb 08, 2015 7:13 am

Did you try the gpsp core? That one runs well even on the Pi 1 I think.
The VBA cores are pretty demanding, even my Cortex A9 tablet can't handle them.

For SNES I had pretty good results with the Snes9x-Next and CATSFC (for SuperFX games) cores.

Not sure if it matters, but I'm using the threaded video option in RetroArch (Settings>Video Synchronization>Threaded video: ON)

bobbyyoustra
Posts: 29
Joined: Sun Sep 28, 2014 6:24 pm

Re: Raspberry Pi 2 - What would it mean for emulation?

Sun Feb 15, 2015 2:38 am

mgoulart wrote:Maybe new emulators: 3DO (4DO), Saturn (Yabuze), Dreamcast (Reicast), PSP (PPSSPP),...
One of your predictions was right:http://www.raspberrypi.org/forums/viewt ... 8&t=100076

xenphor
Posts: 3
Joined: Thu Feb 09, 2012 5:12 am

Re: Raspberry Pi 2 - What would it mean for emulation?

Sat Mar 07, 2015 8:36 pm

I'm using ArchLinux ARM with retroarch and I'm also having trouble getting mupen64 working on my pi 2. At first I just used these commands:

$ export CFLAGS="-mcpu=cortex-a7 -mfpu=neon-vfpv4"
$ make platform="armv neon hardfloat" -j5

That compiled but I got this error when loading mupen

Code: Select all

RetroArch [WARN] :: patch_content :: Did not find a valid content patch.
RetroArch [ERROR] :: rarch_environment_cb :: Requesting OpenGL context, but RetroArch is compiled against OpenGLES2. Cannot use HW context.
RetroArch [ERROR] :: rarch_log_libretro :: [libretro ERROR] :: mupen64plus: libretro frontend doesn't have OpenGL support.RetroArch [ERROR] :: load_content :: Failed to load content.
RetroArch: rarch_log_libretro: [libretro INFO] :: mupen64plus: Incompatible version -2.00 in 'Core' config section: current is -2.00. Setting defaults.
RetroArch: rarch_log_libretro: [libretro INFO] :: mupen64plus: ROM Database: /home/user/system/mupen64plus.ini
RetroArch: rarch_log_libretro: [libretro INFO] :: mupen64plus: Unable to open rom database file '/home/user/system/mupen64plus.ini'.
RetroArch: rarch_log_libretro: [libretro INFO] :: EmuThread: M64CMD_ROM_OPEN
RetroArch [ERROR] :: rarch_log_libretro :: [libretro ERROR] :: mupen64plus: Failed to load ROM
RetroArch [ERROR] :: rarch_log_libretro :: [libretro ERROR] :: Running Dead N64 Emulator
Then I tried what the person above did and replaced the #ARM section with this:

Code: Select all

# ARM
else ifneq (,$(findstring armv,$(platform)))
        CC = gcc
        CXX = g++
        TARGET := $(TARGET_NAME)_libretro.so
        fpic := -fPIC
        LDFLAGS += -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined
        INCFLAGS += -I.
        CPUFLAGS += -DNO_ASM
        WITH_DYNAREC=arm
        ifneq (,$(findstring gles,$(platform)))
                GLES := 1
                GL_LIB := -L/opt/vc/lib -lGLESv2
        else
                GL_LIB := -lGL
        endif
        ifneq (,$(findstring cortexa7,$(platform)))
                CPUFLAGS += -marm -mcpu=cortex-a7
        else ifneq (,$(findstring cortexa7,$(platform)))
                CPUFLAGS += -marm -mcpu=cortex-a7
        endif
        CPUFLAGS += -marm
        ifneq (,$(findstring neon,$(platform)))
                CPUFLAGS += -mfpu=neon-vfpv4
                HAVE_NEON = 1
        endif
        ifneq (,$(findstring softfloat,$(platform)))
                CPUFLAGS += -mfloat-abi=softfp
        else ifneq (,$(findstring hardfloat,$(platform)))
                CPUFLAGS += -mfloat-abi=hard
        endif
        PLATCFLAGS += -DARM
I compiled with

$ make -j5 platform=armv-gles-cortexa7-neon-hardfloat


That brings up mupen but I get slow performance also, not like this video:
https://www.youtube.com/watch?v=tP-i6oM2vnQ

How is he able to get that much faster? I also get sound hiccups with snes9x in Mario World and genesis plus gx in Sonic. Should Pi 2 be able to run those at full speed? What options do I need to compile those with differently?

Return to “Gaming”