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 Offline OP
Member
OP Offline
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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 Offline OP
Member
OP Offline
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623

Re: MAME on ODROID-N2 (Linux) [Re: Steve Bourg] #116104 10/05/19 01:06 PM
Joined: Mar 2004
Posts: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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 Offline OP
Member
OP Offline
Member
S
Joined: Aug 2019
Posts: 25
Thanks! I'll try both approaches and report back.

Page 1 of 6 1 2 3 4 5 6

Moderated by  R. Belmont 

Who's Online Now
6 registered members (R. Belmont, Reznor007, Olivier Galibert, ICEknight, 2 invisible), 145 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,269
Members4,865
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3