{
if (strcmp(var.value, "enabled") == 0)
pl_rearmed_cbs.thread_rendering = 1;
- else
+ else if (strcmp(var.value, "disabled") == 0)
pl_rearmed_cbs.thread_rendering = 0;
+ else
+ pl_rearmed_cbs.thread_rendering = -1; // auto
}
#endif
"pcsx_rearmed_gpu_thread_rendering",
"Threaded Rendering",
NULL,
- "When enabled, runs GPU commands in a secondary thread.",
+ "When enabled, runs GPU commands in a secondary thread. 'Auto' enables it if at least 2 CPU cores are detected.",
NULL,
"video",
{
+ { "auto", "Auto" },
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
- "disabled",
+ "auto",
},
#endif
{
return 0;
}
+static const char *men_autooo[] = { "Auto", "Off", "On", NULL };
+
static const char *men_gpu_dithering[] = { "OFF", "ON", "Force", NULL };
static const char *men_bios_boot[] = { "OFF", "ON", "ON w/o PCSX", NULL };
return 0;
}
-static int slowboot_sel;
-
static menu_entry e_menu_plugin_options[] =
{
mee_enum_h ("BIOS", 0, bios_sel, bioses, h_bios),
- mee_enum ("BIOS logo (slow boot)", 0, slowboot_sel, men_bios_boot),
+ mee_enum ("BIOS logo (slow boot)", 0, menu_iopts[0], men_bios_boot),
mee_enum_h ("GPU plugin", 0, gpu_plugsel, gpu_plugins, h_plugin_gpu),
#ifdef USE_ASYNC_GPU
- mee_onoff ("GPU multithreading", 0, pl_rearmed_cbs.thread_rendering, 1),
+ mee_enum ("GPU multithreading", 0, menu_iopts[1], men_autooo),
#endif
mee_enum ("GPU dithering", 0, pl_rearmed_cbs.dithering, men_gpu_dithering),
mee_enum_h ("SPU plugin", 0, spu_plugsel, spu_plugins, h_plugin_spu),
static int menu_loop_plugin_options(int id, int keys)
{
static int sel = 0;
- slowboot_sel = Config.SlowBoot;
+ menu_iopts[0] = Config.SlowBoot;
+ menu_iopts[1] = pl_rearmed_cbs.thread_rendering + 1;
#ifndef C64X_DSP
me_enable(e_menu_plugin_options, MA_OPT_SPU_THREAD, spu_config.iThreadAvail);
#endif
me_loop(e_menu_plugin_options, &sel);
- Config.SlowBoot = slowboot_sel;
+ Config.SlowBoot = menu_iopts[0];
+ pl_rearmed_cbs.thread_rendering = menu_iopts[1] - 1;
// sync BIOS/plugins
snprintf(Config.Bios[0], sizeof(Config.Bios[0]), "%s", bioses[bios_sel]);
return 0;
}
-static const char *men_autooo[] = { "Auto", "Off", "On", NULL };
-
static const char h_cfg_cpul[] = "Shows CPU usage in %";
static const char h_cfg_spu[] = "Shows active SPU channels\n"
"(green: normal, red: fmod, blue: noise)";
#include <3ds/services/apt.h>
#include <sys/time.h>
#include "../libpcsxcore/new_dynarec/new_dynarec.h"
+static bool is_new_3ds;
#endif
-
-#include "../deps/libretro-common/rthreads/rthreads.c"
-#include "features/features_cpu.h"
#include "pcsxr-threads.h"
+int pcsxr_sthread_core_count;
+
// pcsxr "extensions"
extern void SysPrintf(const char *fmt, ...);
-#ifdef _3DS
-static bool is_new_3ds;
-#endif
+#ifndef USE_C11_THREADS
-void pcsxr_sthread_init(void)
+#include "../deps/libretro-common/rthreads/rthreads.c"
+#include "features/features_cpu.h"
+
+#define CORE_COUNT() cpu_features_get_core_amount()
+
+static void pcsxr_sthread_lib_init(void)
{
- SysPrintf("%d cpu core(s) detected\n", cpu_features_get_core_amount());
#ifdef _3DS
int64_t version = 0;
int fpscr = -1;
#endif
return h;
}
+
+#else // USE_C11_THREADS
+
+#include <unistd.h>
+#define CORE_COUNT() sysconf(_SC_NPROCESSORS_ONLN)
+#define pcsxr_sthread_lib_init()
+
+#endif
+
+void pcsxr_sthread_init(void)
+{
+ pcsxr_sthread_core_count = CORE_COUNT();
+ if (pcsxr_sthread_core_count < 1)
+ pcsxr_sthread_core_count = 1;
+ SysPrintf("%d cpu core(s) detected\n", pcsxr_sthread_core_count);
+
+ pcsxr_sthread_lib_init();
+}
PCSXRT_COUNT // must be last
};
+extern int pcsxr_sthread_core_count;
+
+void pcsxr_sthread_init(void);
+
#ifndef USE_C11_THREADS
/* use libretro-common rthreads */
#define STRHEAD_RET_TYPE void
#define STRHEAD_RETURN()
-void pcsxr_sthread_init(void);
sthread_t *pcsxr_sthread_create(void (*thread_func)(void*),
enum pcsxr_thread_type type);
#define STRHEAD_RET_TYPE int
#define STRHEAD_RETURN() return 0
-#define pcsxr_sthread_init()
-
#define slock_new() ({ \
mtx_t *lock = malloc(sizeof(*lock)); \
if (lock) mtx_init(lock, mtx_plain); \
unsigned int *gpu_hcnt;
unsigned int flip_cnt; // increment manually if not using pl_vout_flip
unsigned int only_16bpp; // platform is 16bpp-only
- unsigned int thread_rendering;
unsigned int dithering; // 0 off, 1 on, 2 force
unsigned int scale_hires;
+ int thread_rendering; // -1 auto, 0 off, 1 on
struct {
int allow_interlace; // 0 off, 1 on, 2 guess
int enhancement_enable;
renderer_set_config(cbs);
vout_set_config(cbs);
- if (cbs->thread_rendering)
- gpu_async_start(&gpu);
- else
- gpu_async_stop(&gpu);
+ gpu_async_enable(&gpu, cbs->thread_rendering);
}
// for standalone plugins only
}
}
-void gpu_async_start(struct psx_gpu *gpu)
+void gpu_async_enable(struct psx_gpu *gpu, int enable)
{
struct psx_gpu_async *agpu;
- if (gpu->async)
+ if (enable < 0)
+ enable = pcsxr_sthread_core_count > 1;
+ if (!gpu->async == !enable)
return;
+ if (!enable) {
+ gpu_async_stop(gpu);
+ return;
+ }
assert(AGPU_DMA_MAX <= AGPU_BUF_LEN / 2);
int gpu_async_do_cmd_list(struct psx_gpu *gpu, const uint32_t *list, int list_len,
int *cycles_sum_out, int *cycles_last, int *last_cmd, int *vram_dirty);
int gpu_async_try_dma(struct psx_gpu *gpu, const uint32_t *data, int words);
-void gpu_async_start(struct psx_gpu *gpu);
+void gpu_async_enable(struct psx_gpu *gpu, int enable);
void gpu_async_stop(struct psx_gpu *gpu);
void gpu_async_sync(struct psx_gpu *gpu);
int gpu_async_sync_scanout(struct psx_gpu *gpu);
#define gpu_async_enabled(gpu) 0
#define gpu_async_do_cmd_list(gpu, list, list_len, c0, c1, cmd, vrd) (list_len)
#define gpu_async_try_dma(gpu, data, words) 0
-#define gpu_async_start(gpu)
+#define gpu_async_enable(gpu, enable)
#define gpu_async_stop(gpu)
#define gpu_async_sync(gpu) do {} while (0)
#define gpu_async_sync_scanout(gpu) 0