Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported to Loongson3A6000, start screen is shown but got segment fault when initializing sound #13072

Open
Iacob opened this issue Dec 11, 2024 · 2 comments

Comments

@Iacob
Copy link

Iacob commented Dec 11, 2024

MAME version

0.272

System information

CPU: Loongson-3A6000-HV
Audio device: Loongson Technology LLC HDA (High Definition Audio)
Video card: Loongson LG110

INI configuration details

No response

Emulated system/software

No response

Incorrect behaviour

Successfully built MAME on a Loongson3A6000 computer.
mame_start_screen

The start screen is displayed but got segment fault when initializing sound.

The gdb backtrace is:

(gdb) backtrace
#0 0x0000000000000078 in ?? ()
#1 0x0000000121d58d40 in util::detail::delegate_base<delegate_late_bind, void, sound_stream&, std::vector<read_stream_view, std::allocator<read_stream_view> > const&, std::vector<write_stream_view, std::allocator<write_stream_view> >&>::operator() (this=0x124b1c000, this=0x124b1c000, args#2=std::vector of length 1, capacity 1 = {...},
args#1=std::vector of length 0, capacity 0, args#0=...) at ../../../../../src/lib/util/delegate.h:760
#2 sound_stream::update_view (this=this@entry=0x124b1bee0, start=..., end=..., outputnum=, outputnum@entry=0) at ../../../../../src/emu/sound.cpp:742
#3 0x0000000121d5905c in sound_stream::update (this=0x124b1bee0) at ../../../../../src/emu/attotime.h:100
#4 0x000000012012d6e0 in non-virtual thunk to dac_byte_device_base::write(unsigned char) () at /usr/include/c++/8/ext/new_allocator.h:86
#5 0x0000000120c9bb44 in devcb_write<unsigned char, (unsigned char)255>::operator()(unsigned int, unsigned char, unsigned char) ()
at /usr/include/c++/8/bits/shared_ptr_base.h:404
#6 0x00000001202bce94 in addressable_latch_device::update_bit (this=0x1241dff00) at ../../../../../src/devices/machine/74259.cpp:216
#7 addressable_latch_device::enable_w (state=0, this=0x1241dff00) at ../../../../../src/devices/machine/74259.cpp:184
#8 addressable_latch_device::write_bit (d=, offset=, this=0x1241dff00) at ../../../../../src/devices/machine/74259.cpp:153
#9 addressable_latch_device::write_d0 (this=0x1241dff00, offset=, data=) at ../../../../../src/devices/machine/74259.cpp:241
#10 0x0000000120c3f534 in tms99xx_device::cru_output_operation (this=0x1241cd500) at ../../../../../src/lib/util/coretmpl.h:594
#11 0x0000000120c4534c in tms99xx_device::execute_run (this=0x1241cd500) at ../../../../../src/devices/cpu/tms9900/tms9900.cpp:1254
#12 0x0000000121d2b560 in device_execute_interface::run (this=0x1241cd7f0) at ../../../../../src/emu/diexec.h:189
#13 device_scheduler::timeslice (this=this@entry=0xffffff6128) at ../../../../../src/emu/schedule.cpp:456
#14 0x0000000121cc1e34 in running_machine::run (this=this@entry=0xffffff0ef0, quiet=quiet@entry=false) at ../../../../../src/emu/machine.cpp:348
#15 0x000000012273bee0 in mame_machine_manager::execute (this=this@entry=0x124059e20) at ../../../../../src/frontend/mame/mame.cpp:288
#16 0x00000001227e0c74 in cli_frontend::start_execution (this=this@entry=0xffffff6938, manager=manager@entry=0x124059e20, args=std::vector of length 3, capacity 3 = {...})
at ../../../../../src/frontend/mame/clifront.cpp:277
#17 0x00000001227e106c in cli_frontend::execute (this=this@entry=0xffffff6938, args=std::vector of length 3, capacity 3 = {...})
at ../../../../../src/frontend/mame/clifront.cpp:293
#18 0x00000001227385cc in emulator_info::start_frontend (options=..., osd=..., args=std::vector of length 3, capacity 3 = {...})
at ../../../../../src/frontend/mame/mame.cpp:453
#19 0x00000001200d3b68 in main (argc=, argv=) at ../../../../../src/osd/sdl/sdlmain.cpp:100
(gdb)

Expected behaviour

Switch to game screen.

Steps to reproduce

No response

Additional details

No response

@Iacob
Copy link
Author

Iacob commented Dec 11, 2024

Start the game looping, the initial screen is shown
looping

But got segment fault when starting the game

`
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of vertical.ini
Attempting load of raster.ini
Attempting load of source/looping.ini
Attempting load of looping.ini
Starting plugin data...
Starting plugin layout...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of vertical.ini
Attempting load of raster.ini
Attempting load of source/looping.ini
Attempting load of looping.ini
Available videodrivers: x11 offscreen dummy evdev
Current Videodriver: x11
Display #0
Desktop Mode: 1920x1080-24@60
Current Display Mode: 1920x1080-24@60
Renderdrivers:
opengl (0x0)
opengles2 (0x0)
software (0x0)
Available audio drivers:
pulseaudio
alsa
dsp
disk
dummy
Build version: 0.272 (unknown)
Build architecure:
Build defines 1: SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1
Build defines 1: LSB_FIRST=1 PTR64=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=5009 USE_OPENGL=1
Compiler defines A: GNUC=4 GNUC_MINOR=2 GNUC_PATCHLEVEL=1 VERSION="Loongnix Clang 13.0.1"
Compiler defines B: unix=1
Compiler defines C: __USE_FORTIFY_LEVEL=0
Enter init_monitors
Adding monitor screen0 (1920 x 1080)
Leave init_monitors
Using SDL multi-window OpenGL driver (SDL 2.0+)
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
OpenGL: X.Org
OpenGL: LoongGPU(TM) LG110 (DRM 1.0.0 / 4.19.0-19-loongson-3, LLVM 8.0.1)
OpenGL: 2.1 Mesa 18.3.6
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: framebuffer object supported
OpenGL: GLSL supported, but disabled
OpenGL: max texture size 8192 x 8192
Leave renderer_ogl::create
Audio: Start initialization
Audio: Driver is pulseaudio
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 #1: System keyboard (device id: System keyboard)
Keyboard: Registered System keyboard
Keyboard: End initialization
Mouse: Start initialization
Input: Adding mouse #1: System mouse (device id: System mouse)
Mouse: Registered System mouse
Mouse: End initialization
Lightgun: Start initialization
Input: Adding lightgun #1: System pointer gun 1 (device id: System pointer gun 1)
Lightgun: Registered System pointer gun 1
Lightgun: End initialization
Game Controller: Start initialization
Game Controller: End initialization
Searching font Liberation Sans in -. path/s
font Liberation Sans|Regular is not TrueType or BDF, using MAME default
unzip: opened archive file roms/looping.zip
unzip: found roms/looping.zip ECD at 1002
unzip: roms/looping.zip has no ZIP64 ECD locator
unzip: read roms/looping.zip central directory
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
unzip: found roms/looping.zip in cache
unzip: opened archive file roms/looping.zip
unzip: closing archive file roms/looping.zip and sending to cache
Optional memory region ':screen' not found
Starting Looping ':'
(missing dependencies; rescheduling)
Starting Texas Instruments TMS9995 ':maincpu'
Starting Texas Instruments TMS9980A ':audiocpu'
Starting National Semiconductor COP420 ':mcu'
Starting 74LS259 Addressable Latch ':mainlatch'
Starting Watchdog Timer ':watchdog'
Starting Video Screen ':screen'
(missing dependencies; rescheduling)
Starting gfxdecode ':gfxdecode'
Starting palette ':palette'
Starting 74LS259 Addressable Latch ':videolatch'
Starting Speaker ':speaker'
(missing dependencies; rescheduling)
Starting Generic 8-bit latch ':soundlatch'
Starting AY-3-8910A PSG ':aysnd'
Starting TMS5220 ':tms'
Starting 2-Bit R-2R DAC ':dac'
Starting 74LS259 Addressable Latch ':sen0'
Starting 74LS259 Addressable Latch ':sen1'
Starting Looping ':'
(missing dependencies; rescheduling)
Starting Video Screen ':screen'
Starting Speaker ':speaker'
Starting Looping ':'
Attempting to parse: default.cfg
Attempting to parse: looping.cfg
OpenGL: VBO supported
OpenGL: PBO supported
OpenGL: FBO supported
OpenGL: using vid filter: 1
Segmentation fault
`

@Iacob
Copy link
Author

Iacob commented Dec 11, 2024

The build command is:

export CFLAGS="-DPTR64=1 -g"
export CXXFLAGS="-g"
export LDFLAGS="-L/usr/local/lib"
make SUBTARGET=tiny PTR64=1 DEBUG=0 USE_QTDEBUG=0 OVERRIDE_CC=clang-13 OVERRIDE_CXX='clang++-13' OVERRIDE_LD=lld-13 OVERRIDE_AR=llvm-ar-13 VERBOSE=1

Because loongson compiler doesn't support the -m64 option, so I remove the -m64 option from the build script

diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index 966d55d1..68cbf2ec 100644
--- a/scripts/toolchain.lua
+++ b/scripts/toolchain.lua
@@ -372,7 +372,7 @@ function toolchain(_buildDir, _subDir)
configuration { "linux-clang", "x64" }
objdir (_buildDir .. "linux_clang" .. "/obj")
buildoptions {

  •                   "-m64",
    
  •           --      "-m64",
             }
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant