mirror of
https://github.com/holub/mame
synced 2025-06-01 02:21:48 +03:00
SDL: support unofficial (not in the OSD class) num_processors API used by chdman. Allows chdman to use multiple cores/processors on non-Windows. [R. Belmont]
This commit is contained in:
parent
569dc10219
commit
a0b7883fa3
@ -269,6 +269,6 @@ void sdlaudio_init(running_machine &machine);
|
|||||||
// sdlwork.c
|
// sdlwork.c
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
extern int sdl_num_processors;
|
extern int osd_num_processors;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -609,15 +609,15 @@ void sdl_osd_interface::init(running_machine &machine)
|
|||||||
/* get number of processors */
|
/* get number of processors */
|
||||||
stemp = options.numprocessors();
|
stemp = options.numprocessors();
|
||||||
|
|
||||||
sdl_num_processors = 0;
|
osd_num_processors = 0;
|
||||||
|
|
||||||
if (strcmp(stemp, "auto") != 0)
|
if (strcmp(stemp, "auto") != 0)
|
||||||
{
|
{
|
||||||
sdl_num_processors = atoi(stemp);
|
osd_num_processors = atoi(stemp);
|
||||||
if (sdl_num_processors < 1)
|
if (osd_num_processors < 1)
|
||||||
{
|
{
|
||||||
mame_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n");
|
mame_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n");
|
||||||
sdl_num_processors = 0;
|
osd_num_processors = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
Number of processors
|
Number of processors
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
int osd_num_processors(void);
|
int osd_get_num_processors(void);
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
|
@ -142,7 +142,7 @@ void osd_sleep(osd_ticks_t duration)
|
|||||||
// osd_num_processors
|
// osd_num_processors
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int osd_num_processors(void)
|
int osd_get_num_processors(void)
|
||||||
{
|
{
|
||||||
int processors = 1;
|
int processors = 1;
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ void osd_sleep(osd_ticks_t duration)
|
|||||||
// osd_num_processors
|
// osd_num_processors
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int osd_num_processors(void)
|
int osd_get_num_processors(void)
|
||||||
{
|
{
|
||||||
ULONG numprocs = 1;
|
ULONG numprocs = 1;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void osd_sleep(osd_ticks_t duration)
|
|||||||
// osd_num_processors
|
// osd_num_processors
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int osd_num_processors(void)
|
int osd_get_num_processors(void)
|
||||||
{
|
{
|
||||||
int processors = 1;
|
int processors = 1;
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ void osd_sleep(osd_ticks_t duration)
|
|||||||
// osd_num_processors
|
// osd_num_processors
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int osd_num_processors(void)
|
int osd_get_num_processors(void)
|
||||||
{
|
{
|
||||||
SYSTEM_INFO info;
|
SYSTEM_INFO info;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* This is not really a sound solution.
|
* This is not really a sound solution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int sdl_num_processors = 0;
|
int osd_num_processors = 0;
|
||||||
|
|
||||||
#include "../osdmini/miniwork.c"
|
#include "../osdmini/miniwork.c"
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ typedef void *PVOID;
|
|||||||
// GLOBAL VARIABLES
|
// GLOBAL VARIABLES
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
int sdl_num_processors = 0;
|
int osd_num_processors = 0;
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// FUNCTION PROTOTYPES
|
// FUNCTION PROTOTYPES
|
||||||
@ -567,10 +567,11 @@ static int effective_num_processors(void)
|
|||||||
{
|
{
|
||||||
char *procsoverride;
|
char *procsoverride;
|
||||||
int numprocs = 0;
|
int numprocs = 0;
|
||||||
int physprocs = osd_num_processors();
|
int physprocs = osd_get_num_processors();
|
||||||
|
|
||||||
if (sdl_num_processors > 0)
|
// osd_num_processors == 0 for 'auto'
|
||||||
return MIN(4 * physprocs, sdl_num_processors);
|
if (osd_num_processors > 0)
|
||||||
|
return MIN(4 * physprocs, osd_num_processors);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if the OSDPROCESSORS environment variable is set, use that value if valid
|
// if the OSDPROCESSORS environment variable is set, use that value if valid
|
||||||
@ -601,7 +602,7 @@ static UINT32 effective_cpu_mask(int index)
|
|||||||
if (index<2)
|
if (index<2)
|
||||||
mask = 0x01; /* main thread and io threads on cpu #0 */
|
mask = 0x01; /* main thread and io threads on cpu #0 */
|
||||||
else
|
else
|
||||||
mask = (1 << (((index - 1) % (osd_num_processors() - 1)) + 1));
|
mask = (1 << (((index - 1) % (osd_get_num_processors() - 1)) + 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -52,12 +52,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define NUM_PROCESSORS_SUPPORTED 1
|
#define NUM_PROCESSORS_SUPPORTED 1
|
||||||
#else
|
|
||||||
#define NUM_PROCESSORS_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// CONSTANTS & DEFINES
|
// CONSTANTS & DEFINES
|
||||||
|
Loading…
Reference in New Issue
Block a user