mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Refactor perf counters
This commit is contained in:
parent
2525347445
commit
2b840c0384
@ -594,15 +594,19 @@ void audio_driver_set_nonblocking_state(bool enable)
|
||||
**/
|
||||
bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
{
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = driver ?
|
||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||
static struct retro_perf_counter audio_convert_float = {0};
|
||||
static struct retro_perf_counter audio_dsp = {0};
|
||||
static struct retro_perf_counter resampler_proc = {0};
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = driver ?
|
||||
(const audio_driver_t*)driver->audio : NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->recording_data)
|
||||
{
|
||||
@ -619,11 +623,11 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
if (!driver->audio_active || !audio_data.data)
|
||||
return false;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_s16);
|
||||
RARCH_PERFORMANCE_START(audio_convert_s16);
|
||||
rarch_perf_init(&audio_convert_s16, "audio_convert_s16");
|
||||
retro_perf_start(&audio_convert_s16);
|
||||
audio_convert_s16_to_float(audio_data.data, data, samples,
|
||||
audio_data.volume_gain);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_s16);
|
||||
retro_perf_stop(&audio_convert_s16);
|
||||
|
||||
src_data.data_in = audio_data.data;
|
||||
src_data.input_frames = samples >> 1;
|
||||
@ -633,10 +637,10 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
|
||||
if (audio_data.dsp)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_dsp);
|
||||
RARCH_PERFORMANCE_START(audio_dsp);
|
||||
rarch_perf_init(&audio_dsp, "audio_dsp");
|
||||
retro_perf_start(&audio_dsp);
|
||||
rarch_dsp_filter_process(audio_data.dsp, &dsp_data);
|
||||
RARCH_PERFORMANCE_STOP(audio_dsp);
|
||||
retro_perf_stop(&audio_dsp);
|
||||
|
||||
if (dsp_data.output)
|
||||
{
|
||||
@ -654,22 +658,22 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
if (rarch_main_is_slowmotion())
|
||||
src_data.ratio *= settings->slowmotion_ratio;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(resampler_proc);
|
||||
RARCH_PERFORMANCE_START(resampler_proc);
|
||||
rarch_perf_init(&resampler_proc, "resampler_proc");
|
||||
retro_perf_start(&resampler_proc);
|
||||
rarch_resampler_process(driver->resampler,
|
||||
driver->resampler_data, &src_data);
|
||||
RARCH_PERFORMANCE_STOP(resampler_proc);
|
||||
retro_perf_stop(&resampler_proc);
|
||||
|
||||
output_data = audio_data.outsamples;
|
||||
output_frames = src_data.output_frames;
|
||||
|
||||
if (!audio_data.use_float)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_float);
|
||||
RARCH_PERFORMANCE_START(audio_convert_float);
|
||||
rarch_perf_init(&audio_convert_float, "audio_convert_float");
|
||||
retro_perf_start(&audio_convert_float);
|
||||
audio_convert_float_to_s16(audio_data.conv_outsamples,
|
||||
(const float*)output_data, output_frames * 2);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_float);
|
||||
retro_perf_stop(&audio_convert_float);
|
||||
|
||||
output_data = audio_data.conv_outsamples;
|
||||
output_size = sizeof(int16_t);
|
||||
|
@ -146,7 +146,7 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
(void)list;
|
||||
|
||||
@ -170,7 +170,7 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
static resampler_simd_mask_t resampler_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return rarch_get_cpu_features();
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
|
@ -409,7 +409,7 @@ retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
static unsigned audio_convert_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return rarch_get_cpu_features();
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
|
@ -34,7 +34,6 @@ typedef struct
|
||||
uint64_t cpu_ticks_last;
|
||||
|
||||
int rate;
|
||||
|
||||
} ctr_audio_t;
|
||||
|
||||
#define CTR_AUDIO_COUNT (1u << 11u)
|
||||
@ -44,28 +43,26 @@ typedef struct
|
||||
|
||||
static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t));
|
||||
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
// if(!csndInit())
|
||||
// return NULL;
|
||||
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t));
|
||||
|
||||
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
|
||||
|
||||
memset(ctr->l, 0, CTR_AUDIO_SIZE);
|
||||
memset(ctr->r, 0, CTR_AUDIO_SIZE);
|
||||
|
||||
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
|
||||
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
|
||||
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
|
||||
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
|
||||
|
||||
ctr->pos = 0;
|
||||
ctr->rate = rate;
|
||||
ctr->pos = 0;
|
||||
ctr->rate = rate;
|
||||
ctr->cpu_ticks_per_sample = CSND_TIMER(rate) * 4;
|
||||
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l_paddr, CTR_AUDIO_SIZE);
|
||||
@ -76,9 +73,9 @@ static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
csndPlaySound(0x9, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
|
||||
rate, 1.0, 1.0, ctr->r, ctr->r, CTR_AUDIO_SIZE);
|
||||
|
||||
ctr->playpos = 0;
|
||||
ctr->cpu_ticks_last = svcGetSystemTick();
|
||||
ctr->playing = true;
|
||||
ctr->playpos = 0;
|
||||
ctr->cpu_ticks_last = svcGetSystemTick();
|
||||
ctr->playing = true;
|
||||
|
||||
return ctr;
|
||||
}
|
||||
@ -100,20 +97,22 @@ static void ctr_audio_free(void *data)
|
||||
|
||||
static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint32_t samples_played;
|
||||
uint64_t current_tick;
|
||||
static struct retro_perf_counter ctraudio_f = {0};
|
||||
const uint16_t *src = buf;
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)data;
|
||||
|
||||
(void)data;
|
||||
(void)buf;
|
||||
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
rarch_perf_init(&ctraudio_f, "ctraudio_f");
|
||||
retro_perf_start(&ctraudio_f);
|
||||
|
||||
int i;
|
||||
const uint16_t* src = buf;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(ctraudio_f);
|
||||
RARCH_PERFORMANCE_START(ctraudio_f);
|
||||
|
||||
uint64_t current_tick = svcGetSystemTick();
|
||||
uint32_t samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample;
|
||||
|
||||
|
||||
@ -144,11 +143,11 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
||||
ctr->pos++;
|
||||
ctr->pos &= CTR_AUDIO_COUNT_MASK;
|
||||
}
|
||||
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l, CTR_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r, CTR_AUDIO_SIZE);
|
||||
|
||||
|
||||
RARCH_PERFORMANCE_STOP(ctraudio_f);
|
||||
retro_perf_stop(&ctraudio_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
@ -160,8 +159,10 @@ static bool ctr_audio_stop(void *data)
|
||||
/* using SetPlayState would make tracking the playback
|
||||
* position more difficult */
|
||||
|
||||
// CSND_SetPlayState(0x8, 0);
|
||||
// CSND_SetPlayState(0x9, 0);
|
||||
#if 0
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
#endif
|
||||
|
||||
/* setting the channel volume to 0 seems to make it
|
||||
* impossible to set it back to full volume later */
|
||||
@ -186,14 +187,16 @@ static bool ctr_audio_start(void *data)
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
/* prevents restarting audio when the menu
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (system->shutdown)
|
||||
return true;
|
||||
|
||||
// CSND_SetPlayState(0x8, 1);
|
||||
// CSND_SetPlayState(0x9, 1);
|
||||
#if 0
|
||||
CSND_SetPlayState(0x8, 1);
|
||||
CSND_SetPlayState(0x9, 1);
|
||||
#endif
|
||||
|
||||
CSND_SetVol(0x8, 0x00008000, 0);
|
||||
CSND_SetVol(0x9, 0x80000000, 0);
|
||||
|
@ -63,13 +63,14 @@ typedef struct video4linux
|
||||
char dev_name[PATH_MAX_LENGTH];
|
||||
} video4linux_t;
|
||||
|
||||
static void process_image(video4linux_t *v4l,
|
||||
const uint8_t *buffer_yuv)
|
||||
static void process_image(video4linux_t *v4l, const uint8_t *buffer_yuv)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(yuv_convert_direct);
|
||||
RARCH_PERFORMANCE_START(yuv_convert_direct);
|
||||
static struct retro_perf_counter yuv_convert_direct = {0};
|
||||
|
||||
rarch_perf_init(&yuv_convert_direct, "yuv_convert_direct");
|
||||
retro_perf_start(&yuv_convert_direct);
|
||||
scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, buffer_yuv);
|
||||
RARCH_PERFORMANCE_STOP(yuv_convert_direct);
|
||||
retro_perf_stop(&yuv_convert_direct);
|
||||
}
|
||||
|
||||
static int xioctl(int fd, int request, void *args)
|
||||
|
10
dynamic.c
10
dynamic.c
@ -1120,12 +1120,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
struct retro_perf_callback *cb = (struct retro_perf_callback*)data;
|
||||
|
||||
RARCH_LOG("Environ GET_PERF_INTERFACE.\n");
|
||||
cb->get_time_usec = rarch_get_time_usec;
|
||||
cb->get_cpu_features = rarch_get_cpu_features;
|
||||
cb->get_perf_counter = rarch_get_perf_counter;
|
||||
cb->get_time_usec = retro_get_time_usec;
|
||||
cb->get_cpu_features = retro_get_cpu_features;
|
||||
cb->get_perf_counter = retro_get_perf_counter;
|
||||
cb->perf_register = retro_perf_register; /* libretro specific path. */
|
||||
cb->perf_start = rarch_perf_start;
|
||||
cb->perf_stop = rarch_perf_stop;
|
||||
cb->perf_start = retro_perf_start;
|
||||
cb->perf_stop = retro_perf_stop;
|
||||
cb->perf_log = retro_perf_log; /* libretro specific path. */
|
||||
break;
|
||||
}
|
||||
|
@ -1628,12 +1628,13 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
{
|
||||
unsigned width, height;
|
||||
D3DVIEWPORT screen_vp;
|
||||
unsigned i = 0;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const font_renderer_t *font_ctx = driver->font_osd_driver;
|
||||
static struct retro_perf_counter d3d_frame = {0};
|
||||
unsigned i = 0;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const font_renderer_t *font_ctx = driver->font_osd_driver;
|
||||
|
||||
(void)i;
|
||||
|
||||
@ -1642,8 +1643,8 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(d3d_frame);
|
||||
RARCH_PERFORMANCE_START(d3d_frame);
|
||||
rarch_perf_init(&d3d_frame, "d3d_frame");
|
||||
retro_perf_start(&d3d_frame);
|
||||
|
||||
#ifndef _XBOX
|
||||
/* We cannot recover in fullscreen. */
|
||||
@ -1746,7 +1747,7 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
RARCH_PERFORMANCE_STOP(d3d_frame);
|
||||
retro_perf_stop(&d3d_frame);
|
||||
|
||||
gfx_ctx_update_window_title(d3d);
|
||||
|
||||
@ -1768,11 +1769,12 @@ static bool d3d_read_viewport(void *data, uint8_t *buffer)
|
||||
bool ret = true;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
static struct retro_perf_counter d3d_read_viewport = {0};
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(d3d_read_viewport);
|
||||
RARCH_PERFORMANCE_START(d3d_read_viewport);
|
||||
rarch_perf_init(&d3d_read_viewport, "d3d_read_viewport");
|
||||
retro_perf_start(&d3d_read_viewport);
|
||||
|
||||
(void)data;
|
||||
(void)buffer;
|
||||
@ -1827,7 +1829,7 @@ static bool d3d_read_viewport(void *data, uint8_t *buffer)
|
||||
ret = false;
|
||||
|
||||
end:
|
||||
RARCH_PERFORMANCE_STOP(d3d_read_viewport);
|
||||
retro_perf_stop(&d3d_read_viewport);
|
||||
if (target)
|
||||
target->Release();
|
||||
if (dest)
|
||||
|
@ -349,13 +349,14 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
uint64_t frame_count,
|
||||
unsigned pitch, const char* msg)
|
||||
{
|
||||
ctr_video_t* ctr = (ctr_video_t*)data;
|
||||
settings_t* settings = config_get_ptr();
|
||||
|
||||
uint32_t diff;
|
||||
static uint64_t currentTick,lastTick;
|
||||
static float fps = 0.0;
|
||||
ctr_video_t *ctr = (ctr_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
static float fps = 0.0;
|
||||
static int total_frames = 0;
|
||||
static int frames = 0;
|
||||
static int frames = 0;
|
||||
static struct retro_perf_counter ctrframe_f = {0};
|
||||
|
||||
extern bool select_pressed;
|
||||
|
||||
@ -390,7 +391,7 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
svcClearEvent(gspEvents[GSPEVENT_VBlank0]);
|
||||
|
||||
currentTick = svcGetSystemTick();
|
||||
uint32_t diff = currentTick - lastTick;
|
||||
diff = currentTick - lastTick;
|
||||
if(diff > CTR_CPU_TICKS_PER_SECOND)
|
||||
{
|
||||
fps = (float)frames * ((float) CTR_CPU_TICKS_PER_SECOND / (float) diff);
|
||||
@ -401,14 +402,12 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
printf("fps: %8.4f frames: %i\r", fps, total_frames++);
|
||||
fflush(stdout);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(ctrframe_f);
|
||||
RARCH_PERFORMANCE_START(ctrframe_f);
|
||||
rarch_perf_init(&ctrframe_f, "ctrframe_f");
|
||||
retro_perf_start(&ctrframe_f);
|
||||
|
||||
if (ctr->should_resize)
|
||||
ctr_update_viewport(ctr);
|
||||
|
||||
|
||||
|
||||
ctrGuSetMemoryFill(true, (u32*)CTR_GPU_FRAMEBUFFER, 0x00000000,
|
||||
(u32*)(CTR_GPU_FRAMEBUFFER + CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT * sizeof(uint32_t)),
|
||||
0x201, (u32*)CTR_GPU_DEPTHBUFFER, 0x00000000,
|
||||
@ -435,8 +434,9 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
else
|
||||
{
|
||||
int i;
|
||||
uint16_t* dst = (uint16_t*)ctr->texture_linear;
|
||||
const uint8_t* src = frame;
|
||||
uint16_t *dst = (uint16_t*)ctr->texture_linear;
|
||||
const uint8_t *src = frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
memcpy(dst, src, width * sizeof(uint16_t));
|
||||
@ -496,7 +496,7 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 240,400,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE);
|
||||
|
||||
gfxSwapBuffersGpu();
|
||||
RARCH_PERFORMANCE_STOP(ctrframe_f);
|
||||
retro_perf_stop(&ctrframe_f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1389,8 +1389,10 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
|
||||
static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(copy_frame);
|
||||
RARCH_PERFORMANCE_START(copy_frame);
|
||||
static struct retro_perf_counter copy_frame = {0};
|
||||
|
||||
rarch_perf_init(©_frame, "copy_frame");
|
||||
retro_perf_start(©_frame);
|
||||
|
||||
#if defined(HAVE_OPENGLES2)
|
||||
#if defined(HAVE_EGL)
|
||||
@ -1500,7 +1502,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
}
|
||||
#endif
|
||||
RARCH_PERFORMANCE_STOP(copy_frame);
|
||||
retro_perf_stop(©_frame);
|
||||
}
|
||||
|
||||
static INLINE void gl_set_prev_texture(gl_t *gl,
|
||||
@ -1536,6 +1538,8 @@ static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned shader)
|
||||
#if defined(HAVE_GL_ASYNC_READBACK) && defined(HAVE_MENU)
|
||||
static void gl_pbo_async_readback(gl_t *gl)
|
||||
{
|
||||
static struct retro_perf_counter async_readback = {0};
|
||||
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER,
|
||||
gl->pbo_readback[gl->pbo_readback_index++]);
|
||||
gl->pbo_readback_index &= 3;
|
||||
@ -1548,8 +1552,8 @@ static void gl_pbo_async_readback(gl_t *gl)
|
||||
video_pixel_get_alignment(gl->vp.width * sizeof(uint32_t)));
|
||||
|
||||
/* Read asynchronously into PBO buffer. */
|
||||
RARCH_PERFORMANCE_INIT(async_readback);
|
||||
RARCH_PERFORMANCE_START(async_readback);
|
||||
rarch_perf_init(&async_readback, "async_readback");
|
||||
retro_perf_start(&async_readback);
|
||||
glReadBuffer(GL_BACK);
|
||||
#ifdef HAVE_OPENGLES3
|
||||
glReadPixels(gl->vp.x, gl->vp.y,
|
||||
@ -1560,7 +1564,7 @@ static void gl_pbo_async_readback(gl_t *gl)
|
||||
gl->vp.width, gl->vp.height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
#endif
|
||||
RARCH_PERFORMANCE_STOP(async_readback);
|
||||
retro_perf_stop(&async_readback);
|
||||
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
@ -1629,13 +1633,14 @@ static bool gl_frame(void *data, const void *frame,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
static struct retro_perf_counter frame_run = {0};
|
||||
gl_t *gl = (gl_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct font_renderer *font_driver = driver ? driver->font_osd_driver : NULL;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(frame_run);
|
||||
RARCH_PERFORMANCE_START(frame_run);
|
||||
rarch_perf_init(&frame_run, "frame_run");
|
||||
retro_perf_start(&frame_run);
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
@ -1796,7 +1801,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
|
||||
gfx_ctx_update_window_title(gl);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(frame_run);
|
||||
retro_perf_stop(&frame_run);
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
/* Reset state which could easily mess up libretro core. */
|
||||
@ -1846,8 +1851,10 @@ static bool gl_frame(void *data, const void *frame,
|
||||
#ifdef HAVE_GL_SYNC
|
||||
if (settings->video.hard_sync && gl->have_sync)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(gl_fence);
|
||||
RARCH_PERFORMANCE_START(gl_fence);
|
||||
static struct retro_perf_counter gl_fence = {0};
|
||||
|
||||
rarch_perf_init(&gl_fence, "gl_fence");
|
||||
retro_perf_start(&gl_fence);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->fences[gl->fence_count++] =
|
||||
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
@ -1863,7 +1870,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
gl->fence_count * sizeof(GLsync));
|
||||
}
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gl_fence);
|
||||
retro_perf_stop(&gl_fence);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2844,16 +2851,17 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
#else
|
||||
static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
{
|
||||
unsigned num_pixels = 0;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
static struct retro_perf_counter read_viewport = {0};
|
||||
unsigned num_pixels = 0;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return false;
|
||||
|
||||
context_bind_hw_render(gl, false);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(read_viewport);
|
||||
RARCH_PERFORMANCE_START(read_viewport);
|
||||
rarch_perf_init(&read_viewport, "read_viewport");
|
||||
retro_perf_start(&read_viewport);
|
||||
|
||||
#ifdef HAVE_GL_ASYNC_READBACK
|
||||
if (gl->pbo_readback_enable)
|
||||
@ -2927,7 +2935,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
gl->readback_buffer_screenshot = malloc(num_pixels * sizeof(uint32_t));
|
||||
if (!gl->readback_buffer_screenshot)
|
||||
{
|
||||
RARCH_PERFORMANCE_STOP(read_viewport);
|
||||
retro_perf_stop(&read_viewport);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -2947,7 +2955,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
gl->readback_buffer_screenshot = NULL;
|
||||
}
|
||||
|
||||
RARCH_PERFORMANCE_STOP(read_viewport);
|
||||
retro_perf_stop(&read_viewport);
|
||||
context_bind_hw_render(gl, true);
|
||||
return true;
|
||||
|
||||
|
@ -1037,15 +1037,16 @@ static bool gx_frame(void *data, const void *frame,
|
||||
uint64_t frame_count, unsigned pitch,
|
||||
const char *msg)
|
||||
{
|
||||
char fps_txt[128] = {0};
|
||||
char fps_text_buf[128] = {0};
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
||||
u8 clear_efb = GX_FALSE;
|
||||
settings_t *settings = config_get_ptr();
|
||||
static struct retro_perf_counter gx_frame = {0};
|
||||
char fps_txt[128] = {0};
|
||||
char fps_text_buf[128] = {0};
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
||||
u8 clear_efb = GX_FALSE;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
RARCH_PERFORMANCE_INIT(gx_frame);
|
||||
RARCH_PERFORMANCE_START(gx_frame);
|
||||
rarch_perf_init(&gx_frame, "gx_frame");
|
||||
retro_perf_start(&gx_frame);
|
||||
|
||||
if(!gx || (!frame && !gx->menu_texture_enable))
|
||||
return true;
|
||||
@ -1078,8 +1079,10 @@ static bool gx_frame(void *data, const void *frame,
|
||||
|
||||
if (frame)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(gx_frame_convert);
|
||||
RARCH_PERFORMANCE_START(gx_frame_convert);
|
||||
static struct retro_perf_counter gx_frame_convert = {0};
|
||||
|
||||
rarch_perf_init(&gx_frame_convert, "gx_frame_convert");
|
||||
retro_perf_start(&gx_frame_convert);
|
||||
|
||||
if (gx->rgb32)
|
||||
convert_texture32(frame, g_tex.data, width, height, pitch);
|
||||
@ -1089,7 +1092,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||
convert_texture16(frame, g_tex.data, width, height, pitch);
|
||||
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gx_frame_convert);
|
||||
retro_perf_stop(&gx_frame_convert);
|
||||
}
|
||||
|
||||
if (gx->menu_texture_enable && gx->menu_data)
|
||||
@ -1166,7 +1169,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||
VISetNextFrameBuffer(g_framebuf[g_current_framebuf]);
|
||||
VIFlush();
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gx_frame);
|
||||
retro_perf_stop(&gx_frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -463,15 +463,17 @@ static bool psp_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
static char fps_txt[128] = {0};
|
||||
static char fps_text_buf[128] = {0};
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef DISPLAY_FPS
|
||||
uint32_t diff;
|
||||
static uint64_t currentTick,lastTick;
|
||||
static float fps=0.0;
|
||||
static int frames;
|
||||
static float fps = 0.0;
|
||||
#endif
|
||||
static struct retro_perf_counter psp_frame_run = {0};
|
||||
static char fps_txt[128] = {0};
|
||||
static char fps_text_buf[128] = {0};
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!width || !height)
|
||||
return false;
|
||||
@ -510,7 +512,7 @@ static bool psp_frame(void *data, const void *frame,
|
||||
#ifdef DISPLAY_FPS
|
||||
frames++;
|
||||
sceRtcGetCurrentTick(¤tTick);
|
||||
uint32_t diff = currentTick - lastTick;
|
||||
diff = currentTick - lastTick;
|
||||
if(diff > 1000000)
|
||||
{
|
||||
fps = (float)frames * 1000000.0 / diff;
|
||||
@ -524,8 +526,8 @@ static bool psp_frame(void *data, const void *frame,
|
||||
|
||||
psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers());
|
||||
|
||||
RARCH_PERFORMANCE_INIT(psp_frame_run);
|
||||
RARCH_PERFORMANCE_START(psp_frame_run);
|
||||
rarch_perf_init(&psp_frame_run, "psp_frame_run");
|
||||
retro_perf_start(&psp_frame_run);
|
||||
|
||||
if (psp->should_resize)
|
||||
psp_update_viewport(psp);
|
||||
@ -558,7 +560,7 @@ static bool psp_frame(void *data, const void *frame,
|
||||
|
||||
sceGuFinish();
|
||||
|
||||
RARCH_PERFORMANCE_STOP(psp_frame_run);
|
||||
retro_perf_stop(&psp_frame_run);
|
||||
|
||||
if(psp->menu.active)
|
||||
{
|
||||
|
@ -340,11 +340,12 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|
||||
|| target->rgb32 != rgb32 || target->pitch != pitch)
|
||||
{
|
||||
unsigned format;
|
||||
static struct retro_perf_counter sdl_create_texture = {0};
|
||||
|
||||
sdl_tex_zero(target);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl_create_texture);
|
||||
RARCH_PERFORMANCE_START(sdl_create_texture);
|
||||
rarch_perf_init(&sdl_create_texture, "sdl_create_texture");
|
||||
retro_perf_start(&sdl_create_texture);
|
||||
|
||||
if (menu)
|
||||
format = rgb32 ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_RGBA4444;
|
||||
@ -358,7 +359,7 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|
||||
target->tex = SDL_CreateTexture(vid->renderer, format,
|
||||
SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(sdl_create_texture);
|
||||
retro_perf_stop(&sdl_create_texture);
|
||||
|
||||
if (!target->tex)
|
||||
{
|
||||
@ -502,14 +503,16 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
|
||||
if (frame)
|
||||
{
|
||||
static struct retro_perf_counter sdl_copy_frame = {0};
|
||||
|
||||
sdl_refresh_input_size(vid, false, vid->video.rgb32, width, height, pitch);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl_copy_frame);
|
||||
RARCH_PERFORMANCE_START(sdl_copy_frame);
|
||||
rarch_perf_init(&sdl_copy_frame, "sdl_copy_frame");
|
||||
retro_perf_start(&sdl_copy_frame);
|
||||
|
||||
SDL_UpdateTexture(vid->frame.tex, NULL, frame, pitch);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(sdl_copy_frame);
|
||||
retro_perf_stop(&sdl_copy_frame);
|
||||
}
|
||||
|
||||
SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE);
|
||||
@ -620,9 +623,10 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
{
|
||||
SDL_Surface *surf = NULL, *bgr24 = NULL;
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
static struct retro_perf_counter sdl2_gfx_read_viewport = {0};
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl2_gfx_read_viewport);
|
||||
RARCH_PERFORMANCE_START(sdl2_gfx_read_viewport);
|
||||
rarch_perf_init(&sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport");
|
||||
retro_perf_start(&sdl2_gfx_read_viewport);
|
||||
|
||||
video_driver_cached_frame();
|
||||
|
||||
@ -637,7 +641,7 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
|
||||
memcpy(buffer, bgr24->pixels, bgr24->h * bgr24->pitch);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(sdl2_gfx_read_viewport);
|
||||
retro_perf_stop(&sdl2_gfx_read_viewport);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -695,15 +699,17 @@ static void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb3
|
||||
|
||||
if (frame)
|
||||
{
|
||||
static struct retro_perf_counter copy_texture_frame = {0};
|
||||
|
||||
sdl_refresh_input_size(vid, true, rgb32, width, height,
|
||||
width * (rgb32 ? 4 : 2));
|
||||
|
||||
RARCH_PERFORMANCE_INIT(copy_texture_frame);
|
||||
RARCH_PERFORMANCE_START(copy_texture_frame);
|
||||
rarch_perf_init(©_texture_frame, "copy_texture_frame");
|
||||
retro_perf_start(©_texture_frame);
|
||||
|
||||
SDL_UpdateTexture(vid->menu.tex, NULL, frame, vid->menu.pitch);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(copy_texture_frame);
|
||||
retro_perf_stop(©_texture_frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,8 +348,9 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
char buf[128] = {0};
|
||||
static struct retro_perf_counter sdl_scale = {0};
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
@ -359,10 +360,10 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
if (SDL_MUSTLOCK(vid->screen))
|
||||
SDL_LockSurface(vid->screen);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl_scale);
|
||||
RARCH_PERFORMANCE_START(sdl_scale);
|
||||
rarch_perf_init(&sdl_scale, "sdl_scale");
|
||||
retro_perf_start(&sdl_scale);
|
||||
scaler_ctx_scale(&vid->scaler, vid->screen->pixels, frame);
|
||||
RARCH_PERFORMANCE_STOP(sdl_scale);
|
||||
retro_perf_stop(&sdl_scale);
|
||||
|
||||
if (vid->menu.active)
|
||||
SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL);
|
||||
|
@ -314,10 +314,12 @@ static bool vg_frame(void *data, const void *frame,
|
||||
uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
static struct retro_perf_counter vg_fr = {0};
|
||||
static struct retro_perf_counter vg_image = {0};
|
||||
|
||||
RARCH_PERFORMANCE_INIT(vg_fr);
|
||||
RARCH_PERFORMANCE_START(vg_fr);
|
||||
rarch_perf_init(&vg_fr, "vg_fr");
|
||||
retro_perf_start(&vg_fr);
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
@ -341,10 +343,10 @@ static bool vg_frame(void *data, const void *frame,
|
||||
vgClear(0, 0, width, height);
|
||||
vgSeti(VG_SCISSORING, VG_TRUE);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(vg_image);
|
||||
RARCH_PERFORMANCE_START(vg_image);
|
||||
rarch_perf_init(&vg_image, "vg_image");
|
||||
retro_perf_start(&vg_image);
|
||||
vg_copy_frame(vg, frame, frame_width, frame_height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(vg_image);
|
||||
retro_perf_stop(&vg_image);
|
||||
|
||||
vgDrawImage(vg->mImage);
|
||||
|
||||
@ -355,7 +357,7 @@ static bool vg_frame(void *data, const void *frame,
|
||||
|
||||
gfx_ctx_update_window_title(vg);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(vg_fr);
|
||||
retro_perf_stop(&vg_fr);
|
||||
|
||||
gfx_ctx_swap_buffers(vg);
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
||||
|
||||
*buf = '\0';
|
||||
|
||||
new_time = rarch_get_time_usec();
|
||||
new_time = retro_get_time_usec();
|
||||
|
||||
if (video_frame_count)
|
||||
{
|
||||
@ -1158,9 +1158,10 @@ bool video_driver_frame_filter(const void *data,
|
||||
unsigned *output_width, unsigned *output_height,
|
||||
unsigned *output_pitch)
|
||||
{
|
||||
static struct retro_perf_counter softfilter_process = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
RARCH_PERFORMANCE_INIT(softfilter_process);
|
||||
rarch_perf_init(&softfilter_process, "softfilter_process");
|
||||
|
||||
if (!video_state.filter.filter)
|
||||
return false;
|
||||
@ -1172,11 +1173,11 @@ bool video_driver_frame_filter(const void *data,
|
||||
|
||||
*output_pitch = (*output_width) * video_state.filter.out_bpp;
|
||||
|
||||
RARCH_PERFORMANCE_START(softfilter_process);
|
||||
retro_perf_start(&softfilter_process);
|
||||
rarch_softfilter_process(video_state.filter.filter,
|
||||
video_state.filter.buffer, *output_pitch,
|
||||
data, width, height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(softfilter_process);
|
||||
retro_perf_stop(&softfilter_process);
|
||||
|
||||
if (settings->video.post_filter_record)
|
||||
recording_dump_frame(video_state.filter.buffer,
|
||||
|
@ -201,7 +201,7 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
|
||||
filt->impl_data = filt->impl->create(
|
||||
&softfilter_config, input_fmt, input_fmt, max_width, max_height,
|
||||
threads != RARCH_SOFTFILTER_THREADS_AUTO ? threads :
|
||||
rarch_get_cpu_cores(), cpu_features,
|
||||
retro_get_cpu_cores(), cpu_features,
|
||||
&userdata);
|
||||
if (!filt->impl_data)
|
||||
{
|
||||
@ -259,7 +259,7 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
|
||||
struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
softfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
softfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
@ -342,7 +342,7 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
|
||||
struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
softfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
softfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
(void)list;
|
||||
|
||||
@ -379,7 +379,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
|
||||
enum retro_pixel_format in_pixel_format,
|
||||
unsigned max_width, unsigned max_height)
|
||||
{
|
||||
softfilter_simd_mask_t cpu_features = rarch_get_cpu_features();
|
||||
softfilter_simd_mask_t cpu_features = retro_get_cpu_features();
|
||||
char basedir[PATH_MAX_LENGTH] = {0};
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_softfilter_t *filt = NULL;
|
||||
|
@ -117,9 +117,10 @@ bool video_pixel_frame_scale(const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch)
|
||||
{
|
||||
static struct retro_perf_counter video_frame_conv = {0};
|
||||
video_pixel_scaler_t *scaler = scaler_get_ptr();
|
||||
|
||||
RARCH_PERFORMANCE_INIT(video_frame_conv);
|
||||
rarch_perf_init(&video_frame_conv, "video_frame_conv");
|
||||
|
||||
if (!data)
|
||||
return false;
|
||||
@ -128,7 +129,7 @@ bool video_pixel_frame_scale(const void *data,
|
||||
if (data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||
return false;
|
||||
|
||||
RARCH_PERFORMANCE_START(video_frame_conv);
|
||||
retro_perf_start(&video_frame_conv);
|
||||
|
||||
scaler->scaler->in_width = width;
|
||||
scaler->scaler->in_height = height;
|
||||
@ -139,7 +140,7 @@ bool video_pixel_frame_scale(const void *data,
|
||||
|
||||
scaler_ctx_scale(scaler->scaler, scaler->scaler_out, data);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(video_frame_conv);
|
||||
retro_perf_stop(&video_frame_conv);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -488,9 +488,10 @@ static bool thread_frame(void *data, const void *frame_,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned copy_stride;
|
||||
const uint8_t *src = NULL;
|
||||
uint8_t *dst = NULL;
|
||||
thread_video_t *thr = (thread_video_t*)data;
|
||||
static struct retro_perf_counter thr_frame = {0};
|
||||
const uint8_t *src = NULL;
|
||||
uint8_t *dst = NULL;
|
||||
thread_video_t *thr = (thread_video_t*)data;
|
||||
|
||||
/* If called from within read_viewport, we're actually in the
|
||||
* driver thread, so just render directly. */
|
||||
@ -504,8 +505,8 @@ static bool thread_frame(void *data, const void *frame_,
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_PERFORMANCE_INIT(thr_frame);
|
||||
RARCH_PERFORMANCE_START(thr_frame);
|
||||
rarch_perf_init(&thr_frame, "thr_frame");
|
||||
retro_perf_start(&thr_frame);
|
||||
|
||||
copy_stride = width * (thr->info.rgb32
|
||||
? sizeof(uint32_t) : sizeof(uint16_t));
|
||||
@ -526,8 +527,8 @@ static bool thread_frame(void *data, const void *frame_,
|
||||
/* Ideally, use absolute time, but that is only a good idea on POSIX. */
|
||||
while (thr->frame.updated)
|
||||
{
|
||||
retro_time_t current = rarch_get_time_usec();
|
||||
retro_time_t delta = target - current;
|
||||
retro_time_t current = retro_get_time_usec();
|
||||
retro_time_t delta = target - current;
|
||||
|
||||
if (delta <= 0)
|
||||
break;
|
||||
@ -575,9 +576,9 @@ static bool thread_frame(void *data, const void *frame_,
|
||||
|
||||
slock_unlock(thr->lock);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(thr_frame);
|
||||
retro_perf_stop(&thr_frame);
|
||||
|
||||
thr->last_time = rarch_get_time_usec();
|
||||
thr->last_time = retro_get_time_usec();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -617,7 +618,7 @@ static bool thread_init(thread_video_t *thr, const video_info_t *info,
|
||||
|
||||
memset(thr->frame.buffer, 0x80, max_size);
|
||||
|
||||
thr->last_time = rarch_get_time_usec();
|
||||
thr->last_time = retro_get_time_usec();
|
||||
thr->thread = sthread_create(thread_loop, thr);
|
||||
if (!thr->thread)
|
||||
return false;
|
||||
|
@ -650,8 +650,8 @@ void menu_animation_update_time(void)
|
||||
menu_animation_t *anim = disp->animation;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
anim->cur_time = rarch_get_time_usec();
|
||||
anim->delta_time = anim->cur_time - anim->old_time;
|
||||
anim->cur_time = retro_get_time_usec();
|
||||
anim->delta_time = anim->cur_time - anim->old_time;
|
||||
|
||||
if (anim->delta_time >= IDEAL_DT * 4)
|
||||
anim->delta_time = IDEAL_DT * 4;
|
||||
|
@ -376,7 +376,7 @@ static bool menu_input_custom_bind_keyboard_cb(void *data, unsigned code)
|
||||
menu_input->binds.target->key = (enum retro_key)code;
|
||||
menu_input->binds.begin++;
|
||||
menu_input->binds.target++;
|
||||
menu_input->binds.timeout_end = rarch_get_time_usec() +
|
||||
menu_input->binds.timeout_end = retro_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
|
||||
return (menu_input->binds.begin <= menu_input->binds.last);
|
||||
@ -442,7 +442,7 @@ static int menu_input_set_timeout(void)
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
|
||||
menu_input->binds.timeout_end = rarch_get_time_usec() +
|
||||
menu_input->binds.timeout_end = retro_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
input_keyboard_wait_keys(menu,
|
||||
menu_input_custom_bind_keyboard_cb);
|
||||
@ -499,7 +499,7 @@ static int menu_input_bind_iterate_keyboard(int64_t current, int timeout)
|
||||
|
||||
menu_input->binds.begin++;
|
||||
menu_input->binds.target++;
|
||||
menu_input->binds.timeout_end = rarch_get_time_usec() +
|
||||
menu_input->binds.timeout_end = retro_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
timed_out = true;
|
||||
}
|
||||
@ -527,7 +527,7 @@ int menu_input_bind_iterate(char *s, size_t len)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
bool bind_mode_kb = global ? global->menu.bind_mode_keyboard : false;
|
||||
int64_t current = rarch_get_time_usec();
|
||||
int64_t current = retro_get_time_usec();
|
||||
int timeout = (menu_input->binds.timeout_end - current) / 1000000;
|
||||
|
||||
if (bind_mode_kb)
|
||||
|
@ -40,11 +40,11 @@ static int action_iterate_help(char *s, size_t len, const char *label)
|
||||
int64_t timeout;
|
||||
static bool timer_begin = false;
|
||||
static bool timer_end = false;
|
||||
int64_t current = rarch_get_time_usec();
|
||||
int64_t current = retro_get_time_usec();
|
||||
|
||||
if (!timer_begin)
|
||||
{
|
||||
timeout_end = rarch_get_time_usec() +
|
||||
timeout_end = retro_get_time_usec() +
|
||||
3 /* seconds */ * 1000000;
|
||||
timer_begin = true;
|
||||
timer_end = false;
|
||||
|
@ -170,13 +170,13 @@ void retro_perf_log(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_get_perf_counter:
|
||||
* retro_get_perf_counter:
|
||||
*
|
||||
* Gets performance counter.
|
||||
*
|
||||
* Returns: performance counter.
|
||||
**/
|
||||
retro_perf_tick_t rarch_get_perf_counter(void)
|
||||
retro_perf_tick_t retro_get_perf_counter(void)
|
||||
{
|
||||
retro_perf_tick_t time_ticks = 0;
|
||||
#if defined(__linux__) || defined(__QNX__) || defined(__MACH__)
|
||||
@ -229,13 +229,13 @@ retro_perf_tick_t rarch_get_perf_counter(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_get_time_usec:
|
||||
* retro_get_time_usec:
|
||||
*
|
||||
* Gets time in microseconds.
|
||||
*
|
||||
* Returns: time in microseconds.
|
||||
**/
|
||||
retro_time_t rarch_get_time_usec(void)
|
||||
retro_time_t retro_get_time_usec(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
static LARGE_INTEGER freq;
|
||||
@ -268,7 +268,7 @@ retro_time_t rarch_get_time_usec(void)
|
||||
#elif defined(VITA)
|
||||
return sceKernelGetProcessTimeWide();
|
||||
#else
|
||||
#error "Your platform does not have a timer function implemented in rarch_get_time_usec(). Cannot continue."
|
||||
#error "Your platform does not have a timer function implemented in retro_get_time_usec(). Cannot continue."
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -351,13 +351,13 @@ static void arm_enable_runfast_mode(void)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* rarch_get_cpu_cores:
|
||||
* retro_get_cpu_cores:
|
||||
*
|
||||
* Gets the amount of available CPU cores.
|
||||
*
|
||||
* Returns: amount of CPU cores available.
|
||||
**/
|
||||
unsigned rarch_get_cpu_cores(void)
|
||||
unsigned retro_get_cpu_cores(void)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
/* Win32 */
|
||||
@ -407,13 +407,13 @@ unsigned rarch_get_cpu_cores(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_get_cpu_features:
|
||||
* retro_get_cpu_features:
|
||||
*
|
||||
* Gets CPU features..
|
||||
*
|
||||
* Returns: bitmask of all CPU features available.
|
||||
**/
|
||||
uint64_t rarch_get_cpu_features(void)
|
||||
uint64_t retro_get_cpu_features(void)
|
||||
{
|
||||
int flags[4];
|
||||
int vendor_shuffle[3];
|
||||
@ -555,21 +555,31 @@ uint64_t rarch_get_cpu_features(void)
|
||||
return cpu;
|
||||
}
|
||||
|
||||
void rarch_perf_start(struct retro_perf_counter *perf)
|
||||
int rarch_perf_init(struct retro_perf_counter *perf, const char *name)
|
||||
{
|
||||
perf->ident = name;
|
||||
|
||||
if (!perf->registered)
|
||||
rarch_perf_register(perf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void retro_perf_start(struct retro_perf_counter *perf)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global->perfcnt_enable || !perf)
|
||||
return;
|
||||
|
||||
perf->call_cnt++;
|
||||
perf->start = rarch_get_perf_counter();
|
||||
perf->start = retro_get_perf_counter();
|
||||
}
|
||||
|
||||
void rarch_perf_stop(struct retro_perf_counter *perf)
|
||||
void retro_perf_stop(struct retro_perf_counter *perf)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global->perfcnt_enable || !perf)
|
||||
return;
|
||||
|
||||
perf->total += rarch_get_perf_counter() - perf->start;
|
||||
perf->total += retro_get_perf_counter() - perf->start;
|
||||
}
|
||||
|
@ -33,17 +33,6 @@ extern "C" {
|
||||
#define PERF_LOG_FMT "[PERF]: Avg (%s): %llu ticks, %llu runs.\n"
|
||||
#endif
|
||||
|
||||
/* Used internally by RetroArch. */
|
||||
#define RARCH_PERFORMANCE_INIT(X) \
|
||||
static struct retro_perf_counter X = {#X}; \
|
||||
do { \
|
||||
if (!(X).registered) \
|
||||
rarch_perf_register(&(X)); \
|
||||
} while(0)
|
||||
|
||||
#define RARCH_PERFORMANCE_START(X) rarch_perf_start(&(X))
|
||||
#define RARCH_PERFORMANCE_STOP(X) rarch_perf_stop(&(X))
|
||||
|
||||
#ifndef MAX_COUNTERS
|
||||
#define MAX_COUNTERS 64
|
||||
#endif
|
||||
@ -54,67 +43,68 @@ extern unsigned perf_ptr_rarch;
|
||||
extern unsigned perf_ptr_libretro;
|
||||
|
||||
/**
|
||||
* rarch_get_perf_counter:
|
||||
* retro_get_perf_counter:
|
||||
*
|
||||
* Gets performance counter.
|
||||
*
|
||||
* Returns: performance counter.
|
||||
**/
|
||||
retro_perf_tick_t rarch_get_perf_counter(void);
|
||||
retro_perf_tick_t retro_get_perf_counter(void);
|
||||
|
||||
/**
|
||||
* rarch_get_time_usec:
|
||||
*
|
||||
* Gets time in microseconds.
|
||||
* retro_get_time_usec:
|
||||
*
|
||||
* Gets time in microseconds. *
|
||||
* Returns: time in microseconds.
|
||||
**/
|
||||
retro_time_t rarch_get_time_usec(void);
|
||||
retro_time_t retro_get_time_usec(void);
|
||||
|
||||
void rarch_perf_register(struct retro_perf_counter *perf);
|
||||
void retro_perf_register(struct retro_perf_counter *perf);
|
||||
|
||||
/* Same as rarch_perf_register, just for libretro cores. */
|
||||
/* Same as retro_perf_register, just for libretro cores. */
|
||||
void retro_perf_register(struct retro_perf_counter *perf);
|
||||
|
||||
void retro_perf_clear(void);
|
||||
|
||||
void rarch_perf_log(void);
|
||||
|
||||
void retro_perf_log(void);
|
||||
|
||||
void rarch_perf_log(void);
|
||||
|
||||
int rarch_perf_init(struct retro_perf_counter *perf, const char *name);
|
||||
|
||||
/**
|
||||
* rarch_perf_start:
|
||||
* retro_perf_start:
|
||||
* @perf : pointer to performance counter
|
||||
*
|
||||
* Start performance counter.
|
||||
**/
|
||||
void rarch_perf_start(struct retro_perf_counter *perf);
|
||||
void retro_perf_start(struct retro_perf_counter *perf);
|
||||
|
||||
/**
|
||||
* rarch_perf_stop:
|
||||
* retro_perf_stop:
|
||||
* @perf : pointer to performance counter
|
||||
*
|
||||
* Stop performance counter.
|
||||
**/
|
||||
void rarch_perf_stop(struct retro_perf_counter *perf);
|
||||
void retro_perf_stop(struct retro_perf_counter *perf);
|
||||
|
||||
/**
|
||||
* rarch_get_cpu_features:
|
||||
* retro_get_cpu_features:
|
||||
*
|
||||
* Gets CPU features..
|
||||
*
|
||||
* Returns: bitmask of all CPU features available.
|
||||
**/
|
||||
uint64_t rarch_get_cpu_features(void);
|
||||
uint64_t retro_get_cpu_features(void);
|
||||
|
||||
/**
|
||||
* rarch_get_cpu_cores:
|
||||
* retro_get_cpu_cores:
|
||||
*
|
||||
* Gets the amount of available CPU cores.
|
||||
*
|
||||
* Returns: amount of CPU cores available.
|
||||
**/
|
||||
unsigned rarch_get_cpu_cores(void);
|
||||
unsigned retro_get_cpu_cores(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1122,7 +1122,7 @@ void rarch_verify_api_version(void)
|
||||
*/
|
||||
static void validate_cpu_features(void)
|
||||
{
|
||||
uint64_t cpu = rarch_get_cpu_features();
|
||||
uint64_t cpu = retro_get_cpu_features();
|
||||
(void)cpu;
|
||||
|
||||
#ifdef __SSE__
|
||||
|
@ -26,7 +26,7 @@ int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t le
|
||||
{
|
||||
case RARCH_CAPABILITIES_CPU:
|
||||
{
|
||||
uint64_t cpu = rarch_get_cpu_features();
|
||||
uint64_t cpu = retro_get_cpu_features();
|
||||
|
||||
if (cpu & RETRO_SIMD_MMX)
|
||||
strlcat(s, "MMX ", len);
|
||||
|
7
rewind.c
7
rewind.c
@ -480,6 +480,7 @@ void state_manager_push_where(state_manager_t *state, void **data)
|
||||
|
||||
void state_manager_push_do(state_manager_t *state)
|
||||
{
|
||||
static struct retro_perf_counter gen_deltas = {0};
|
||||
uint8_t *swap = NULL;
|
||||
|
||||
if (state->thisblock_valid)
|
||||
@ -504,8 +505,8 @@ recheckcapacity:;
|
||||
goto recheckcapacity;
|
||||
}
|
||||
|
||||
RARCH_PERFORMANCE_INIT(gen_deltas);
|
||||
RARCH_PERFORMANCE_START(gen_deltas);
|
||||
rarch_perf_init(&gen_deltas, "gen_deltas");
|
||||
retro_perf_start(&gen_deltas);
|
||||
|
||||
oldb = state->thisblock;
|
||||
newb = state->nextblock;
|
||||
@ -524,7 +525,7 @@ recheckcapacity:;
|
||||
write_size_t(state->head, compressed-state->data);
|
||||
state->head = compressed;
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gen_deltas);
|
||||
retro_perf_stop(&gen_deltas);
|
||||
}
|
||||
else
|
||||
state->thisblock_valid = true;
|
||||
|
16
runloop.c
16
runloop.c
@ -211,13 +211,15 @@ static void check_rewind(settings_t *settings,
|
||||
|
||||
if ((cnt == 0) || global->bsv.movie)
|
||||
{
|
||||
static struct retro_perf_counter rewind_serialize = {0};
|
||||
void *state = NULL;
|
||||
|
||||
state_manager_push_where(global->rewind.state, &state);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(rewind_serialize);
|
||||
RARCH_PERFORMANCE_START(rewind_serialize);
|
||||
rarch_perf_init(&rewind_serialize, "rewind_serialize");
|
||||
retro_perf_start(&rewind_serialize);
|
||||
pretro_serialize(state, global->rewind.size);
|
||||
RARCH_PERFORMANCE_STOP(rewind_serialize);
|
||||
retro_perf_stop(&rewind_serialize);
|
||||
|
||||
state_manager_push_do(global->rewind.state);
|
||||
}
|
||||
@ -631,7 +633,7 @@ static INLINE int time_to_exit(driver_t *driver, global_t *global,
|
||||
static void rarch_update_frame_time(driver_t *driver, float slowmotion_ratio,
|
||||
rarch_system_info_t *system)
|
||||
{
|
||||
retro_time_t current = rarch_get_time_usec();
|
||||
retro_time_t current = retro_get_time_usec();
|
||||
retro_time_t delta = current - system->frame_time_last;
|
||||
bool is_locked_fps = (main_is_paused || driver->nonblock_state) |
|
||||
!!driver->recording_data;
|
||||
@ -657,7 +659,7 @@ static int rarch_limit_frame_time(float fastforward_ratio, unsigned *sleep_ms)
|
||||
if (!fastforward_ratio)
|
||||
return 0;
|
||||
|
||||
current = rarch_get_time_usec();
|
||||
current = retro_get_time_usec();
|
||||
target = frame_limit_last_time + frame_limit_minimum_time;
|
||||
to_sleep_ms = (target - current) / 1000;
|
||||
|
||||
@ -669,7 +671,7 @@ static int rarch_limit_frame_time(float fastforward_ratio, unsigned *sleep_ms)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
frame_limit_last_time = rarch_get_time_usec();
|
||||
frame_limit_last_time = retro_get_time_usec();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -835,7 +837,7 @@ void rarch_main_set_frame_limit_last_time(void)
|
||||
if (fastforward_ratio == 0.0f)
|
||||
fastforward_ratio = 1.0f;
|
||||
|
||||
frame_limit_last_time = rarch_get_time_usec();
|
||||
frame_limit_last_time = retro_get_time_usec();
|
||||
frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f / (av_info->timing.fps * fastforward_ratio));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user