Remove -mt, nw

This commit is contained in:
therealmogminer@gmail.com 2016-03-15 05:33:23 +01:00
parent b212e5dc2e
commit e1883e3090
6 changed files with 13 additions and 157 deletions

View File

@ -44,7 +44,6 @@ ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = {
{ 0, __("GLSL"), OSDOPTION_GL_GLSL },
{ 0, __("Bilinear Filtering"), OSDOPTION_FILTER },
{ 0, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
{ 0, __("Multi-Threaded Rendering"), OSDOPTION_MULTITHREADING },
{ 0, __("Window Mode"), OSDOPTION_WINDOW },
{ 0, __("Enforce Aspect Ratio"), OSDOPTION_KEEPASPECT },
{ 0, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },

View File

@ -42,7 +42,6 @@ const options_entry osd_options::s_option_entries[] =
{ OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" },
{ nullptr, nullptr, OPTION_HEADER, "OSD PERFORMANCE OPTIONS" },
{ OSDOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" },
{ OSDOPTION_NUMPROCESSORS ";np", OSDOPTVAL_AUTO, OPTION_STRING, "number of processors; this overrides the number the system reports" },
{ OSDOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" },

View File

@ -37,7 +37,6 @@
#define OSDOPTION_DEBUGGER_FONT_SIZE "debugger_font_size"
#define OSDOPTION_WATCHDOG "watchdog"
#define OSDOPTION_MULTITHREADING "multithreading"
#define OSDOPTION_NUMPROCESSORS "numprocessors"
#define OSDOPTION_BENCH "bench"
@ -102,7 +101,6 @@ public:
int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
// performance options
bool multithreading() const { return bool_value(OSDOPTION_MULTITHREADING); }
const char *numprocessors() const { return value(OSDOPTION_NUMPROCESSORS); }
int bench() const { return int_value(OSDOPTION_BENCH); }

View File

@ -90,7 +90,6 @@ sdl_window_info *sdl_window_list;
static sdl_window_info **last_window_ptr;
// event handling
static int multithreading_enabled;
static osd_work_queue *work_queue;
static SDL_threadID main_threadid;
@ -145,12 +144,7 @@ static inline void execute_async(osd_work_callback callback, const worker_param
{
worker_param *wp_temp = (worker_param *) osd_malloc(sizeof(worker_param));
*wp_temp = wp;
if (multithreading_enabled)
{
osd_work_item_queue(work_queue, callback, (void *) wp_temp, WORK_ITEM_FLAG_AUTO_RELEASE);
} else
callback((void *) wp_temp, 0);
callback((void *) wp_temp, 0);
}
static inline void execute_sync(osd_work_callback callback, const worker_param &wp)
@ -202,28 +196,13 @@ static OSDWORK_CALLBACK(sdlwindow_thread_id)
bool sdl_osd_interface::window_init()
{
osd_printf_verbose("Enter sdlwindow_init\n");
// determine if we are using multithreading or not
multithreading_enabled = false;//options().multithreading();
// get the main thread ID before anything else
main_threadid = SDL_ThreadID();
// if multithreading, create a thread to run the windows
if (multithreading_enabled)
{
// create a thread to run the windows from
work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_IO);
if (work_queue == nullptr)
return false;
osd_work_item_queue(work_queue, &sdlwindow_thread_id, nullptr, WORK_ITEM_FLAG_AUTO_RELEASE);
sdlwindow_sync();
}
else
{
// otherwise, treat the window thread as the main thread
//window_threadid = main_threadid;
sdlwindow_thread_id(nullptr, 0);
}
// otherwise, treat the window thread as the main thread
//window_threadid = main_threadid;
sdlwindow_thread_id(nullptr, 0);
// initialize the drawers
if (video_config.mode == VIDEO_MODE_BGFX)
@ -304,15 +283,7 @@ bool sdl_osd_interface::window_init()
static void sdlwindow_sync(void)
{
if (multithreading_enabled)
{
// Fallback
while (!osd_work_queue_wait(work_queue, osd_ticks_per_second()*10))
{
osd_printf_warning("sdlwindow_sync: Sleeping...\n");
osd_sleep(osd_ticks_per_second() / 1000 * 100);
}
}
// haha, do nothing, losers
}
@ -370,19 +341,8 @@ void sdl_osd_interface::window_exit()
break;
}
// if we're multithreaded, clean up the window thread
if (multithreading_enabled)
{
sdlwindow_sync();
}
execute_async_wait(&sdlwindow_exit_wt, wp_dummy);
if (multithreading_enabled)
{
osd_work_queue_wait(work_queue, 1000000);
osd_work_queue_free(work_queue);
}
osd_printf_verbose("Leave sdlwindow_exit\n");
}
@ -731,18 +691,7 @@ int sdl_window_info::window_init()
wp->set_window(this);
// FIXME: pass error back in a different way
if (multithreading_enabled)
{
osd_work_item *wi;
wi = osd_work_item_queue(work_queue, &sdl_window_info::complete_create_wt, (void *) wp, 0);
sdlwindow_sync();
result = *((int *) (osd_work_item_result)(wi));
osd_work_item_release(wi);
}
else
result = *((int *) sdl_window_info::complete_create_wt((void *) wp, 0));
result = *((int *) sdl_window_info::complete_create_wt((void *) wp, 0));
// handle error conditions
if (result == 1)
@ -796,10 +745,6 @@ void sdl_window_info::destroy()
sdl_window_info **prevptr;
ASSERT_MAIN_THREAD();
if (multithreading_enabled)
{
sdlwindow_sync();
}
//osd_event_wait(window->rendered_event, osd_ticks_per_second()*10);

View File

@ -101,8 +101,6 @@ static int in_background;
static int ui_temp_pause;
static int ui_temp_was_paused;
static int multithreading_enabled;
static HANDLE window_thread;
static DWORD window_threadid;
@ -158,7 +156,6 @@ static void mtlog_dump(void)
}
#else
void mtlog_add(const char *event) { }
static void mtlog_dump(void) { }
#endif
@ -170,11 +167,6 @@ static void mtlog_dump(void) { }
bool windows_osd_interface::window_init()
{
size_t temp;
// determine if we are using multithreading or not
multithreading_enabled = false;//downcast<windows_options &>(machine().options()).multithreading();
// get the main thread ID before anything else
main_threadid = GetCurrentThreadId();
@ -186,30 +178,8 @@ bool windows_osd_interface::window_init()
if (!ui_pause_event)
fatalerror("Failed to create pause event\n");
// if multithreading, create a thread to run the windows
if (multithreading_enabled)
{
// create an event to signal when the window thread is ready
window_thread_ready_event = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (!window_thread_ready_event)
fatalerror("Failed to create window thread ready event\n");
// create a thread to run the windows from
temp = _beginthreadex(nullptr, 0, win_window_info::thread_entry, this, 0, (unsigned *)&window_threadid);
window_thread = (HANDLE)temp;
if (window_thread == nullptr)
fatalerror("Failed to create window thread\n");
// set the thread priority equal to the main MAME thread
SetThreadPriority(window_thread, GetThreadPriority(GetCurrentThread()));
}
// otherwise, treat the window thread as the main thread
else
{
window_thread = GetCurrentThread();
window_threadid = main_threadid;
}
window_thread = GetCurrentThread();
window_threadid = main_threadid;
const int fallbacks[VIDEO_MODE_COUNT] = {
-1, // NONE -> no fallback
@ -367,15 +337,6 @@ void windows_osd_interface::window_exit()
break;
}
// if we're multithreaded, clean up the window thread
if (multithreading_enabled)
{
PostThreadMessage(window_threadid, WM_USER_SELF_TERMINATE, 0, 0);
WaitForSingleObject(window_thread, INFINITE);
mtlog_dump();
}
// kill the UI pause event
if (ui_pause_event)
CloseHandle(ui_pause_event);
@ -839,23 +800,7 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in
// set the initial maximized state
window->m_startmaximized = options.maximize();
// finish the window creation on the window thread
if (multithreading_enabled)
{
// wait until the window thread is ready to respond to events
WaitForSingleObject(window_thread_ready_event, INFINITE);
PostThreadMessage(window_threadid, WM_USER_FINISH_CREATE_WINDOW, 0, (LPARAM)window);
while (window->m_init_state == 0)
{
winwindow_process_events(machine, 0, 1); //pump the message queue
Sleep(1);
}
}
else
{
window->m_init_state = window->complete_create() ? -1 : 1;
}
window->m_init_state = window->complete_create() ? -1 : 1;
// handle error conditions
if (window->m_init_state == -1)
@ -956,10 +901,7 @@ void win_window_info::update()
// post a redraw request with the primitive list as a parameter
last_update_time = timeGetTime();
mtlog_add("winwindow_video_window_update: PostMessage start");
if (multithreading_enabled)
PostMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
else
SendMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
SendMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
mtlog_add("winwindow_video_window_update: PostMessage end");
}
}
@ -1115,21 +1057,7 @@ void winwindow_ui_pause_from_main_thread(running_machine &machine, int pause)
void winwindow_ui_pause_from_window_thread(running_machine &machine, int pause)
{
assert(GetCurrentThreadId() == window_threadid);
// if we're multithreaded, we have to request a pause on the main thread
if (multithreading_enabled)
{
// request a pause from the main thread
PostThreadMessage(main_threadid, WM_USER_UI_TEMP_PAUSE, pause, 0);
// if we're pausing, block until it happens
if (pause)
WaitForSingleObject(ui_pause_event, INFINITE);
}
// otherwise, we just do it directly
else
winwindow_ui_pause_from_main_thread(machine, pause);
winwindow_ui_pause_from_main_thread(machine, pause);
}
@ -1143,16 +1071,7 @@ void winwindow_ui_exec_on_main_thread(void (*func)(void *), void *param)
{
assert(GetCurrentThreadId() == window_threadid);
// if we're multithreaded, we have to request a pause on the main thread
if (multithreading_enabled)
{
// request a pause from the main thread
PostThreadMessage(main_threadid, WM_USER_EXEC_FUNC, (WPARAM) func, (LPARAM) param);
}
// otherwise, we just do it directly
else
(*func)(param);
(*func)(param);
}
@ -1551,10 +1470,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
// close: cause MAME to exit
case WM_CLOSE:
if (multithreading_enabled)
PostThreadMessage(main_threadid, WM_QUIT, 0, 0);
else
window->machine().schedule_exit();
window->machine().schedule_exit();
break;
// destroy: clean up all attached rendering bits and nullptr out our hwnd

View File

@ -562,7 +562,6 @@ void windows_osd_interface::init(running_machine &machine)
if (profile > 0)
{
options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM, error_string);
assert(error_string.empty());
}