Page 3 of 3

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

Posted: Sat Feb 07, 2015 12:13 am
by steev
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

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

Posted: Sat Feb 07, 2015 12:18 am
by fishxz
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.

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

Posted: Sat Feb 07, 2015 12:20 am
by steev
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

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

Posted: Sat Feb 07, 2015 10:14 am
by jamesh
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!

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

Posted: Sat Feb 07, 2015 10:31 am
by fishxz
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.

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

Posted: Sat Feb 07, 2015 11:03 am
by DigitalLumberjack
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.

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

Posted: Sat Feb 07, 2015 12:35 pm
by jamesh
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!

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

Posted: Sat Feb 07, 2015 2:56 pm
by Hiradur
Without much knowledge of how emulators work, what exactly can be vectorized to make use of NEON instructions?

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

Posted: Sat Feb 07, 2015 3:21 pm
by ric_rpi
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.

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

Posted: Sat Feb 07, 2015 3:37 pm
by fishxz
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)

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

Posted: Sun Feb 08, 2015 7:13 am
by steev
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)

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

Posted: Sun Feb 15, 2015 2:38 am
by bobbyyoustra
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

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

Posted: Sat Mar 07, 2015 8:36 pm
by xenphor
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?