libretro / parallel-n64

Optimized/rewritten Nintendo 64 emulator made specifically for Libretro. Originally based on Mupen64 Plus.
319 stars 127 forks source link

mupen64plus-libretro: crash on Mali GPU (Android) #154

Open leoqchen opened 9 years ago

leoqchen commented 9 years ago

Hi, I found mupen64plus core run ok on GPU Adreno, but crash on GPU Mali-450, Mali-400, Mali-300.

Here is a error log from a Mali-450 device: 11-15 18:34:59.933: I/RetroArch(23778): Environ GET_VARIABLE mupen64-filtering: 11-15 18:34:59.933: I/RetroArch(23778): automatic 11-15 18:34:59.933: I/RetroArch(23778): Environ GET_VARIABLE mupen64-filtering: 11-15 18:34:59.933: I/RetroArch(23778): automatic 11-15 18:34:59.943: I/RetroArch[libretro INFO] ::(23778): Detected RDRAM size: 007fffff 11-15 18:34:59.943: I/RetroArch(23778): Environ GET_VARIABLE mupen64-screensize: 11-15 18:34:59.943: I/RetroArch(23778): 640x480 11-15 18:34:59.943: I/RetroArch[libretro INFO] ::(23778): GL_RENDERER: Mali-450 MP 11-15 18:34:59.943: E/RetroArch[libretro ERROR] ::(23778): 0:20: P0004: High precision not supported, instead compiling high precision as medium precision 11-15 18:34:59.943: E/RetroArch[libretro ERROR] ::(23778): 0:30: L0002: Undeclared variable 'gl_FragDepth' 11-15 18:34:59.943: A/libc(23778): Fatal signal 11 (SIGSEGV) at 0x0000004a (code=1), thread 23855 (com.retroarch)

For comparison, here is a ok log from a Adreno-320 device: 11-15 18:02:01.119: I/RetroArch:(28458): Environ GET_VARIABLE mupen64-filtering: 11-15 18:02:01.119: I/RetroArch:(28458): automatic 11-15 18:02:01.119: I/RetroArch:(28458): Environ GET_VARIABLE mupen64-filtering: 11-15 18:02:01.119: I/RetroArch:(28458): automatic 11-15 18:02:01.119: I/RetroArch: [libretro INFO] ::(28458): Detected RDRAM size: 007fffff 11-15 18:02:01.119: I/RetroArch:(28458): Environ GET_VARIABLE mupen64-screensize: 11-15 18:02:01.119: I/RetroArch:(28458): 640x480 11-15 18:02:01.119: I/RetroArch: [libretro INFO] ::(28458): GL_RENDERER: Adreno (TM) 320 11-15 18:02:01.159: I/RetroArch: [libretro INFO] ::(28458): mupen64plus: Starting R4300 emulator: Dynamic Recompiler 11-15 18:02:01.159: I/RetroArch: [libretro INFO] ::(28458): mupen64plus: Init new dynarec 11-15 18:02:01.159: I/RetroArch: [libretro INFO] ::(28458): mupen64plus: 32MB cache initialised at: 7B335000 11-15 18:02:01.199: I/RetroArch:(28458): Environ GET_VARIABLE mupen64-disableexpmem: 11-15 18:02:01.199: I/RetroArch:(28458): no

It seems that the crash happen on GL_RENDERER.

inactive123 commented 9 years ago

Yes, gl_FragDepth is not GLES2-compliant. The Glide port to GLES2 was a rather halfbaked one to put it mildly.

leoqchen commented 9 years ago

Using the latest source code, the "Undeclared variable 'gl_FragDepth'" message disappear. But the core still crash. I think I am in the wrong way.

I think maybe I can port the video part from mupen64plus-ae to libretro-mupen64plus, it's a correct way?

sergiobenrocha2 commented 9 years ago

Mupen crash in odroid u3 (linux), and it uses mali 400 as well.

GL_EXT_texture_format_BGRA8888 supported.
RetroArch: rarch_log_libretro: [libretro INFO] :: GL_RENDERER: Mali-400 MP
RetroArch [ERROR] :: rarch_log_libretro :: [libretro ERROR] :: 0:20: P0004: High precision not supported, instead compiling high precision as medium precision
0:30: L0002: Undeclared variable 'gl_FragDepthEXT'
Segmentation fault

Does it related? Or better open another bug report?

I tried to debug it, there is no symbol table for mupen (compiled with debug=1)

(gdb) bt full
#0  0xb68d5d66 in _essl_mali200_write_instructions () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#1  0xb68d3e2c in schedule () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#2  0xb68d5084 in mali200_schedule_single_operation () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#3  0xb68d5534 in _essl_mali200_schedule_function () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#4  0xb68d36a0 in _essl_mali200_driver () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#5  0xb68cc3cc in _essl_run_compiler () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#6  0xb68b12d4 in __mali_compile_essl_shader () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#7  0xb68a5f94 in _gles2_compile_shader () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#8  0xb68a1294 in glCompileShader () from /usr/lib/arm-linux-gnueabihf/mali-egl/libEGL.so.1
No symbol table info available.
#9  0xa9dd33ac in ?? () from /usr/lib/libretro/mupen64plus_libretro.so
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
nopedotbmp commented 9 years ago

I'm guessing this issue has existed for awhile as there seems to be other similar incident reports. https://github.com/libretro/RetroArch/issues/547 This user reported a similar outcome on a device powered by a rockchip RK3188 (mali-400 gpu) I am also experiencing this issue in a device containing a RK3188/Mali-400, from the stable builds to the nightly builds, the crashing persists.

kivutar commented 9 years ago

Same backtrace here on linux for allwinner mali400 https://github.com/lakkatv/Lakka/issues/153

nopedotbmp commented 9 years ago

https://github.com/libretro/mupen64plus-libretro/issues/101 Possible solution?