Previous Thread
Next Thread
Print Thread
Page 2 of 6 1 2 3 4 5 6
Re: MAME on ODROID-N2 (Linux) [Re: belegdol] #116107 10/05/19 05:07 PM
Joined: Aug 2019
Posts: 25
S
Steve Bourg Offline OP
Member
OP Offline
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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 Offline OP
Member
OP Offline
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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 Offline OP
Member
OP Offline
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: 623
belegdol Online Content
Senior Member
Online Content
Senior Member
Joined: Mar 2004
Posts: 623
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,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
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,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
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 Offline OP
Member
OP Offline
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 Offline OP
Member
OP Offline
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.

Page 2 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