diff --git a/camera/drivers/video4linux2.c b/camera/drivers/video4linux2.c index e616fae073..24820ca285 100644 --- a/camera/drivers/video4linux2.c +++ b/camera/drivers/video4linux2.c @@ -41,7 +41,6 @@ #include #include "../camera_driver.h" -#include "../../performance_counters.h" #include "../../verbosity.h" struct buffer @@ -66,16 +65,6 @@ typedef struct video4linux char dev_name[255]; } video4linux_t; -static void process_image(video4linux_t *v4l, const uint8_t *buffer_yuv) -{ - static struct retro_perf_counter yuv_convert_direct = {0}; - - performance_counter_init(yuv_convert_direct, "yuv_convert_direct"); - performance_counter_start(yuv_convert_direct); - scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, buffer_yuv); - performance_counter_stop(yuv_convert_direct); -} - static int xioctl(int fd, int request, void *args) { int r; @@ -385,7 +374,7 @@ static bool preprocess_image(void *data) retro_assert(buf.index < v4l->n_buffers); - process_image(v4l, (const uint8_t*)v4l->buffers[buf.index].start); + scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, (const uint8_t*)v4l->buffers[buf.index].start); if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1) RARCH_ERR("VIDIOC_QBUF\n"); diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 2d69e891c4..f8db6ed7b4 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -29,7 +29,6 @@ #include "vulkan_common.h" #include "../../configuration.h" -#include "../../performance_counters.h" static dylib_t vulkan_library; static VkInstance cached_instance; @@ -2239,12 +2238,7 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk) if (*next_fence != VK_NULL_HANDLE) { - static struct retro_perf_counter fence_wait = {0}; - - performance_counter_init(fence_wait, "fence_wait"); - performance_counter_start(fence_wait); vkWaitForFences(vk->context.device, 1, next_fence, true, UINT64_MAX); - performance_counter_stop(fence_wait); vkResetFences(vk->context.device, 1, next_fence); } diff --git a/gfx/drivers/d3d_renderchains/render_chain_cg.cpp b/gfx/drivers/d3d_renderchains/render_chain_cg.cpp index d9141f6fe1..bdd7232ce3 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_cg.cpp +++ b/gfx/drivers/d3d_renderchains/render_chain_cg.cpp @@ -36,7 +36,6 @@ #include "render_chain_driver.h" #include "../../video_driver.h" -#include "../../../performance_counters.h" #include "../../../configuration.h" #include "../../../verbosity.h" @@ -1526,13 +1525,9 @@ static bool cg_d3d9_renderchain_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); - performance_counter_init(d3d_read_viewport, "d3d_read_viewport"); - performance_counter_start(d3d_read_viewport); - (void)data; (void)buffer; @@ -1583,7 +1578,6 @@ static bool cg_d3d9_renderchain_read_viewport(void *data, uint8_t *buffer) ret = false; end: - performance_counter_stop(d3d_read_viewport); if (target) target->Release(); if (dest) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index d92615aa75..ba7fb246e5 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -980,8 +980,6 @@ static struct video_shader *gl_get_current_shader(void *data) #if defined(HAVE_GL_ASYNC_READBACK) 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; @@ -994,8 +992,6 @@ static void gl_pbo_async_readback(gl_t *gl) video_pixel_get_alignment(gl->vp.width * sizeof(uint32_t))); /* Read asynchronously into PBO buffer. */ - performance_counter_init(async_readback, "async_readback"); - performance_counter_start(async_readback); glReadBuffer(GL_BACK); #ifdef HAVE_OPENGLES3 glReadPixels(gl->vp.x, gl->vp.y, @@ -1006,7 +1002,6 @@ 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 - performance_counter_stop(async_readback); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } @@ -2364,7 +2359,6 @@ static void gl_viewport_info(void *data, struct video_viewport *vp) static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) { #ifndef NO_GL_READ_PIXELS - static struct retro_perf_counter read_viewport = {0}; unsigned num_pixels = 0; gl_t *gl = (gl_t*)data; @@ -2373,9 +2367,6 @@ static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) context_bind_hw_render(false); - performance_counter_init(read_viewport, "read_viewport"); - performance_counter_start(read_viewport); - num_pixels = gl->vp.width * gl->vp.height; #ifdef HAVE_GL_ASYNC_READBACK @@ -2439,10 +2430,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) gl->readback_buffer_screenshot = malloc(num_pixels * sizeof(uint32_t)); if (!gl->readback_buffer_screenshot) - { - performance_counter_stop(read_viewport); goto error; - } if (!is_idle) video_driver_cached_frame(); @@ -2456,7 +2444,6 @@ static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) gl->readback_buffer_screenshot = NULL; } - performance_counter_stop(read_viewport); context_bind_hw_render(true); return true; diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 58d0f6a837..de65f8ffff 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -345,13 +345,9 @@ 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); - performance_counter_init(sdl_create_texture, "sdl_create_texture"); - performance_counter_start(sdl_create_texture); - if (menu) format = rgb32 ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_RGBA4444; else /* this assumes the frontend will convert 0RGB1555 to RGB565 */ @@ -364,8 +360,6 @@ 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); - performance_counter_stop(sdl_create_texture); - if (!target->tex) { RARCH_ERR("Failed to create %s texture: %s\n", menu ? "menu" : "main", @@ -630,10 +624,6 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { SDL_Surface *surf = NULL, *bgr24 = NULL; sdl2_video_t *vid = (sdl2_video_t*)data; - static struct retro_perf_counter sdl2_gfx_read_viewport = {0}; - - performance_counter_init(sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport"); - performance_counter_start(sdl2_gfx_read_viewport); if (!is_idle) video_driver_cached_frame(); @@ -649,8 +639,6 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) memcpy(buffer, bgr24->pixels, bgr24->h * bgr24->pitch); - performance_counter_stop(sdl2_gfx_read_viewport); - return true; } @@ -700,21 +688,14 @@ static void sdl2_poke_apply_state_changes(void *data) static void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha) { - sdl2_video_t *vid = (sdl2_video_t*)data; - if (frame) { - static struct retro_perf_counter copy_texture_frame = {0}; + sdl2_video_t *vid = (sdl2_video_t*)data; sdl_refresh_input_size(vid, true, rgb32, width, height, - width * (rgb32 ? 4 : 2)); - - performance_counter_init(copy_texture_frame, "copy_texture_frame"); - performance_counter_start(copy_texture_frame); + width * (rgb32 ? 4 : 2)); SDL_UpdateTexture(vid->menu.tex, NULL, frame, vid->menu.pitch); - - performance_counter_stop(copy_texture_frame); } } diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index b6f5b0d1ad..f4bcbc418b 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -2275,14 +2275,10 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle) if (vk->readback.streamed) { const uint8_t *src; - static struct retro_perf_counter stream_readback = {0}; if (staging->memory == VK_NULL_HANDLE) return false; - performance_counter_init(stream_readback, "stream_readback"); - performance_counter_start(stream_readback); - buffer += 3 * (vk->vp.height - 1) * vk->vp.width; vkMapMemory(vk->context->device, staging->memory, staging->offset, staging->size, 0, (void**)&src); @@ -2294,8 +2290,6 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle) scaler_ctx_scale(&vk->readback.scaler, buffer, src); vkUnmapMemory(vk->context->device, staging->memory); - - performance_counter_stop(stream_readback); } else { diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 88d69eb559..5ca8a0cb11 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2050,11 +2050,6 @@ void video_driver_frame(const void *data, unsigned width, (video_driver_pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555) && (data != RETRO_HW_FRAME_BUFFER_VALID)) { - static struct retro_perf_counter video_frame_conv = {0}; - - performance_counter_init(video_frame_conv, "video_frame_conv"); - performance_counter_start(video_frame_conv); - if (video_pixel_frame_scale( video_driver_scaler_ptr->scaler, video_driver_scaler_ptr->scaler_out, @@ -2063,7 +2058,6 @@ void video_driver_frame(const void *data, unsigned width, data = video_driver_scaler_ptr->scaler_out; pitch = video_driver_scaler_ptr->scaler->out_stride; } - performance_counter_stop(video_frame_conv); } diff --git a/managers/state_manager.c b/managers/state_manager.c index 7b09a94a68..39a55c236f 100644 --- a/managers/state_manager.c +++ b/managers/state_manager.c @@ -28,7 +28,6 @@ #include "../msg_hash.h" #include "../movie.h" #include "../core.h" -#include "../performance_counters.h" #include "../verbosity.h" #include "../audio/audio_driver.h" @@ -534,13 +533,12 @@ static void state_manager_push_where(state_manager_t *state, void **data) static void state_manager_push_do(state_manager_t *state) { + uint8_t *swap = NULL; + #if STRICT_BUF_SIZE memcpy(state->nextblock, state->debugblock, state->debugsize); #endif - static struct retro_perf_counter gen_deltas = {0}; - uint8_t *swap = NULL; - if (state->thisblock_valid) { const uint8_t *oldb, *newb; @@ -563,9 +561,6 @@ recheckcapacity:; goto recheckcapacity; } - performance_counter_init(gen_deltas, "gen_deltas"); - performance_counter_start(gen_deltas); - oldb = state->thisblock; newb = state->nextblock; compressed = state->head + sizeof(size_t); @@ -583,8 +578,6 @@ recheckcapacity:; compressed += sizeof(size_t); write_size_t(state->head, compressed-state->data); state->head = compressed; - - performance_counter_stop(gen_deltas); } else state->thisblock_valid = true; @@ -760,21 +753,15 @@ bool state_manager_check_rewind(bool pressed, if ((cnt == 0) || bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL)) { retro_ctx_serialize_info_t serial_info; - static struct retro_perf_counter rewind_serialize = {0}; void *state = NULL; state_manager_push_where(rewind_state.state, &state); - performance_counter_init(rewind_serialize, "rewind_serialize"); - performance_counter_start(rewind_serialize); - serial_info.data = state; serial_info.size = rewind_state.size; core_serialize(&serial_info); - performance_counter_stop(rewind_serialize); - state_manager_push_do(rewind_state.state); } } diff --git a/performance_counters.h b/performance_counters.h index 958c1474f6..229ee42de5 100644 --- a/performance_counters.h +++ b/performance_counters.h @@ -24,8 +24,6 @@ #include #include -#include "runloop.h" - RETRO_BEGIN_DECLS #ifndef MAX_COUNTERS @@ -81,7 +79,6 @@ void rarch_perf_register(struct retro_perf_counter *perf); * * Start performance counter. **/ -#define performance_counter_start(perf) performance_counter_start_internal(runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL), perf) #define performance_counter_start_plus(is_perfcnt_enable, perf) performance_counter_start_internal(is_perfcnt_enable, perf) /** @@ -90,7 +87,6 @@ void rarch_perf_register(struct retro_perf_counter *perf); * * Stop performance counter. **/ -#define performance_counter_stop(perf) performance_counter_stop_internal(runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL), perf) #define performance_counter_stop_plus(is_perfcnt_enable, perf) performance_counter_stop_internal(is_perfcnt_enable, perf) void rarch_timer_tick(rarch_timer_t *timer);