Previous Thread
Next Thread
Print Thread
Page 1 of 6 1 2 3 4 5 6
MAME on ODROID-N2 (Linux) #116079 10/04/19 12:44 AM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Opening a thread for compiling MAME on an ODROID-N2 SBC. MAME does compile successfully in the Ubuntu MATE 18.04.3 release that is shipped with the ODROID-N2. Compling MAME requires NOWERROR=1, and you need zram to increase your memory on the 2GB model. MAME appears to runs fully in the shipped Ubuntu MATE (testing with macplus and maciici), except that performance is very poor. Emulated systems ran at anywhere from 10% to 55% of target performance (on the higher end with -nomax). Problem was traced back to poor video performance. The Mali-52 GPU on the ODROID-N2 has no accelerated X driver and does not support full OpenGL (supports OpenGL ES). I'm told that no X drivers will be released for this GPU, and that real Wayland support is far away (some nice benchmarks are published for Wayland, but it's not an otherwise useful build). An alternate "Ubuntu Minimal 18.04.3" does ship for the ODROID-N2, and that release has both a kernel framebuffer driver for the Mali-52 GPU and a special SDL 2.0.8 release that supports a framebuffer video driver. My hope is that I can build a release of MAME not requiring X/Xorg or full OpenGL, instead just using the Linux kernel framebuffer. Performance samples with glmark2-es2-fbdev look promising on the Ubuntu Minimal release for this device.

I have worked my way into a story of compiling MAME with:
NOWERROR=1
NO_USE_XINPUT=1
NO_X11=1
NO_OPENGL=1 (support hacked into makefile)

I've installed some packages (forced without X dependencies) that may or may not be needed after adjusting some of my make parameters
dpkg --force-depends -i libsdl2-ttf-dev_2.0.14+dfsg1-2_arm64.deb
dpkg --force-depends -i libsdl2-dev_2%3a2.0.8+dfsg1-1ubuntu1.18.04.3-hk1_arm64.deb
dpkg --force-depends -i libfontconfig1-dev_2.12.6-0ubuntu2_arm64.deb

Everything compiles, but I'm now encountering errors at the linking stage. This is the latest error encountered:

Building driver list...
36196 driver(s) found
Compiling generated/mame/mame/drivlist.cpp...
Linking mame...
/usr/bin/ld: ../../../../../scripts/src/libbgfx.a(glcontext_glx.o): undefined reference to symbol 'XFree'
//usr/lib/aarch64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
mame.make:250: recipe for target '../../../../../mame' failed

From build/projects/sdl/mame/gmake-linux/mame.make
LIBS += $(LDDEPS) -ldl -lrt -lSDL2 -lm -lpthread -lutil -lasound -lSDL2_ttf


A clean compile up to this stage takes roughly 6 hours (limited job count due to memory constraint).

This likely isn't the final problem to be encountered, but I'm losing history and access to help by only using ShoutChat. Opening this thread to capture progress and request additional help. Let me know if you have any ideas on this linking problem.

Thanks.

Last edited by Steve Bourg; 10/04/19 01:53 AM.
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116080 10/04/19 08:01 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
The limitation appears to come from bgfx. If you look at line 156 in 3rdparty/bgfx/src/glcontext_glx.cpp, it does call XFree function which is likely why linking fails.
The solution might be to disable bgfx altogether or just its OpenGL Part, but I am just guessing here and I am not sure if the necessary logic is even available in the makefile and/or genie scripts.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116091 10/04/19 08:33 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
I've been following the progress of this from the ShoutChat box with some interest as I have been testing MAME compile times with an overclocked 2.1GHz 4GB Rpi4. If you would like I can run some tests for you on the Rpi4 so you can have some performance comparison numbers.

For what it's worth, a clean compile on my Rpi4 takes about 6-7 hours, and I ran into the same problem you did with the compiler over-alignment error. I did not have to use zram to do the compile, as it seems 4GB is enough to prevent swapping issues.

Since a clean recompile takes so long, have you considered doing single-driver builds? They should only take about 30-40 minutes on the N2...

-Robert

Re: MAME on ODROID-N2 (Linux) [Re: Robert Hildinger] #116093 10/04/19 11:29 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
I would very much appreciate information about your experience on the Rpi4. My first interest is, can you get to 100% performance for an emulated maciici (e.g. overclocking is required? a certain video driver was needed?). Does sound work on the maciici (even just the startup sound from rom)? I picked up the N2 because I thought it would be one of my best options w/ a fanless cpu, but I'm open to anything that will work.

2G of RAM is definitely slowing me down even for single-driver builds (stuff like luaengine drowns in swap), but as I know already that everything else compiles, single-driver is a good way to shave time for troubleshooting, thanks.

It looks difficult to strip opengl / X from bgfx. It doesn't help that I don't know c++. The N2 not having any accelerated X driver, I'll keep hammering away at the framebuffer path, at least until I've realized when there's a brick wall.

If anyone has some idea of how to adjust bgfx to not use OpenGL / X, please let me know. I see the Noop stuff, but I don't know if it's possible to steer to software rendering. Belmont gave some tips on removing bgfx which I'll also try, not actually understanding the implications.

- Steve

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116098 10/05/19 08:26 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
I think it is going to be easier to rip out bgfx altogether. You can use pure sdl output after all, bgfx output is not mandatory yet. I will see if I can hack the build scripts to do that.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116099 10/05/19 10:22 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
I managed to hack the buildsystem to allow disabling bgfx:
https://github.com/belegdol/mame/tree/no-opengl-fix
It can be built without bgfx, opengl and X11:
Code
$ make NO_X11=1 NOWERROR=1 NO_USE_XINPUT=1 NO_OPENGL=1 NO_BGFX=1

The resulting binary runs without crashing too. Please feel free to test and report back, if it works for you I will make a pull request.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116101 10/05/19 10:59 AM
Joined: Feb 2007
Posts: 474
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 474
+1 for a pull request

Re: MAME on ODROID-N2 (Linux) [Re: couriersud] #116102 10/05/19 11:29 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116104 10/05/19 01:06 PM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
I might have found a solution less drastic than ripping out bgfx entirely: due to logic in 3rdparty/bgfx/config.h and 3rdparty/bgfx/renderer_gl.h, bgfx appears to default to glx under linux. I have now tested the following hack:
Code
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 4ec2084d0f..ea6fa2f506 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -1347,6 +1347,12 @@ end
                "__STDC_CONSTANT_MACROS",
                "BGFX_CONFIG_MAX_FRAME_BUFFERS=128",
        }
+       if _OPTIONS["NO_X11"]=="1" then
+               defines {
+               "BGFX_CONFIG_RENDERER_OPENGLES=1",
+               "BGFX_CONFIG_RENDERER_OPENGL=0",
+               }
+       end

With this change, mame can be built with
Code
$ make NO_X11=1 NOWERROR=1 NO_USE_XINPUT=1 NO_OPENGL=1

without hitting linking errors with bgfx. Bgfx uses OpenGL ES afterwards too which might be helpful as well.

Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116105 10/05/19 03:24 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Thanks! I'll try both approaches and report back.

Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116107 10/05/19 05:07 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Compiling/linking the branch from https://github.com/belegdol/mame/tree/no-opengl-fix with --NO_BGFX=1 (on Odroid N2) appears to have moved me past the bgfx linking problems and on to my next problem, which I'll post if it's not an easy fix. Will work past the remaining issues to conclude on the ultimate result.

Thanks belegdol

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116108 10/05/19 06:04 PM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
Happy to hear it worked! Please note that the other approach might give you OpenGL ES (via -video bgfx -bgfx_backend gles) which might also help to alleviate the performance issues you were having.

Last edited by belegdol; 10/05/19 06:05 PM.
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116111 10/05/19 11:00 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Hi belegdol -

I also tried your 2nd approach:
Code
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 4ec2084d0f..ea6fa2f506 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -1347,6 +1347,12 @@ end
                "__STDC_CONSTANT_MACROS",
                "BGFX_CONFIG_MAX_FRAME_BUFFERS=128",
        }
+       if _OPTIONS["NO_X11"]=="1" then
+               defines {
+               "BGFX_CONFIG_RENDERER_OPENGLES=1",
+               "BGFX_CONFIG_RENDERER_OPENGL=0",
+               }
+       end


Along with the check for a NO_OPENGL switch, added to MAME's makefile
Code
ifdef NO_OPENGL
PARAMS += --NO_OPENGL='$(NO_OPENGL)'
endif


This approach also enabled me to get past OpenGL / X linking issues. Compiling/linking is now succeeding for both approaches, so a very nice milestone.


The next problem I'm encountering is this:
Code
# export SDL_VIDEODRIVER=fbcon
# ./mame
Could not initialize SDL fbcon not available
# 


If I export no shell variable for this at all, console goes into a perpetual output of:
Code
# ./mame
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
...


Code
root@odroid:/mnt/a/mame0214.belegdol_nobgfx# ls -la /dev/fb*
crw-rw---- 1 root video 29, 0 Jan 28  2018 /dev/fb0
crw-rw---- 1 root video 29, 1 Jan 28  2018 /dev/fb1
crw-rw---- 1 root video 29, 2 Jan 28  2018 /dev/fb2
crw-rw---- 1 root video 29, 3 Jan 28  2018 /dev/fb3


This SBC is supposed to have its own framebuffer-supporting SDL build. And indeed, their glmark2-es2-fbdev does execute successfully. I'll ask the Odroid people if something needs to be fed into SDL for framebuffer to be used. I was hoping that it would match the original implementation https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlenvvars.html.

Anyone have concerns or ideas about MAME's utilization of installed SDL libraries?

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116113 10/06/19 07:39 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
Can you post the output of:
Code
$./mame -verbose

and
Code
$./mame -verbose -video bgfx -bgfx_backend gles -bgfx_debug

?

Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116114 10/06/19 12:08 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Code
# ./mame -verbose
Attempting load of mame.ini
Attempting load of mame.ini
Starting plugin data...
Attempting load of mame.ini
Attempting load of mame.ini
Available videodrivers: x11 mali dummy 
Current Videodriver: mali
	Display #0
		Renderdrivers:
			 opengles2 (0x0)
			  opengles (0x0)
			  software (0x0)
Available audio drivers: 
	alsa                
	dsp                 
	disk                
	dummy               
Build version:      0.214 (unknown)
Build architecure:  
Build defines 1:    SDLMAME_UNIX=1 SDLMAME_LINUX=1 
Build defines 1:    LSB_FIRST=1 PTR64=1 MAME_NOASM=1 
SDL/OpenGL defines: SDL_COMPILEDVERSION=2008 USE_OPENGL=0 
Compiler defines A: __GNUC__=7 __GNUC_MINOR__=4 __GNUC_PATCHLEVEL__=0 __VERSION__="7.4.0" 
Compiler defines B: __unix__=1 
Compiler defines C: __USE_FORTIFY_LEVEL=0 
Enter init_monitors
Adding monitor screen0 (3840 x 2160)
Leave init_monitors
Enter sdlwindow_init
Using SDL multi-window soft driver (SDL 2.0+)

Hints:
	SDL_FRAMEBUFFER_ACCELERATION             (null)
	SDL_RENDER_DRIVER                        (null)
	SDL_RENDER_OPENGL_SHADERS                (null)
	SDL_RENDER_SCALE_QUALITY                 (null)
	SDL_RENDER_VSYNC                         (null)
	SDL_VIDEO_X11_XVIDMODE                   (null)
	SDL_VIDEO_X11_XINERAMA                   (null)
	SDL_VIDEO_X11_XRANDR                     (null)
	SDL_GRAB_KEYBOARD                        (null)
	SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS         (null)
	SDL_IOS_IDLE_TIMER_DISABLED              (null)
	SDL_IOS_ORIENTATIONS                     (null)
	SDL_XINPUT_ENABLED                       (null)
	SDL_GAMECONTROLLERCONFIG                 (null)
	SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS     (null)
	SDL_ALLOW_TOPMOST                        (null)
	SDL_TIMER_RESOLUTION                     (null)
	SDL_RENDER_DIRECT3D_THREADSAFE           (null)
	SDL_VIDEO_ALLOW_SCREENSAVER              (null)
	SDL_ACCELEROMETER_AS_JOYSTICK            (null)
	SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   (null)
	SDL_VIDEO_WIN_D3DCOMPILER                (null)
	SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT      (null)
	SDL_VIDEO_MAC_FULLSCREEN_SPACES          (null)
	SDL_MOUSE_RELATIVE_MODE_WARP             (null)
	SDL_RENDER_DIRECT3D11_DEBUG              (null)
	SDL_VIDEO_HIGHDPI_DISABLED               (null)
	SDL_WINRT_PRIVACY_POLICY_URL             (null)
	SDL_WINRT_PRIVACY_POLICY_LABEL           (null)
	SDL_WINRT_HANDLE_BACK_BUTTON             (null)
Leave sdlwindow_init
Enter sdl_info::create
window: using renderer opengles2
renderer: flag SDL_RENDERER_ACCELERATED
Leave renderer_sdl2::create
Audio: Start initialization
Audio: Driver is alsa
Audio: frequency: 48000, channels: 2, samples: 512
sdl_create_buffers: creating stream buffer of 25600 bytes
Audio: End initialization
Keyboard: Start initialization
Input: Adding keyboard #0: System keyboard (device id: System keyboard)
Keyboard: Registered System keyboard
Keyboard: End initialization
Mouse: Start initialization
Input: Adding mouse #0: System mouse (device id: System mouse)
Mouse: Registered System mouse
Mouse: End initialization
Joystick: Start initialization
Joystick: End initialization
Searching font Liberation Sans in -. path/s
font Liberation Sans|Regular is not TrueType or BDF, using MAME default
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
Region ':user1' created
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
Starting No Driver Loaded ':'
  (missing dependencies; rescheduling)
Starting Video Screen ':screen'
Starting No Driver Loaded ':'
Checking for icons in directory icons
No candidate icons found for machines
Attempting to parse: default.cfg
Attempting to parse: ___empty.cfg
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00
SDL: ERROR! Unknown video mode: R=FF000000 G=00FF0000 B=0000FF00


Code
# SDL_VIDEODRIVER=fbcon ./mame -verbose
Attempting load of mame.ini
Attempting load of mame.ini
Starting plugin data...
Attempting load of mame.ini
Attempting load of mame.ini
Could not initialize SDL fbcon not available


Code
# ./mame -verbose -video bgfx -bgfx_backend gles -bgfx_debug
Attempting load of mame.ini
Attempting load of mame.ini
Starting plugin data...
Attempting load of mame.ini
Attempting load of mame.ini
Available videodrivers: x11 mali dummy 
Current Videodriver: mali
	Display #0
		Renderdrivers:
			 opengles2 (0x0)
			  opengles (0x0)
			  software (0x0)
Available audio drivers: 
	alsa                
	dsp                 
	disk                
	dummy               
Build version:      0.214 (unknown)
Build architecure:  
Build defines 1:    SDLMAME_UNIX=1 SDLMAME_LINUX=1 
Build defines 1:    LSB_FIRST=1 PTR64=1 MAME_NOASM=1 
SDL/OpenGL defines: SDL_COMPILEDVERSION=2008 USE_OPENGL=0 
Compiler defines A: __GNUC__=7 __GNUC_MINOR__=4 __GNUC_PATCHLEVEL__=0 __VERSION__="7.4.0" 
Compiler defines B: __unix__=1 
Compiler defines C: __USE_FORTIFY_LEVEL=0 
Enter init_monitors
Adding monitor screen0 (3840 x 2160)
Leave init_monitors
Enter sdlwindow_init

Hints:
	SDL_FRAMEBUFFER_ACCELERATION             (null)
	SDL_RENDER_DRIVER                        (null)
	SDL_RENDER_OPENGL_SHADERS                (null)
	SDL_RENDER_SCALE_QUALITY                 (null)
	SDL_RENDER_VSYNC                         (null)
	SDL_VIDEO_X11_XVIDMODE                   (null)
	SDL_VIDEO_X11_XINERAMA                   (null)
	SDL_VIDEO_X11_XRANDR                     (null)
	SDL_GRAB_KEYBOARD                        (null)
	SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS         (null)
	SDL_IOS_IDLE_TIMER_DISABLED              (null)
	SDL_IOS_ORIENTATIONS                     (null)
	SDL_XINPUT_ENABLED                       (null)
	SDL_GAMECONTROLLERCONFIG                 (null)
	SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS     (null)
	SDL_ALLOW_TOPMOST                        (null)
	SDL_TIMER_RESOLUTION                     (null)
	SDL_RENDER_DIRECT3D_THREADSAFE           (null)
	SDL_VIDEO_ALLOW_SCREENSAVER              (null)
	SDL_ACCELEROMETER_AS_JOYSTICK            (null)
	SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   (null)
	SDL_VIDEO_WIN_D3DCOMPILER                (null)
	SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT      (null)
	SDL_VIDEO_MAC_FULLSCREEN_SPACES          (null)
	SDL_MOUSE_RELATIVE_MODE_WARP             (null)
	SDL_RENDER_DIRECT3D11_DEBUG              (null)
	SDL_VIDEO_HIGHDPI_DISABLED               (null)
	SDL_WINRT_PRIVACY_POLICY_URL             (null)
	SDL_WINRT_PRIVACY_POLICY_LABEL           (null)
	SDL_WINRT_HANDLE_BACK_BUTTON             (null)
Leave sdlwindow_init
Enter sdl_info::create
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp (177): BGFX 0x00000002: Failed to create display 0x0
Aborted

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116115 10/06/19 12:17 PM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
Thank you! This is unfortunately above my paygrade but the info will hopefully help others figure out what is going on.
SDL_VIDEODRIVER=fbdev is not working because it is called mali according to the verbose output.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116116 10/06/19 12:31 PM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
BGFX requires EGL (the layer underneath both X and Wayland if you're using a Mesa-based OpenGL driver) for GLES.

SDL_VIDEODRIVER=mali is failing because it uses a non-standard pixel format that MAME doesn't know how to draw to.

Last edited by R. Belmont; 10/06/19 12:32 PM.
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116117 10/06/19 03:48 PM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
I've checked in a change so SDL will understand that pixel format, try it again.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116119 10/06/19 07:24 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Another milestone. The OSD is displaying and so is the system (maciici) under emulation -- MAME launched from the linux console, no X windows.

Keyboard input works, mouse input does not. Text is blocky in the OSD, and upscaling of the emulated system is also blocky. Performance is very poor; I can't get the emulator to stop without a kill -9 so I can't get emulation speed, but it's worse by measure of experience in comparison to the original X experience.

When the system is running, the mame process is consuming all of 1 cpu core on the SBC and not really any of the other cpu cores.

Compiled with belegdol's OpenGL -> OpenGLES bgfx fix:

Code
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 4ec2084d0f..ea6fa2f506 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -1347,6 +1347,12 @@ end
                "__STDC_CONSTANT_MACROS",
                "BGFX_CONFIG_MAX_FRAME_BUFFERS=128",
        }
+       if _OPTIONS["NO_X11"]=="1" then
+               defines {
+               "BGFX_CONFIG_RENDERER_OPENGLES=1",
+               "BGFX_CONFIG_RENDERER_OPENGL=0",
+               }
+       end



Verbose Output from MAME:
Code
Available videodrivers: x11 mali dummy 
Current Videodriver: mali
	Display #0
		Renderdrivers:
			 opengles2 (0x0)
			  opengles (0x0)
			  software (0x0)
Available audio drivers: 
	alsa                
	dsp                 
	disk                
	dummy               
Build version:      0.214 (mame0214-238-g5aac500dee-dirty)
Build architecure:  
Build defines 1:    SDLMAME_UNIX=1 SDLMAME_LINUX=1 
Build defines 1:    LSB_FIRST=1 PTR64=1 MAME_NOASM=1 
SDL/OpenGL defines: SDL_COMPILEDVERSION=2008 USE_OPENGL=0 
Compiler defines A: __GNUC__=7 __GNUC_MINOR__=4 __GNUC_PATCHLEVEL__=0 __VERSION__="7.4.0" 
Compiler defines B: __unix__=1 
Compiler defines C: __USE_FORTIFY_LEVEL=0 
Enter init_monitors
Adding monitor screen0 (3840 x 2160)
Leave init_monitors
Enter sdlwindow_init
Using SDL multi-window soft driver (SDL 2.0+)

Hints:
	SDL_FRAMEBUFFER_ACCELERATION             (NULL)
	SDL_RENDER_DRIVER                        (NULL)
	SDL_RENDER_OPENGL_SHADERS                (NULL)
	SDL_RENDER_SCALE_QUALITY                 (NULL)
	SDL_RENDER_VSYNC                         (NULL)
	SDL_VIDEO_X11_XVIDMODE                   (NULL)
	SDL_VIDEO_X11_XINERAMA                   (NULL)
	SDL_VIDEO_X11_XRANDR                     (NULL)
	SDL_GRAB_KEYBOARD                        (NULL)
	SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS         (NULL)
	SDL_IOS_IDLE_TIMER_DISABLED              (NULL)
	SDL_IOS_ORIENTATIONS                     (NULL)
	SDL_XINPUT_ENABLED                       (NULL)
	SDL_GAMECONTROLLERCONFIG                 (NULL)
	SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS     (NULL)
	SDL_ALLOW_TOPMOST                        (NULL)
	SDL_TIMER_RESOLUTION                     (NULL)
	SDL_RENDER_DIRECT3D_THREADSAFE           (NULL)
	SDL_VIDEO_ALLOW_SCREENSAVER              (NULL)
	SDL_ACCELEROMETER_AS_JOYSTICK            (NULL)
	SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   (NULL)
	SDL_VIDEO_WIN_D3DCOMPILER                (NULL)
	SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT      (NULL)
	SDL_VIDEO_MAC_FULLSCREEN_SPACES          (NULL)
	SDL_MOUSE_RELATIVE_MODE_WARP             (NULL)
	SDL_RENDER_DIRECT3D11_DEBUG              (NULL)
	SDL_VIDEO_HIGHDPI_DISABLED               (NULL)
	SDL_WINRT_PRIVACY_POLICY_URL             (NULL)
	SDL_WINRT_PRIVACY_POLICY_LABEL           (NULL)
	SDL_WINRT_HANDLE_BACK_BUTTON             (NULL)
Leave sdlwindow_init
Enter sdl_info::create
window: using renderer opengles2
renderer: flag SDL_RENDERER_ACCELERATED
Leave renderer_sdl2::create
Audio: Start initialization
Audio: Driver is alsa
Audio: frequency: 48000, channels: 2, samples: 512
sdl_create_buffers: creating stream buffer of 25600 bytes
Audio: End initialization
Keyboard: Start initialization
Input: Adding keyboard #0: System keyboard (device id: System keyboard)
Keyboard: Registered System keyboard
Keyboard: End initialization
Mouse: Start initialization
Input: Adding mouse #0: System mouse (device id: System mouse)
Mouse: Registered System mouse
Mouse: End initialization
Joystick: Start initialization
Joystick: End initialization
Searching font Liberation Sans in -. path/s
font Liberation Sans|Regular is not TrueType or BDF, using MAME default
Input: Autoenabling mouse due to presence of a mouse

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116120 10/06/19 07:49 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Figured out how to get emulation speed. 7.5% with the above described. When run with "-video none" emulation speed is at 95% and system sounds can be heard accurately (audio works). cpu utilization is still 100% on a single core.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116121 10/06/19 09:23 PM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
So we're back to the N2 has garbage video drivers.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116124 10/06/19 09:35 PM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
@ Steve: Out of curiosity, you mentioned promising glmark-es2-fbdev results. On the hardkernel page [1] the results are reported with --off-screen. Does this parameter have an influence on the score and does the benchmark actually draw anything if it is not used?
If the benchmark draws stuff and the performance is not tragic maybe the benchmark's source code could offer insights of what N2 graphic driver can do fast.

[1] https://www.hardkernel.com/shop/odroid-n2-with-4gbyte-ram/

Last edited by belegdol; 10/06/19 09:38 PM.
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116125 10/06/19 09:49 PM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
For most of these ARM boards, they have decent-ish drivers only for Android, you're kind of on your own for Linux. (Android uses a pretty seriously modified Linux kernel and basically no Linux userland components, so drivers are different).

Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116126 10/06/19 10:00 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
With and without --off-screen. Yes, the latter does draw on screen. The visual experience matches the on-screen benchmark. I assume that the on-screen FPS is limited by the capability of the connected television's FPS?

Code
root@odroid:~# glmark2-es2-fbdev --off-screen
=======================================================
    glmark2 2012.12
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-G52
    GL_VERSION:    OpenGL ES 3.2 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
=======================================================
[build] use-vbo=false: FPS: 127 FrameTime: 7.874 ms
[build] use-vbo=true: FPS: 149 FrameTime: 6.711 ms
[texture] texture-filter=nearest: FPS: 138 FrameTime: 7.246 ms
[texture] texture-filter=linear: FPS: 139 FrameTime: 7.194 ms
[texture] texture-filter=mipmap: FPS: 137 FrameTime: 7.299 ms
[shading] shading=gouraud: FPS: 137 FrameTime: 7.299 ms
[shading] shading=blinn-phong-inf: FPS: 137 FrameTime: 7.299 ms
[shading] shading=phong: FPS: 135 FrameTime: 7.407 ms
[bump] bump-render=high-poly: FPS: 121 FrameTime: 8.264 ms
[bump] bump-render=normals: FPS: 148 FrameTime: 6.757 ms
[bump] bump-render=height: FPS: 151 FrameTime: 6.623 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 73 FrameTime: 13.699 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 25 FrameTime: 40.000 ms
[pulsar] light=false:quads=5:texture=false: FPS: 133 FrameTime: 7.519 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 26 FrameTime: 38.462 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] effect=shadow:windows=4: FPS: 51 FrameTime: 19.608 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 46 FrameTime: 21.739 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 47 FrameTime: 21.277 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 52 FrameTime: 19.231 ms
[ideas] speed=duration: FPS: 80 FrameTime: 12.500 ms
[jellyfish] <default>: FPS: 104 FrameTime: 9.615 ms
[terrain] <default>: FPS: 7 FrameTime: 142.857 ms
[shadow] <default>: FPS: 29 FrameTime: 34.483 ms
[refract] <default>: FPS: 16 FrameTime: 62.500 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 136 FrameTime: 7.353 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 134 FrameTime: 7.463 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 133 FrameTime: 7.519 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 133 FrameTime: 7.519 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 129 FrameTime: 7.752 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 135 FrameTime: 7.407 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 137 FrameTime: 7.299 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 135 FrameTime: 7.407 ms
=======================================================
                                  glmark2 Score: 102 
=======================================================


Code
root@odroid:~# glmark2-es2-fbdev
=======================================================
    glmark2 2012.12
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-G52
    GL_VERSION:    OpenGL ES 3.2 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
=======================================================
[build] use-vbo=false: FPS: 30 FrameTime: 33.333 ms
[build] use-vbo=true: FPS: 30 FrameTime: 33.333 ms
[texture] texture-filter=nearest: FPS: 30 FrameTime: 33.333 ms
[texture] texture-filter=linear: FPS: 30 FrameTime: 33.333 ms
[texture] texture-filter=mipmap: FPS: 30 FrameTime: 33.333 ms
[shading] shading=gouraud: FPS: 30 FrameTime: 33.333 ms
[shading] shading=blinn-phong-inf: FPS: 30 FrameTime: 33.333 ms
[shading] shading=phong: FPS: 30 FrameTime: 33.333 ms
[bump] bump-render=high-poly: FPS: 30 FrameTime: 33.333 ms
[bump] bump-render=normals: FPS: 30 FrameTime: 33.333 ms
[bump] bump-render=height: FPS: 30 FrameTime: 33.333 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 30 FrameTime: 33.333 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 15 FrameTime: 66.667 ms
[pulsar] light=false:quads=5:texture=false: FPS: 30 FrameTime: 33.333 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 30 FrameTime: 33.333 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] effect=shadow:windows=4: FPS: 30 FrameTime: 33.333 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 30 FrameTime: 33.333 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 30 FrameTime: 33.333 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 30 FrameTime: 33.333 ms
[ideas] speed=duration: FPS: 30 FrameTime: 33.333 ms
[jellyfish] <default>: FPS: 30 FrameTime: 33.333 ms
[terrain] <default>: FPS: 8 FrameTime: 125.000 ms
[shadow] <default>: FPS: 30 FrameTime: 33.333 ms
[refract] <default>: FPS: 20 FrameTime: 50.000 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 29 FrameTime: 34.483 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 30 FrameTime: 33.333 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 30 FrameTime: 33.333 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 30 FrameTime: 33.333 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 30 FrameTime: 33.333 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 30 FrameTime: 33.333 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 30 FrameTime: 33.333 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 30 FrameTime: 33.333 ms
=======================================================
                                  glmark2 Score: 28 
=======================================================

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116127 10/06/19 10:09 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
I'm googling for something... but is there a known good benchmark tool for GPU performance over SDL?

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116128 10/07/19 12:06 AM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
Ok, that run shows that the GPU/driver stack is tragic when drawing to the screen, which is kind of what you use GPUs for.

Re: MAME on ODROID-N2 (Linux) [Re: R. Belmont] #116129 10/07/19 02:35 AM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
I should provide another set of numbers from glmark2. When I get the SBC to move from 4K to 1080P display, I get a comparatively better result:

Code
# glmark2-es2-fbdev --off-screen
=======================================================
    glmark2 2012.12
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-G52
    GL_VERSION:    OpenGL ES 3.2 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
=======================================================
[build] use-vbo=false: FPS: 289 FrameTime: 3.460 ms
[build] use-vbo=true: FPS: 451 FrameTime: 2.217 ms
[texture] texture-filter=nearest: FPS: 457 FrameTime: 2.188 ms
[texture] texture-filter=linear: FPS: 454 FrameTime: 2.203 ms
[texture] texture-filter=mipmap: FPS: 469 FrameTime: 2.132 ms
[shading] shading=gouraud: FPS: 403 FrameTime: 2.481 ms
[shading] shading=blinn-phong-inf: FPS: 397 FrameTime: 2.519 ms
[shading] shading=phong: FPS: 375 FrameTime: 2.667 ms
[bump] bump-render=high-poly: FPS: 279 FrameTime: 3.584 ms
[bump] bump-render=normals: FPS: 480 FrameTime: 2.083 ms
[bump] bump-render=height: FPS: 494 FrameTime: 2.024 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 272 FrameTime: 3.676 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 97 FrameTime: 10.309 ms
[pulsar] light=false:quads=5:texture=false: FPS: 411 FrameTime: 2.433 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 89 FrameTime: 11.236 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] effect=shadow:windows=4: FPS: 147 FrameTime: 6.803 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 62 FrameTime: 16.129 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 64 FrameTime: 15.625 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 71 FrameTime: 14.085 ms
[ideas] speed=duration: FPS: 162 FrameTime: 6.173 ms
[jellyfish] <default>: FPS: 309 FrameTime: 3.236 ms
[terrain] <default>: FPS: 22 FrameTime: 45.455 ms
[shadow] <default>: FPS: 94 FrameTime: 10.638 ms
[refract] <default>: FPS: 43 FrameTime: 23.256 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 430 FrameTime: 2.326 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 426 FrameTime: 2.347 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 442 FrameTime: 2.262 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 432 FrameTime: 2.315 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 436 FrameTime: 2.294 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 442 FrameTime: 2.262 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 441 FrameTime: 2.268 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 434 FrameTime: 2.304 ms
=======================================================
                                  glmark2 Score: 308 
=======================================================

Some of these tests were still drawn on-screen (typically the ones with lower FPS).

Code
root@odroid:~# glmark2-es2-fbdev 
=======================================================
    glmark2 2012.12
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-G52
    GL_VERSION:    OpenGL ES 3.2 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
=======================================================
[build] use-vbo=false: FPS: 60 FrameTime: 16.667 ms
[build] use-vbo=true: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=nearest: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=linear: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=mipmap: FPS: 60 FrameTime: 16.667 ms
[shading] shading=gouraud: FPS: 60 FrameTime: 16.667 ms
[shading] shading=blinn-phong-inf: FPS: 60 FrameTime: 16.667 ms
[shading] shading=phong: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=high-poly: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=normals: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=height: FPS: 60 FrameTime: 16.667 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 60 FrameTime: 16.667 ms
libpng warning: iCCP: known incorrect sRGB profile
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 60 FrameTime: 16.667 ms
[pulsar] light=false:quads=5:texture=false: FPS: 60 FrameTime: 16.667 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 59 FrameTime: 16.949 ms
libpng warning: iCCP: known incorrect sRGB profile
[desktop] effect=shadow:windows=4: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 59 FrameTime: 16.949 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 59 FrameTime: 16.949 ms
[ideas] speed=duration: FPS: 60 FrameTime: 16.667 ms
[jellyfish] <default>: FPS: 60 FrameTime: 16.667 ms
[terrain] <default>: FPS: 26 FrameTime: 38.462 ms
[shadow] <default>: FPS: 60 FrameTime: 16.667 ms
[refract] <default>: FPS: 47 FrameTime: 21.277 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
=======================================================
                                  glmark2 Score: 58 
=======================================================


MAME performance bounces up to 26% in 1080p. MAME is still only using a single cpu core.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116130 10/07/19 05:00 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
There is definitely potential in this SBC:
https://www.cnx-software.com/2019/0...ux-5-0-and-impressive-glmarks-es2-score/
Mame does not support Wayland yet, but once it does the performance might improve considerably.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116136 10/07/19 11:41 AM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
Originally Posted by Steve Bourg
MAME is still only using a single cpu core.


You keep saying that like it's some kind of damning thing. Emulators are inherently single-threaded for the most part; you can't reasonably synchronize the various moving parts of a machine if they're on different CPUs. On real computers, the GPU driver usually runs in a separate thread, which helps a lot, but apparently that's not a thing on the N2.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116146 10/07/19 02:47 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
I only mention CPU utilization in case it's relevant to diagnosis. When I was running MAME on the original Ubuntu MATE / X image, I recall aggregate CPU utilization at 450%. I don't remember if that was mostly mame itself, or if it was mame at 100% + 350% of X / X driver stuff.

Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116147 10/07/19 02:56 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
The Wayland numbers do stand out, but I was told by one person in the odroid community that "wayland is not likely to happen in the lifetime of N2" - I think referring to a complete / stable implementation.

The prospect of a sub $100 SBC running MAME is really interesting. maciici is my target. Is there any SBC known to perform well and match well with mame for this type of emulated system?

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116152 10/07/19 05:38 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Sorry for the delay in getting back to you with results from the Rpi4. I do have some numbers for you now:

Raw maciici emulation speed is roughly 150%:

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -bench 60
Average speed: 149.61% (59 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -bench 60
Average speed: 154.16% (59 seconds)


Of course, when I add video display output, things slow down a bit:

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomaximize
Average speed: 88.35% (45 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomaximize -video accel
Average speed: 93.08% (44 seconds)


And some sdlvideofps results:

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomaximize -sdlvideofps
 60.58s, 3224 F, avrg game: 53.22 FPS 18.79 ms/f, avrg video: 137.67 FPS 7.26 ms/f, last video:   inf FPS 7.15 ms/f
Average speed: 88.67% (73 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomaximize -video accel -sdlvideofps
 60.56s, 3407 F, avrg game: 56.26 FPS 17.77 ms/f, avrg video: 161.21 FPS 6.20 ms/f, last video:   inf FPS 6.07 ms/f
Average speed: 93.85% (58 seconds)


These results were obtained on a 4GB Rpi4 overclocked to 2.147 GHz CPU, 600 MHz GPU. The mame binary was compiled using all default settings.

When I run the maciici in non-maximized window mode, the startup chime is played correctly. If I run it full screen, the chime becomes extremely choppy.

Note that in all tests I was simply booting the Mac IIci ROM and not actually booting from floppy into System "x", primarily because I don't know how to do that...

Let me know if you want me to do any further experiments...

-Robert

Last edited by Robert Hildinger; 10/07/19 05:56 PM. Reason: Accidentally clicked post way too soon
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116153 10/07/19 06:30 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Here's some more info on running macIIci on Rpi4. It appears that there is at least some level of support for wayland based on this verbose output:

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomaximize -video accel -verbose
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of computer.ini
Attempting load of raster.ini
Attempting load of source/mac.ini
Attempting load of maciici.ini
Starting plugin data...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of computer.ini
Attempting load of raster.ini
Attempting load of source/mac.ini
Attempting load of maciici.ini
Available videodrivers: x11 wayland RPI dummy 
Current Videodriver: x11
	Display #0
		Renderdrivers:
			    opengl (0x0)
			 opengles2 (0x0)
			  opengles (0x0)
			  software (0x0)


Notice the available videodrivers: x11 wayland RPI dummy

I tried switching videodrivers from the command line, but as expected it did not work. Not sure if that's an SDL limitation or a MAME one...

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomaximize -video accel -verbose -videodriver wayland
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of computer.ini
Attempting load of raster.ini
Attempting load of source/mac.ini
Attempting load of maciici.ini
Starting plugin data...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of computer.ini
Attempting load of raster.ini
Attempting load of source/mac.ini
Attempting load of maciici.ini
Setting SDL videodriver 'wayland' ...
Could not initialize SDL wayland not available


Not sure what it would take to enable wayland support...

-Robert

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116154 10/07/19 08:43 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Thanks for those benchmarks Robert. How confident are you in an overclocked configuration like that?

I just used your -video accel switch, and performance on the odroid n2 jumped into the 80-95% range (90% in first 10 seconds, 80-85% for 60 second duration). This was on 1920x1080 display resolution, on linux console (No X windows). So that's exciting. Just shy of success for either path it seems.

I may go back to my Ubuntu MATE image and see if the switch has any effect.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116155 10/07/19 09:24 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
How confident? Well, I have two Rpi4's that will reach 2.147GHz (which is the current maximum the firmware will allow), and one that won't. The two that will seem to be very stable - I've never had to reboot either of them for a crash, but I haven't done a lot of hardcore stability testing either.

The OC'ed Rpi4 emulates at around 140-150% of real hardware, so it seems like there's enough headroom to deliver a decent experience if we could just speed up the video portion.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116162 10/08/19 07:20 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Here's some more data that I took from running all available video switches. As it turns out, -video bgfx provides the best speed...

NOTE: On the Rpi4 at least, "-video soft" is equivalent to no video switch at all, which implies that the default renderer is software only.

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video soft
Average speed: 80.72% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video accel
Average speed: 84.03% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video opengl
Average speed: 87.43% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video bgfx
Average speed: 99.32% (29 seconds)

pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video soft -sdlvideofps
 35.51s, 1688 F, avrg game: 47.54 FPS 21.04 ms/f, avrg video: 117.81 FPS 8.49 ms/f, last video:   inf FPS 8.48 ms/f
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video accel -sdlvideofps
 33.22s, 1662 F, avrg game: 50.02 FPS 19.99 ms/f, avrg video: 134.89 FPS 7.41 ms/f, last video:   inf FPS 7.44 ms/f
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video opengl -sdlvideofps
 32.45s, 1703 F, avrg game: 52.49 FPS 19.05 ms/f, avrg video: 152.04 FPS 6.58 ms/f, last video:   inf FPS 6.68 ms/f
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -nomax -seconds_to_run 30 -video bgfx -sdlvideofps
 28.15s, 1668 F, avrg game: 59.25 FPS 16.88 ms/f, avrg video: 269.29 FPS 3.71 ms/f, last video:   inf FPS 3.62 ms/f


Video mode differences (judging solely by information returned from -verbose flag):
- soft: SDL multi-window soft driver
- accel: SDL native texturing driver
- opengl: SDL multi-window OpenGL driver
- bgfx: No discerning info found in -verbose output, but display seems to be running in separate thread now.

bgfx is the clear winner here for the Rpi4...

-Robert


Last edited by Robert Hildinger; 10/08/19 07:20 PM.
Re: MAME on ODROID-N2 (Linux) [Re: Robert Hildinger] #116163 10/08/19 08:06 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Wow, thanks Robert. This is running from within X windows? What is the video resolution of your host environment for these tests?

Would you mind sharing a -video bgfx result without both -window and -nomax, and with -window but without -nomax?

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116164 10/08/19 08:39 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Those results were from within X windows running at 3840x2160 - 60 fps, though the resolution shouldn't have affected the results much as they were always run in a 640x480 window (the size of the default Mac II ci screen).

I took the resolution down to 1920x1080 for the following tests:


Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -nowindow -max -seconds_to_run 30 -video bgfx
Average speed: 68.43% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -max -seconds_to_run 30 -video bgfx
Average speed: 88.03% (29 seconds)

pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -nowindow -max -seconds_to_run 30 -video accel
Average speed: 83.79% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -max -seconds_to_run 30 -video accel
Average speed: 89.58% (29 seconds)

pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -nowindow -max -seconds_to_run 30 -video accel -renderdriver opengles2
Average speed: 99.20% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -max -seconds_to_run 30 -video accel -renderdriver opengles2
Average speed: 99.41% (29 seconds)

pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -nowindow -max -seconds_to_run 30 -video accel -renderdriver opengles2 -nothrottle
Average speed: 101.58% (29 seconds)
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -window -max -seconds_to_run 30 -video accel -renderdriver opengles2 -nothrottle
Average speed: 107.94% (29 seconds)



That was definitely unexpected. It looks like the separate thread benefit of bgfx goes away when the output resolution increases. Now the clear winner is accel with the opengles2 render driver...

-Robert

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116165 10/08/19 08:51 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
In X on the Odroid N2 (1920x1080), I'm clocking in at 99.x% with maciici -video bgfx -window -nomax -seconds_to_run 30, but this drops into the 85% range when I boot an actual OS. The use of bgfx balloons cpu utilization to 450% (200% with -video accel). The emulation speed gets far worse without -max on odroidn2/X. I think I'm seeing comparable sdlvideofps, maybe?:

28.16s, 1670 F, avrg game: 59.31 FPS 16.86 ms/f, avrg video: 761.33 FPS 1.31 ms/f, last video: inf FPS 0.94 ms/f

There are definitely performance artifacts at 85% emulation speed, but it's nice to get that close. I'll have to go back to console/framebuffer and see if bgfx does something helpful there (to my recollection, it wasn't a working option even with belegdol's 2nd fix).

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116166 10/08/19 09:18 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Is that with mame compiled with default options, or with all of the modifications from this thread?

Your sdlvideofps results are considerably better than the max I am able to achieve on the Rpi4. I top out at around 300 FPS, where you're getting 761 FPS. Not exactly sure how to interpret that...

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116167 10/08/19 10:43 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
These results are from MAME compiled with default options, run in the Ubuntu MATE release shipped for the Odroid. Host display resolution is at 1920x1080.

Last edited by Steve Bourg; 10/08/19 10:44 PM.
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116168 10/08/19 10:58 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Here's something you might find interesting. Based on the information here ( http://mameui.info/Bench.htm ), it appears that MAME in general suffered a pretty big performance setback with version 0.200. I think it was related to memory handlers, but not sure. Anyway, I compiled version 0.199 of mame to see if it made a difference in the maciici emulation, and it turns out it makes a fairly big difference:

Current mame:

Code
pi@raspberrypi:~/MAME/mame $ ./mamemac maciici -bench 60
Average speed: 143.10% (59 seconds)

Old mame 0.199:

Code
pi@raspberrypi:~/MAME/old/199/mame $ ./mamemac199 maciici -bench 60
Average speed: 180.19% (59 seconds)


For this specific case, mame v0.199 emulates the maciici 26% faster. If you want to try it yourself you'll have to recompile your mame from scratch, and do a "git checkout mame0199" in your repo before building.

-Robert

Re: MAME on ODROID-N2 (Linux) [Re: Robert Hildinger] #116169 10/08/19 11:08 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
That that stings, as I need a capability/fix as of 0201.. I'll definitely give it a try though.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116172 10/10/19 04:22 AM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
I've posted steps for building / running MAME on the odroid-n2 over at their forum https://forum.odroid.com/viewtopic.php?f=177&t=36521 crashovrd (irc name), is willing to reproduce the build and then see if there's anything that can be optimized.

Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116190 10/16/19 11:42 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Originally Posted by belegdol
I might have found a solution less drastic than ripping out bgfx entirely: due to logic in 3rdparty/bgfx/config.h and 3rdparty/bgfx/renderer_gl.h, bgfx appears to default to glx under linux. I have now tested the following hack:
Code
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 4ec2084d0f..ea6fa2f506 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -1347,6 +1347,12 @@ end
                "__STDC_CONSTANT_MACROS",
                "BGFX_CONFIG_MAX_FRAME_BUFFERS=128",
        }
+       if _OPTIONS["NO_X11"]=="1" then
+               defines {
+               "BGFX_CONFIG_RENDERER_OPENGLES=1",
+               "BGFX_CONFIG_RENDERER_OPENGL=0",
+               }
+       end

With this change, mame can be built with
Code
$ make NO_X11=1 NOWERROR=1 NO_USE_XINPUT=1 NO_OPENGL=1

without hitting linking errors with bgfx. Bgfx uses OpenGL ES afterwards too which might be helpful as well.


Code
26a27
> # NO_OPENGL = 0
713a715,718
> endif
> 
> ifdef NO_OPENGL
> PARAMS += --NO_OPENGL='$(NO_OPENGL)'


Hi Belegdol -

Belmont's pixel format change allowed mame to run at console framebuffer, which is now in mame. The changes you provide above allowed me to compile mame without X / OpenGL on the odroid-n2. Is there any path forward to get this pulled into the mame?

As well, there's another patch provided by crashoverride in this thread that enabled framebuffered bgfx from console. Any chance of getting this into mame?

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116192 10/17/19 06:08 AM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
The patch disabling bgfx entirely was not endorsed by upstream. We are thus left with 3 changes:
- Switching BGFX to OpenGL ES if NO_X11 is specified
- Allowing passing NO_OPENGL explicitly
- bgfx changes by crashoverride

The way to get those in would be via a pull request. I can make a PR with the two buildsystem changes later this week. The bgfx changes should ideally be submitted to bgfx upstream first (https://github.com/bkaradzic/bgfx).

Last edited by belegdol; 10/17/19 06:09 AM.
Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116193 10/17/19 07:17 AM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
I may have just encountered a problem with crashoverride's bgfx changes (whether it's something specific to crashoverride's code that enables the use of bgfx or it's some other problem with bgfx on odroid-n2, or just something else about that compiled binary, I don't know). The game I'm playing consistently locks up at a screen change that only happens with that bgfx binary. So I recommend handling that contribution separately.

I stopped using the patch you originally provided that completely disabled/stripped bgfx, and I have been using your second approach "BGFX to OpenGL ES if NO_X11". I believe it took both your "NO_OPENGL" and your "BGFX to OpenGL ES if no NO_X11" patches to get mame compiled on the odroid n2 without X. I would just mention that even with the second approach, running mame with "-video bgfx" did not work - I encounter the error:
Code
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp (177): BGFX 0x00000002: Failed to create display 0x0
Aborted

Your second approach did enable me to get MAME compiled/linked, and MAME's performance with -video accel is just 2% less than -video bgfx from crashoverride's patch. This runs at ~ 90% emulation speed on the odroid n2. So your second approach is a big win even without a working -video bgfx option.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116198 10/17/19 02:37 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Online Content OP
Member
OP Online Content
Member
S
Joined: Aug 2019
Posts: 25
Quote
belegdol: can you run a build with VERBOSE=1 and post what flags are being used?


Is this the output you're looking for?
Code
3rdparty/genie/bin/linux/genie --distro=generic --OPTIMIZE=3 --NOWERROR='1' --target='mame' --subtarget='mame' --build-dir='build' --NO_OPENGL='1' --NO_X11='1' --NO_USE_XINPUT='1' --SOURCES='src/mame/drivers/mac.cpp' --NOASM='1' --osd='sdl' --targetos='linux' --PLATFORM='arm64' --gcc=linux-gcc --gcc_version=7 gmake
..
Precompiling src/emu/emu.h...
g++    -MMD -MP -MP -DNDEBUG -DCRLF=2 -DLSB_FIRST -DFLAC__NO_DLL -DPUGIXML_HEADER_ONLY -DMAME_NOASM -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DPTR64=1 -I"../../../../../src/osd" -I"../../../../../src/emu" -I"../../../../../src/lib/util"  -pipe -O3 -fno-strict-aliasing -Wno-unknown-pragmas -Wall -Wcast-align -Wundef -Wformat-security -Wwrite-strings -Wno-sign-compare -Wno-conversion -Wno-error=deprecated-declarations -Wno-unused-result -Wno-array-bounds -Wno-cast-align -x c++ -std=c++14 -Woverloaded-virtual -Wsuggest-override -flifetime-dse=1 -x c++-header -DNDEBUG -DCRLF=2 -DLSB_FIRST -DFLAC__NO_DLL -DPUGIXML_HEADER_ONLY -DMAME_NOASM -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DPTR64=1 -I"../../../../../src/osd" -I"../../../../../src/emu" -I"../../../../../src/lib/util" -o "obj/Release/emu.h.gch" -c "../../../../../src/emu/emu.h"

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116199 10/17/19 04:29 PM
Joined: Oct 2019
Posts: 9
R
Robert Hildinger Online Content
Member
Online Content
Member
R
Joined: Oct 2019
Posts: 9
Originally Posted by Steve Bourg
That that stings, as I need a capability/fix as of 0201.. I'll definitely give it a try though.


As it turns out, the maciici emulation doesn't suffer much of a performance hit from the memory system rewrite in 0.200. The actual point where the hit occurs is between 0.203 and 0.204, but I don't yet know which commit caused it. You could try compiling 0.203 and see if that gives you a performance boost.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116200 10/17/19 04:45 PM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
Originally Posted by Steve Bourg
Quote
belegdol: can you run a build with VERBOSE=1 and post what flags are being used?


Is this the output you're looking for?
Code
3rdparty/genie/bin/linux/genie --distro=generic --OPTIMIZE=3 --NOWERROR='1' --target='mame' --subtarget='mame' --build-dir='build' --NO_OPENGL='1' --NO_X11='1' --NO_USE_XINPUT='1' --SOURCES='src/mame/drivers/mac.cpp' --NOASM='1' --osd='sdl' --targetos='linux' --PLATFORM='arm64' --gcc=linux-gcc --gcc_version=7 gmake
..
Precompiling src/emu/emu.h...
g++    -MMD -MP -MP -DNDEBUG -DCRLF=2 -DLSB_FIRST -DFLAC__NO_DLL -DPUGIXML_HEADER_ONLY -DMAME_NOASM -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DPTR64=1 -I"../../../../../src/osd" -I"../../../../../src/emu" -I"../../../../../src/lib/util"  -pipe -O3 -fno-strict-aliasing -Wno-unknown-pragmas -Wall -Wcast-align -Wundef -Wformat-security -Wwrite-strings -Wno-sign-compare -Wno-conversion -Wno-error=deprecated-declarations -Wno-unused-result -Wno-array-bounds -Wno-cast-align -x c++ -std=c++14 -Woverloaded-virtual -Wsuggest-override -flifetime-dse=1 -x c++-header -DNDEBUG -DCRLF=2 -DLSB_FIRST -DFLAC__NO_DLL -DPUGIXML_HEADER_ONLY -DMAME_NOASM -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DPTR64=1 -I"../../../../../src/osd" -I"../../../../../src/emu" -I"../../../../../src/lib/util" -o "obj/Release/emu.h.gch" -c "../../../../../src/emu/emu.h"

Yes, these are the droids I am looking for. You could try passing ARCHOPTS=-march=native to make (need to do REGENIE=1 for the change to take effect). Make sure the flag actually does anything by running
Code
$ gcc -march=native -E -v - </dev/null 2>&1 | grep cc1

Don't hold your breath, but if a couple percent speed bump is all you need this might just do the trick.

Re: MAME on ODROID-N2 (Linux) [Re: Robert Hildinger] #116201 10/17/19 05:26 PM
Joined: Apr 2006
Posts: 711
Tafoid Offline
Senior Member
Offline
Senior Member
Joined: Apr 2006
Posts: 711
Originally Posted by Robert Hildinger
Originally Posted by Steve Bourg
That that stings, as I need a capability/fix as of 0201.. I'll definitely give it a try though.


As it turns out, the maciici emulation doesn't suffer much of a performance hit from the memory system rewrite in 0.200. The actual point where the hit occurs is between 0.203 and 0.204, but I don't yet know which commit caused it. You could try compiling 0.203 and see if that gives you a performance boost.


In some quick testing it appears refactoring/improving of m68kmmu on 11/2/18 and 11/3/18 (the machine broke down on initial commits and was fixed in 11/3/18) results in about ~10% drop in performance. Not sure if it can be undone or what the improvements are.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116202 10/17/19 05:46 PM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
Can't be undone, and the improvements are that it doesn't explode on contact with OSes that have more mature VM strategies than System 7.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116203 10/17/19 06:26 PM
Joined: Mar 2004
Posts: 624
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 624
Originally Posted by Steve Bourg
I may have just encountered a problem with crashoverride's bgfx changes (whether it's something specific to crashoverride's code that enables the use of bgfx or it's some other problem with bgfx on odroid-n2, or just something else about that compiled binary, I don't know). The game I'm playing consistently locks up at a screen change that only happens with that bgfx binary. So I recommend handling that contribution separately.

I stopped using the patch you originally provided that completely disabled/stripped bgfx, and I have been using your second approach "BGFX to OpenGL ES if NO_X11". I believe it took both your "NO_OPENGL" and your "BGFX to OpenGL ES if no NO_X11" patches to get mame compiled on the odroid n2 without X. I would just mention that even with the second approach, running mame with "-video bgfx" did not work - I encounter the error:
Code
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp (177): BGFX 0x00000002: Failed to create display 0x0
Aborted

Your second approach did enable me to get MAME compiled/linked, and MAME's performance with -video accel is just 2% less than -video bgfx from crashoverride's patch. This runs at ~ 90% emulation speed on the odroid n2. So your second approach is a big win even without a working -video bgfx option.

We have a bit of a problem. With the new bgfx simply switching to OpenGL ES no longer works, mame will fail to link:
Code
/usr/bin/ld: ../../../../linux_gcc/bin/x64/Release/libbgfx.a(glcontext_egl.o): in function `bgfx::gl::GlContext::createSwapChain(void*)':
glcontext_egl.cpp:(.text+0x82e): undefined reference to `eglGetCurrentSurface'
/usr/bin/ld: ../../../../linux_gcc/bin/x64/Release/libbgfx.a(glcontext_egl.o): in function `bgfx::gl::GlContext::destroySwapChain(bgfx::gl::SwapChainGL*)':
glcontext_egl.cpp:(.text+0x944): undefined reference to `eglGetCurrentSurface'
/usr/bin/ld: glcontext_egl.cpp:(.text+0x94c): undefined reference to `eglGetCurrentContext'
collect2: error: ld returned 1 exit status

Adding -lEGL to LDFLAGS takes care of that - mame links and runs:
Code
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 970afc7d45..2f108c7cd7 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -1383,6 +1383,14 @@ end
                "__STDC_CONSTANT_MACROS",
                "BGFX_CONFIG_MAX_FRAME_BUFFERS=128",
        }
+
+       if _OPTIONS["NO_X11"]=="1" then
+               defines {
+               "BGFX_CONFIG_RENDERER_OPENGLES=1",
+               "BGFX_CONFIG_RENDERER_OPENGL=0",
+               }
+       end
+
        files {
                MAME_DIR .. "3rdparty/bgfx/src/bgfx.cpp",
                MAME_DIR .. "3rdparty/bgfx/src/debug_renderdoc.cpp",
diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua
index ed660e65f9..9cd5415c88 100644
--- a/scripts/src/osd/sdl.lua
+++ b/scripts/src/osd/sdl.lua
@@ -29,6 +29,10 @@ function maintargetosdoptions(_target,_subtarget)
                        "X11",
                        "Xinerama",
                }
+       else
+               links {
+                       "EGL",
+               }
        end
 
        if _OPTIONS["NO_USE_XINPUT"]~="1" then

The issue is that putting forcing -lEGL whenever NO_X11 is specified is likely going to break windows and mac build at least. I feel like I am in over my head and that someone more familiar with interdependencies between X11, OpenGL and OpenGL ES should take care of incorporating the build switches.

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116204 10/17/19 06:33 PM
Joined: Mar 2001
Posts: 16,337
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,337
Put the NO_X11 EGL link inside a check for if _OPTIONS["targetos"]=="linux" or "netbsd" or "openbsd".

Page 1 of 6 1 2 3 4 5 6

Moderated by  R. Belmont 

Who's Online Now
4 registered members (Duke, hal3000, mixmaster, 1 invisible), 134 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,693
Posts114,272
Members4,865
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3