mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Moved sync related osd stuff to osd/modules/sync. (nw)
This commit is contained in:
parent
5c14bcd0d1
commit
58abceed03
@ -7,8 +7,8 @@
|
|||||||
//
|
//
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#ifndef __WINSYNC__
|
#ifndef __OSDSYNC__
|
||||||
#define __WINSYNC__
|
#define __OSDSYNC__
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
SYNCHRONIZATION INTERFACES - Events
|
SYNCHRONIZATION INTERFACES - Events
|
||||||
@ -197,4 +197,4 @@ void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot);
|
|||||||
|
|
||||||
void osd_scalable_lock_free(osd_scalable_lock *lock);
|
void osd_scalable_lock_free(osd_scalable_lock *lock);
|
||||||
|
|
||||||
#endif /* __WINSYNC__ */
|
#endif /* __OSDSYNC__ */
|
@ -7,9 +7,7 @@
|
|||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "sdlsync.h"
|
#include "osdsync.h"
|
||||||
|
|
||||||
#define USE_SCALABLE_LOCKS (0)
|
|
||||||
|
|
||||||
struct _osd_event
|
struct _osd_event
|
||||||
{
|
{
|
@ -32,7 +32,7 @@
|
|||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "osinline.h"
|
#include "osinline.h"
|
||||||
#include "sdlsync.h"
|
#include "osdsync.h"
|
||||||
|
|
||||||
#include "eminline.h"
|
#include "eminline.h"
|
||||||
|
|
@ -22,7 +22,7 @@
|
|||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "osinline.h"
|
#include "osinline.h"
|
||||||
#include "sdlsync.h"
|
#include "osdsync.h"
|
||||||
|
|
||||||
#include "eminline.h"
|
#include "eminline.h"
|
||||||
|
|
@ -17,7 +17,7 @@
|
|||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "osinline.h"
|
#include "osinline.h"
|
||||||
#include "sdlsync.h"
|
#include "osdsync.h"
|
||||||
|
|
||||||
#include "eminline.h"
|
#include "eminline.h"
|
||||||
|
|
@ -28,7 +28,7 @@
|
|||||||
#include "osdcomm.h"
|
#include "osdcomm.h"
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
|
||||||
#include "sdlsync.h"
|
#include "osdsync.h"
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
@ -15,7 +15,7 @@
|
|||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "osinline.h"
|
#include "osinline.h"
|
||||||
#include "winsync.h"
|
#include "osdsync.h"
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
@ -19,7 +19,11 @@ struct osd_work_item
|
|||||||
void *result;
|
void *result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
int osd_num_processors = 0;
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_work_queue_alloc
|
// osd_work_queue_alloc
|
||||||
|
@ -322,7 +322,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(TARGETOS),win32)
|
ifeq ($(TARGETOS),win32)
|
||||||
BASE_TARGETOS = win32
|
BASE_TARGETOS = win32
|
||||||
SYNC_IMPLEMENTATION = win32
|
SYNC_IMPLEMENTATION = windows
|
||||||
NO_X11 = 1
|
NO_X11 = 1
|
||||||
NO_USE_XINPUT = 1
|
NO_USE_XINPUT = 1
|
||||||
DEFS += -DSDLMAME_WIN32 -DX64_WINDOWS_ABI
|
DEFS += -DSDLMAME_WIN32 -DX64_WINDOWS_ABI
|
||||||
@ -391,7 +391,7 @@ endif
|
|||||||
SDLSRC = $(SRC)/osd/$(OSD)
|
SDLSRC = $(SRC)/osd/$(OSD)
|
||||||
SDLOBJ = $(OBJ)/osd/$(OSD)
|
SDLOBJ = $(OBJ)/osd/$(OSD)
|
||||||
|
|
||||||
OBJDIRS += $(SDLOBJ)
|
OBJDIRS += $(SDLOBJ) $(OSDOBJ)/modules/sync
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
# OSD core library
|
# OSD core library
|
||||||
@ -405,7 +405,7 @@ OSDCOREOBJS = \
|
|||||||
$(SDLOBJ)/sdlsocket.o \
|
$(SDLOBJ)/sdlsocket.o \
|
||||||
$(SDLOBJ)/sdlmisc_$(BASE_TARGETOS).o \
|
$(SDLOBJ)/sdlmisc_$(BASE_TARGETOS).o \
|
||||||
$(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
|
$(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
|
||||||
$(SDLOBJ)/sdlsync_$(SYNC_IMPLEMENTATION).o \
|
$(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o \
|
||||||
$(SDLOBJ)/sdlwork.o
|
$(SDLOBJ)/sdlwork.o
|
||||||
|
|
||||||
# any "main" must be in LIBOSD or else the build will fail!
|
# any "main" must be in LIBOSD or else the build will fail!
|
||||||
|
@ -1,204 +0,0 @@
|
|||||||
//============================================================
|
|
||||||
//
|
|
||||||
// sdlsync.h - SDL core synchronization functions
|
|
||||||
//
|
|
||||||
// Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
|
|
||||||
// Visit http://mamedev.org for licensing and usage restrictions.
|
|
||||||
//
|
|
||||||
// SDLMAME by Olivier Galibert and R. Belmont
|
|
||||||
//
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
#ifndef __SDLSYNC__
|
|
||||||
#define __SDLSYNC__
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
SYNCHRONIZATION INTERFACES - Events
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/* osd_event is an opaque type which represents a setable/resetable event */
|
|
||||||
|
|
||||||
struct osd_event;
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_lock_event_alloc: allocate a new event
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
manualreset - boolean. If true, the event will be automatically set
|
|
||||||
to non-signalled after a thread successfully waited for
|
|
||||||
it.
|
|
||||||
initialstate - boolean. If true, the event is signalled initially.
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
A pointer to the allocated event.
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
osd_event *osd_event_alloc(int manualreset, int initialstate);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_event_wait: wait for an event to be signalled
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
event - The event to wait for. If the event is in signalled state, the
|
|
||||||
function returns immediately. If not it will wait for the event
|
|
||||||
to become signalled.
|
|
||||||
timeout - timeout in osd_ticks
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
TRUE: The event was signalled
|
|
||||||
FALSE: A timeout occurred
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
int osd_event_wait(osd_event *event, osd_ticks_t timeout);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_event_reset: reset an event to non-signalled state
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
event - The event to set to non-signalled state
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
None
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
void osd_event_reset(osd_event *event);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_event_set: set an event to signalled state
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
event - The event to set to signalled state
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
Notes:
|
|
||||||
|
|
||||||
All threads waiting for the event will be signalled.
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
void osd_event_set(osd_event *event);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_event_free: free the memory and resources associated with an osd_event
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
event - a pointer to a previously allocated osd_event.
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
None.
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
void osd_event_free(osd_event *event);
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
SYNCHRONIZATION INTERFACES - Threads
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/* osd_thread is an opaque type which represents a thread */
|
|
||||||
struct osd_thread;
|
|
||||||
|
|
||||||
|
|
||||||
/* osd_thread_callback is a callback function that will be called from the thread */
|
|
||||||
typedef void *(*osd_thread_callback)(void *param);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_thread_create: create a new thread
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
callback - The callback function to be called once the thread is up
|
|
||||||
cbparam - The parameter to pass to the callback function.
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
A pointer to the created thread.
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_thread_adjust_priority: adjust priority of a thread
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
thread - A pointer to a previously created thread.
|
|
||||||
adjust - signed integer to add to the thread priority
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
TRUE on success, FALSE on failure
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
int osd_thread_adjust_priority(osd_thread *thread, int adjust);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_thread_cpu_affinity: change cpu affinity of a thread
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
thread - A pointer to a previously created thread
|
|
||||||
or NULL for main thread
|
|
||||||
mask - bitmask to which cpus to bind
|
|
||||||
i.e. 0x01 1st cpu, 0x02, 2nd cpu, 0x04 3rd cpu
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
TRUE on success, FALSE on failure
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
int osd_thread_cpu_affinity(osd_thread *thread, UINT32 mask);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_thread_wait_free: wait for thread to finish and free resources
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
thread - A pointer to a previously created thread.
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
None.
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
void osd_thread_wait_free(osd_thread *thread);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
|
||||||
osd_process_kill: kill the current process
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
Return value:
|
|
||||||
|
|
||||||
None.
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
void osd_process_kill(void);
|
|
||||||
|
|
||||||
//============================================================
|
|
||||||
// Scalable Locks
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
struct osd_scalable_lock;
|
|
||||||
|
|
||||||
osd_scalable_lock *osd_scalable_lock_alloc(void);
|
|
||||||
|
|
||||||
INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock);
|
|
||||||
|
|
||||||
void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot);
|
|
||||||
|
|
||||||
void osd_scalable_lock_free(osd_scalable_lock *lock);
|
|
||||||
|
|
||||||
#endif /* __SDLSYNC__ */
|
|
@ -1,12 +0,0 @@
|
|||||||
//============================================================
|
|
||||||
//
|
|
||||||
// sdlsync.c - SDL core synchronization functions
|
|
||||||
//
|
|
||||||
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
|
|
||||||
// Visit http://mamedev.org for licensing and usage restrictions.
|
|
||||||
//
|
|
||||||
// SDLMAME by Olivier Galibert and R. Belmont
|
|
||||||
//
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
#include "../windows/winsync.c"
|
|
@ -11,13 +11,6 @@
|
|||||||
|
|
||||||
#if defined(SDLMAME_NOASM)
|
#if defined(SDLMAME_NOASM)
|
||||||
|
|
||||||
/* must be exported
|
|
||||||
* FIXME: NOASM should be taken care of in sdlsync.c
|
|
||||||
* This is not really a sound solution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int osd_num_processors = 0;
|
|
||||||
|
|
||||||
#include "../osdmini/miniwork.c"
|
#include "../osdmini/miniwork.c"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -25,7 +18,7 @@ int osd_num_processors = 0;
|
|||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "osinline.h"
|
#include "osinline.h"
|
||||||
|
|
||||||
#include "sdlsync.h"
|
#include "modules/sync/osdsync.h"
|
||||||
#include "sdlos.h"
|
#include "sdlos.h"
|
||||||
|
|
||||||
#include "eminline.h"
|
#include "eminline.h"
|
||||||
@ -65,8 +58,6 @@ int osd_num_processors = 0;
|
|||||||
#define end_timing(v) do { } while (0)
|
#define end_timing(v) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//============================================================
|
//============================================================
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//
|
//
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#include "sdlsync.h"
|
#include "modules/sync/osdsync.h"
|
||||||
|
|
||||||
class watchdog
|
class watchdog
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "sdlinc.h"
|
#include "sdlinc.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "sdlsync.h"
|
#include "modules/sync/osdsync.h"
|
||||||
|
|
||||||
#include "osd_opengl.h"
|
#include "osd_opengl.h"
|
||||||
#include "osdsdl.h"
|
#include "osdsdl.h"
|
||||||
|
@ -19,6 +19,26 @@
|
|||||||
#include "eivc.h"
|
#include "eivc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__ && defined(__i386__) && !defined(__x86_64)
|
||||||
|
#undef YieldProcessor
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YieldProcessor
|
||||||
|
#ifdef __GNUC__
|
||||||
|
INLINE void osd_yield_processor(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__ ( "rep; nop" );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
INLINE void osd_yield_processor(void)
|
||||||
|
{
|
||||||
|
__asm { rep nop }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define osd_yield_processor YieldProcessor
|
||||||
|
#endif
|
||||||
|
|
||||||
INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange);
|
INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange);
|
||||||
INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange);
|
INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange);
|
||||||
INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta);
|
INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta);
|
||||||
|
@ -84,7 +84,7 @@ WINOBJ = $(OBJ)/osd/$(OSD)
|
|||||||
OSDSRC = $(SRC)/osd
|
OSDSRC = $(SRC)/osd
|
||||||
OSDOBJ = $(OBJ)/osd
|
OSDOBJ = $(OBJ)/osd
|
||||||
|
|
||||||
OBJDIRS += $(WINOBJ)
|
OBJDIRS += $(WINOBJ) $(OSDOBJ)/modules/sync
|
||||||
|
|
||||||
ifdef USE_QTDEBUG
|
ifdef USE_QTDEBUG
|
||||||
OBJDIRS += $(OSDOBJ)/modules/debugger/qt
|
OBJDIRS += $(OSDOBJ)/modules/debugger/qt
|
||||||
@ -339,7 +339,7 @@ OSDCOREOBJS = \
|
|||||||
$(WINOBJ)/windir.o \
|
$(WINOBJ)/windir.o \
|
||||||
$(WINOBJ)/winfile.o \
|
$(WINOBJ)/winfile.o \
|
||||||
$(WINOBJ)/winmisc.o \
|
$(WINOBJ)/winmisc.o \
|
||||||
$(WINOBJ)/winsync.o \
|
$(OSDOBJ)/modules/sync/sync_windows.o \
|
||||||
$(WINOBJ)/wintime.o \
|
$(WINOBJ)/wintime.o \
|
||||||
$(WINOBJ)/winutf8.o \
|
$(WINOBJ)/winutf8.o \
|
||||||
$(WINOBJ)/winutil.o \
|
$(WINOBJ)/winutil.o \
|
||||||
|
@ -219,8 +219,6 @@ private:
|
|||||||
// this line prevents globbing on the command line
|
// this line prevents globbing on the command line
|
||||||
int _CRT_glob = 0;
|
int _CRT_glob = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// LOCAL VARIABLES
|
// LOCAL VARIABLES
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
|
||||||
#include "winsync.h"
|
#include "modules/sync/osdsync.h"
|
||||||
#include "winos.h"
|
#include "winos.h"
|
||||||
|
|
||||||
#include "eminline.h"
|
#include "eminline.h"
|
||||||
|
|
||||||
|
#include "osinline.h"
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// DEBUGGING
|
// DEBUGGING
|
||||||
@ -57,28 +59,6 @@
|
|||||||
#define end_timing(v) do { } while (0)
|
#define end_timing(v) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __GNUC__ && defined(__i386__) && !defined(__x86_64)
|
|
||||||
#undef YieldProcessor
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YieldProcessor
|
|
||||||
#ifdef __GNUC__
|
|
||||||
INLINE void osd_yield_processor(void)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__ ( "rep; nop" );
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
INLINE void osd_yield_processor(void)
|
|
||||||
{
|
|
||||||
__asm { rep nop }
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define osd_yield_processor YieldProcessor
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//============================================================
|
//============================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user