MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

lamprey
MAME Fan
Reged: 12/01/11
Posts: 238
Send PM


SDL Multithreading or build issue? new
#335303 - 12/20/14 02:11 AM


Hi,


I've built SDLmame 0156 version and if I enable multithreading in the INI file it won't load. It just seems to hang up otherwise it seems to work ok. Is this a know issue with SDL builds on Windows?

Since, I think, SDL 2.0 is the default, I wasn't sure if I need to change something when doing a build. Can someone confirm that this command and options are/should be correct for an SDL build?

Code:

make -j5 TARGETOS=win32 TARGET=mame OSD=sdl PTR64=1 NOWERROR=1


Additionally, I also have the following 3 DLLs in the folder with the exe: QtCore4, QtGui4, SDL2. These 3 dlls and (SDL.dll) work with 0155. I don't think I need to replace those, but if I do, please point me in the right direction.

Also, should I be posting SDL related questions on the Bannister forums?

Here is the Verbose output:
Code:

Available videodrivers: windows dummy
Current Videodriver: windows
Display #0
Renderdrivers:
direct3d (0x0)
opengl (0x0)
opengles2 (0x0)
software (0x0)
Available audio drivers:
xaudio2
directsound
winmm
disk
dummy
Build version: 0.156 (Dec 18 2014)
Build architecure: SDLMAME_ARCH=
Build defines 1: SDLMAME_WIN32=1
Build defines 1: LSB_FIRST=1 PTR64=1 DISTRO=generic SYNC_IMPLEMENTATION=win32

SDL/OpenGL defines: SDL_COMPILEDVERSION=2003 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=9 __GNUC_PATCHLEVEL__=1 __VERSION_
_="4.9.1"
Compiler defines B: __amd64__=1 __x86_64__=1
Compiler defines C:
Enter init_monitors
Adding monitor screen0 (1920 x 1200)
Leave init_monitors
Enter sdlwindow_init
Using SDL multi-window OpenGL driver (SDL 2.0+)
Loaded opengl shared library:
Leave sdlwindow_init
OpenGL: NVIDIA Corporation
OpenGL: GeForce GTX 750 Ti/PCIe/SSE2
OpenGL: 4.4.0 NVIDIA 344.11
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
OpenGL: max texture size 16384 x 16384
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 channels
Keyboard: Start initialization
Input: Adding Kbd #0: System keyboard
Keyboard: Registered System keyboard
Keyboard: End initialization
Mouse: Start initialization
Input: Adding Mouse #0: System mouse
Mouse: Registered System mouse
Mouse: End initialization
Joystick: Start initialization
Joystick: End initialization
Unable to load winpcap: 7e
Region ':user1' created



Thanks!



B2K24
MAME @ 15 kHz Sony Trinitron CRT user
Reged: 10/25/10
Posts: 2663
Send PM


Re: SDL Multithreading or build issue? new [Re: lamprey]
#335304 - 12/20/14 02:18 AM


It's recommended that multithreading stay disabled and that's the default now.



lamprey
MAME Fan
Reged: 12/01/11
Posts: 238
Send PM


Re: SDL Multithreading or build issue? new [Re: B2K24]
#335305 - 12/20/14 02:49 AM


> It's recommended that multithreading stay disabled and that's the default now.

A recommendation is one thing, but it is broken. Or is it just me?



RobbbertModerator
Sir
Reged: 08/21/04
Posts: 3193
Loc: A long way from you
Send PM


Re: SDL Multithreading or build issue? new [Re: lamprey]
#335311 - 12/20/14 06:58 AM





B2K24
MAME @ 15 kHz Sony Trinitron CRT user
Reged: 10/25/10
Posts: 2663
Send PM


Re: SDL Multithreading or build issue? new [Re: lamprey]
#335313 - 12/20/14 07:28 AM


I just compiled SDL builds of MAME/MESS for 0.156 using

Code:

make all PTR64=1 TARGETOS=win32 SDL_LIBVER=sdl2 OSD=sdl




Code:

make TARGET=mess PTR64=1 TARGETOS=win32 SDL_LIBVER=sdl2 OSD=sdl



I get the same result of games hanging when multithreading is set to 1. With MT disabled the games launch as they should.

The same behavior also occurs in 0.155 but does not happen using 0.154 if it happens to matter to anyone

Your other questions will take more of an expert to answer.



lamprey
MAME Fan
Reged: 12/01/11
Posts: 238
Send PM


Re: SDL Multithreading or build issue? [Re: B2K24]
#335315 - 12/20/14 10:50 AM


>> The same behavior also occurs in 0.155 but does not happen using 0.154 if it happens
> to matter to anyone

Interesting. My 0155 works with multithreading. I'm pretty sure I compiled 0155 using the same command from my first post. I wonder if specifying SDL_LIBVER=sdl2 has anything to do with it, assuming that is the default is 0156?

Thanks for checking/verifying it's not just me.



Anonymous
Unregistered
Send PM


Re: SDL Multithreading or build issue? *DELETED* new [Re: lamprey]
#335317 - 12/20/14 12:50 PM





B2K24
MAME @ 15 kHz Sony Trinitron CRT user
Reged: 10/25/10
Posts: 2663
Send PM


Re: SDL Multithreading or build issue? new [Re: ]
#335322 - 12/20/14 09:13 PM


I had forgotten the 154 build I had wasn't compiled but downloaded from Haze's blog, so it probably wasn't SDL2 anyway.

I'll assume here Multithreading has never worked using a SDL2 Windows build at all.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9714
Loc: ECV-197 The Orville
Send PM


Re: SDL Multithreading or build issue? new [Re: lamprey]
#335356 - 12/22/14 04:44 AM


> >> The same behavior also occurs in 0.155 but does not happen using 0.154 if it
> happens
> > to matter to anyone
>
> Interesting. My 0155 works with multithreading. I'm pretty sure I compiled 0155 using
> the same command from my first post. I wonder if specifying SDL_LIBVER=sdl2 has
> anything to do with it, assuming that is the default is 0156?
>
> Thanks for checking/verifying it's not just me.

SDL2 -video=accel should gain you more performance than -mt anyway. And it's not like -mt affects if e.g. Blitz/Gauntlet/Crusin' use multiple CPUs (they do even when it's off). Basically, -mt is known broken on baseline Windows, suspect broken on SDL Windows, known fatal to the OS on Mac at a may-crash-the-window-system level, and sometimes it works on Linux. I'm not sure why we even offer it as an option anymore.



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: SDL Multithreading or build issue? new [Re: R. Belmont]
#335450 - 12/26/14 02:12 PM


> SDL2 -video=accel should gain you more performance than -mt anyway. And it's not like
> -mt affects if e.g. Blitz/Gauntlet/Crusin' use multiple CPUs (they do even when it's
> off). Basically, -mt is known broken on baseline Windows, suspect broken on SDL
> Windows, known fatal to the OS on Mac at a may-crash-the-window-system level, and
> sometimes it works on Linux. I'm not sure why we even offer it as an option anymore.

I haven't had an issues with mt on Linux so far. The option still provides a slight performance advantage (7%) on my system:

./mame64 -mt -np 4 -str 60 -nothrottle radikalb -ad pulse -noautosave -video accel
Average speed: 174.01% (59 seconds)

./mame64 -nomt -np 4 -str 60 -nothrottle radikalb -ad pulse -noautosave -video accel
Average speed: 162.66% (59 seconds)

As the one who is originally responsible for "mt" in sdlmame I have to add that rendering in a background thread was not supported well on every OS in SDL1.2 and with SDL2 the situation seems to be worse. On the other hand I never really tested the SDL2 code on a windows build. In SDL1.2 there were differences between Linux and Windows around the initialization of certain systems either in the main thread or in the rendering thread. Maybe this has changed. But first I need to setup a working compile environment in my virtual machine again.



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: SDL Multithreading or build issue? new [Re: couriersud]
#335455 - 12/26/14 06:47 PM


Followup:

On a Windows 7 VM (virtual box, 3D support enabled) I was not able to create crashes using -mt. I tested

- -video opengl
- -video accel -rd software
- -video accel -rd direct3d
- -video accel -rd opengl
- -video accel -rd opengles2

I fear any issue here may be caused by 3rd party drivers and how they behave in a threaded environment.

But it would be helpful if people would post the commandline used (preferably no mame.ini) which caused a crash.



B2K24
MAME @ 15 kHz Sony Trinitron CRT user
Reged: 10/25/10
Posts: 2663
Send PM


Re: SDL Multithreading or build issue? new [Re: couriersud]
#335456 - 12/26/14 08:01 PM


I renamed my mame.ini to oldmame.ini so it wouldn't be used.

Trying to launch with the 4 different video options always produces a black screen/hang (sdlmame64 is not responding)


Code:

C:\SDLMAME>sdlmame64 -video accel -rd opengles2 -mt 005

C:\SDLMAME>sdlmame64 -video accel -rd direct3d -mt 005

C:\SDLMAME>sdlmame64 -video accel -rd software -mt 005

C:\SDLMAME>sdlmame64 -video accel -rd opengl -mt 005



If I try again only removing the -mt option all 4 different video options work and it doesn't hang.

If there is anything else you want me to try, I'm happy to do so if it will help.



Traso
MAME Fan
Reged: 01/15/13
Posts: 2687
Send PM


Um, maybe he meant post the log? (nt) new [Re: B2K24]
#335468 - 12/27/14 06:50 AM





Scifi frauds. SF illuminates.
_________________

Culture General Contact Unit (Eccentric)



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: SDL Multithreading or build issue? new [Re: B2K24]
#335486 - 12/28/14 12:00 AM



> If I try again only removing the -mt option all 4 different video options work and it
> doesn't hang.
>
> If there is anything else you want me to try, I'm happy to do so if it will help.

Thanks a lot. I have retried using latest git and in virtualbox with virtualbox 3D drivers do not have an issue - as long as I run windowed ("-w"). In fullscreen ("-now") mame hangs as well - even in "-rd software" mode.

I therefore suspect any crashes to be caused by either non-thread stable hardware drivers or fullscreen issues.

Can you please report

a) which gfx you are using - nvidia or radeon ?
b) can you do the tests using "-w" and "-now" switches?

If "-w" works that would be great. Than I could use my virtual setup here to further debug the issue.



B2K24
MAME @ 15 kHz Sony Trinitron CRT user
Reged: 10/25/10
Posts: 2663
Send PM


Re: SDL Multithreading or build issue? new [Re: couriersud]
#335494 - 12/28/14 08:53 AM


Amazing! You have nailed it.

I didn't even think about running in windowed mode.

I can confirm that -mt is not the problem and -now is what is making MAME hang in this instance.

All 4 of the different video modes pass if using -mt and -w

I'm running Windows 7 X64 with Nvidia GTX 760 Driver version 344.65



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: SDL Multithreading or build issue? new [Re: B2K24]
#335496 - 12/28/14 01:24 PM


>
> All 4 of the different video modes pass if using -mt and -w
>
> I'm running Windows 7 X64 with Nvidia GTX 760 Driver version 344.65

Great! Thanks a lot for the additional information.

Now I need some mame quality time which is allocated from the same quality time pool as family quality time but has a lower priority :-)

But it will get fixed. Just give me some time.



Calamity
MAME Fan
Reged: 05/30/11
Posts: 56
Send PM


Re: SDL Multithreading or build issue? new [Re: couriersud]
#335497 - 12/28/14 04:20 PM


This patch seems to fix it here (Windows 7, Intel HD 3000/Nvidia GT 630M). It looks like when in fullscreen the set cursor stuff must be run in the window thread, otherwhise it causes a deadlock. Tested with -video accel -rd direct3d/opengl/opengles2, not tested in Linux though.


Code:


diff -Nru ./src/osd/sdl/window.c ./src2/osd/sdl/window.c
--- ./src/osd/sdl/window.c 2014-11-26 10:37:58.000000000 +0100
+++ ./src2/osd/sdl/window.c 2014-12-28 15:10:55.000000000 +0100
@@ -589,11 +589,15 @@

//============================================================
// sdlwindow_update_cursor_state
-// (main or window thread)
+// (window thread)
//============================================================

-static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window)
+static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
{
+ worker_param *wp = (worker_param *) param;
+ sdl_window_info *window = wp->window;
+ running_machine &machine = window->machine();
+
#if (USE_XINPUT)
// Hack for wii-lightguns:
// they stop working with a grabbed mouse;
@@ -652,8 +656,20 @@
}
#endif
#endif
+ return NULL;
}

+static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window)
+{
+ worker_param wp;
+
+ ASSERT_MAIN_THREAD();
+
+ clear_worker_param(&wp);
+ wp.window = window;
+ wp.m_machine = &machine;
+ execute_async_wait(&sdlwindow_update_cursor_state_wt, &wp);
+}

//============================================================
// sdlwindow_video_window_create



Edited by Calamity (12/28/14 06:31 PM)



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: SDL Multithreading or build issue? new [Re: Calamity]
#335498 - 12/28/14 06:16 PM


The attachment shows as 0kb and the link doesn't work (404).
You can also PM me here.



Calamity
MAME Fan
Reged: 05/30/11
Posts: 56
Send PM


Re: SDL Multithreading or build issue? new [Re: couriersud]
#335499 - 12/28/14 06:32 PM


I edited my post, for some reason my attachments don't work.



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: SDL Multithreading or build issue? new [Re: Calamity]
#335500 - 12/28/14 07:00 PM


Great, thanks.
Works on linux as well :-)



B2K24
MAME @ 15 kHz Sony Trinitron CRT user
Reged: 10/25/10
Posts: 2663
Send PM


Re: SDL Multithreading or build issue? new [Re: couriersud]
#335504 - 12/28/14 09:28 PM


This issue is fixed now if you pull from GIT and compile.


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
1 registered and 176 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4564