(gfx/drivers) Get rid of remaining runloop.h / runloop_ctl

references inside gfx/drivers
This commit is contained in:
twinaphex 2017-01-22 18:17:48 +01:00
parent 90bc170829
commit 2f504b4057
30 changed files with 57 additions and 66 deletions

View File

@ -261,7 +261,7 @@ static void caca_gfx_viewport_info(void *data,
(void)vp;
}
static bool caca_gfx_read_viewport(void *data, uint8_t *buffer)
static bool caca_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -1146,7 +1146,7 @@ static void ctr_get_poke_interface(void* data,
*iface = &ctr_poke_interface;
}
static bool ctr_read_viewport(void* data, uint8_t* buffer)
static bool ctr_read_viewport(void* data, uint8_t* buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -53,7 +53,6 @@
#include "../../performance_counters.h"
#include "../../defines/d3d_defines.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
@ -1475,7 +1474,7 @@ static bool d3d_frame(void *data, const void *frame,
return true;
}
static bool d3d_read_viewport(void *data, uint8_t *buffer)
static bool d3d_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
d3d_video_t *d3d = (d3d_video_t*)data;

View File

@ -38,7 +38,6 @@
#include "../../video_driver.h"
#include "../../../performance_counters.h"
#include "../../../configuration.h"
#include "../../../runloop.h"
#include "../../../verbosity.h"
#define cg_d3d9_set_param_1f(param, x) if (param) cgD3D9SetUniform(param, x)

View File

@ -30,7 +30,6 @@
#include "../../driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../video_context_driver.h"
#include "../font_driver.h"
@ -599,7 +598,7 @@ static void dispmanx_gfx_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer)
static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -39,7 +39,6 @@
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "drm_pixformats.h"
@ -940,7 +939,7 @@ static void drm_gfx_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static bool drm_gfx_read_viewport(void *data, uint8_t *buffer)
static bool drm_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -44,7 +44,6 @@
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../retroarch.h"
#include "../../runloop.h"
/* TODO: Honor these properties: vsync, menu rotation, menu alpha, aspect ratio change */
@ -1521,7 +1520,7 @@ static bool exynos_gfx_set_shader(void *data,
return false;
}
static bool exynos_gfx_read_viewport(void *data, uint8_t *buffer)
static bool exynos_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -355,7 +355,7 @@ static void gdi_gfx_viewport_info(void *data,
(void)vp;
}
static bool gdi_gfx_read_viewport(void *data, uint8_t *buffer)
static bool gdi_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -47,7 +47,6 @@
#include "../../performance_counters.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../common/gl_common.h"
@ -2360,7 +2359,7 @@ static void gl_viewport_info(void *data, struct video_viewport *vp)
vp->y = top_dist;
}
static bool gl_read_viewport(void *data, uint8_t *buffer)
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};
@ -2443,7 +2442,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
goto error;
}
if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
if (!is_idle)
video_driver_cached_frame();
video_frame_convert_rgba_to_bgr(

View File

@ -42,7 +42,6 @@
#include "../../defines/gx_defines.h"
#include "../../configuration.h"
#include "../../driver.h"
#include "../../runloop.h"
extern syssram* __SYS_LockSram(void);
extern u32 __SYS_UnlockSram(u32 write);
@ -1180,7 +1179,7 @@ static void gx_viewport_info(void *data, struct video_viewport *vp)
*vp = gx->vp;
}
static bool gx_read_viewport(void *data, uint8_t *buffer)
static bool gx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -105,7 +105,7 @@ static void null_gfx_viewport_info(void *data,
(void)vp;
}
static bool null_gfx_read_viewport(void *data, uint8_t *buffer)
static bool null_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -48,7 +48,6 @@
#include "../../configuration.h"
#include "../../driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../video_context_driver.h"
@ -1097,7 +1096,7 @@ static void omap_gfx_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static bool omap_gfx_read_viewport(void *data, uint8_t *buffer)
static bool omap_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -35,7 +35,6 @@
#include "../font_driver.h"
#include "../../defines/psp_defines.h"
#include "../../runloop.h"
#ifndef SCEGU_SCR_WIDTH
#define SCEGU_SCR_WIDTH 480
@ -871,7 +870,7 @@ static void psp_get_poke_interface(void *data,
*iface = &psp_poke_interface;
}
static bool psp_read_viewport(void *data, uint8_t *buffer)
static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
void* src_buffer;
int i, j, src_bufferwidth, src_pixelformat, src_x, src_y, src_x_max, src_y_max;

View File

@ -40,7 +40,6 @@
#include "../../configuration.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../performance_counters.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
@ -627,7 +626,7 @@ static void sdl2_gfx_viewport_info(void *data, struct video_viewport *vp)
*vp = vid->vp;
}
static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
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;
@ -636,7 +635,7 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
performance_counter_init(&sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport");
performance_counter_start(&sdl2_gfx_read_viewport);
if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
if (!is_idle)
video_driver_cached_frame();
surf = SDL_GetWindowSurface(vid->window);

View File

@ -43,7 +43,6 @@
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../performance_counters.h"
#include "../video_context_driver.h"
@ -576,7 +575,7 @@ static void sdl_gfx_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static bool sdl_gfx_read_viewport(void *data, uint8_t *buffer)
static bool sdl_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -36,7 +36,6 @@
#include "../font_driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#define NUMPAGES 2

View File

@ -40,11 +40,9 @@
#include "../video_context_driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../driver.h"
#include "../../performance_counters.h"
#include "../../content.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../../configuration.h"
@ -502,7 +500,7 @@ static void vg_viewport_info(void *data,
(void)vp;
}
static bool vg_read_viewport(void *data, uint8_t *buffer)
static bool vg_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -276,7 +276,7 @@ static void vga_gfx_viewport_info(void *data,
(void)vp;
}
static bool vga_gfx_read_viewport(void *data, uint8_t *buffer)
static bool vga_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -32,7 +32,6 @@
#include "../common/vita2d_common.h"
#include "../../driver.h"
#include "../../runloop.h"
#include "../video_coord_array.h"
#include "../video_context_driver.h"
#include "../../verbosity.h"
@ -561,7 +560,7 @@ static void vita2d_gfx_viewport_info(void *data,
*vp = vita->vp;
}
static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer)
static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -45,7 +45,6 @@
#include "../../performance_counters.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
@ -2262,7 +2261,7 @@ static void vulkan_viewport_info(void *data, struct video_viewport *vp)
vp->full_height = height;
}
static bool vulkan_read_viewport(void *data, uint8_t *buffer)
static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
struct vk_texture *staging = NULL;
vk_t *vk = (vk_t*)data;
@ -2305,7 +2304,8 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer)
* with conversion. */
vk->readback.pending = true;
if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
if (!is_idle)
video_driver_cached_frame();
vkQueueWaitIdle(vk->context->queue);

View File

@ -768,7 +768,7 @@ static void wiiu_gfx_viewport_info(void* data,
*vp = wiiu->vp;
}
static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer)
static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle)
{
(void)data;
(void)buffer;
@ -777,7 +777,7 @@ static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer)
}
static uintptr_t wiiu_gfx_load_texture(void* video_data, void* data,
bool threaded, enum texture_filter_type filter_type)
bool threaded, enum texture_filter_type filter_type)
{
return 0;
}

View File

@ -29,7 +29,6 @@
#include "../font_driver.h"
#include "../../driver.h"
#include "../../runloop.h"
#define XE_W 512
#define XE_H 512
@ -299,7 +298,7 @@ static void xenon360_gfx_viewport_info(void *data, struct video_viewport *vp)
(void)vp;
}
static bool xenon360_gfx_read_viewport(void *data, uint8_t *buffer)
static bool xenon360_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -158,7 +158,7 @@ static void xshm_gfx_viewport_info(void *data, struct video_viewport *vp)
}
static bool xshm_gfx_read_viewport(void *data, uint8_t *buffer)
static bool xshm_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
return false;
}

View File

@ -892,7 +892,7 @@ static void xv_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static bool xv_read_viewport(void *data, uint8_t *buffer)
static bool xv_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
(void)data;
(void)buffer;

View File

@ -1102,7 +1102,8 @@ static bool video_driver_frame_filter(
if (video_info->post_filter_record && recording_data)
recording_dump_frame(video_driver_state_buffer,
*output_width, *output_height, *output_pitch);
*output_width, *output_height, *output_pitch,
video_info->runloop_is_idle);
return true;
}
@ -1634,10 +1635,10 @@ void video_driver_apply_state_changes(void)
video_driver_poke->apply_state_changes(video_driver_data);
}
bool video_driver_read_viewport(uint8_t *buffer)
bool video_driver_read_viewport(uint8_t *buffer, bool is_idle)
{
if ( current_video->read_viewport
&& current_video->read_viewport(video_driver_data, buffer))
&& current_video->read_viewport(video_driver_data, buffer, is_idle))
return true;
return false;
@ -2169,7 +2170,7 @@ void video_driver_frame(const void *data, unsigned width,
|| video_driver_record_gpu_buffer
) && recording_data
)
recording_dump_frame(data, width, height, pitch);
recording_dump_frame(data, width, height, pitch, video_info.runloop_is_idle);
if (data && video_driver_state_filter &&
video_driver_frame_filter(data, &video_info, width, height, pitch,

View File

@ -242,7 +242,7 @@ typedef struct video_driver
void (*viewport_info)(void *data, struct video_viewport *vp);
/* Reads out in BGR byte order (24bpp). */
bool (*read_viewport)(void *data, uint8_t *buffer);
bool (*read_viewport)(void *data, uint8_t *buffer, bool is_idle);
/* Returns a pointer to a newly allocated buffer that can
* (and must) be passed to free() by the caller, containing a
@ -305,7 +305,7 @@ void video_driver_hide_mouse(void);
void video_driver_set_nonblock_state(bool toggle);
bool video_driver_find_driver(void);
void video_driver_apply_state_changes(void);
bool video_driver_read_viewport(uint8_t *buffer);
bool video_driver_read_viewport(uint8_t *buffer, bool is_idle);
bool video_driver_cached_frame(void);
uint64_t video_driver_get_frame_count(void);
bool video_driver_frame_filter_alive(void);

View File

@ -187,6 +187,7 @@ struct thread_video
bool suppress_screensaver;
bool has_windowed;
bool nonblock;
bool is_idle;
retro_time_t last_time;
unsigned hit_count;
@ -393,7 +394,7 @@ static bool video_thread_handle_packet(
if (thr->driver->read_viewport)
ret = thr->driver->read_viewport(thr->driver_data,
(uint8_t*)pkt.data.v);
(uint8_t*)pkt.data.v, thr->is_idle);
pkt.data.b = ret;
thr->frame.within_thread = false;
@ -916,7 +917,7 @@ static void video_thread_viewport_info(void *data, struct video_viewport *vp)
slock_unlock(thr->lock);
}
static bool video_thread_read_viewport(void *data, uint8_t *buffer)
static bool video_thread_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
thread_video_t *thr = (thread_video_t*)data;
thread_packet_t pkt = { CMD_READ_VIEWPORT };
@ -924,7 +925,8 @@ static bool video_thread_read_viewport(void *data, uint8_t *buffer)
if (!thr)
return false;
pkt.data.v = buffer;
pkt.data.v = buffer;
thr->is_idle = is_idle;
video_thread_send_and_wait_user_to_thread(thr, &pkt);

View File

@ -183,7 +183,7 @@ bool record_driver_init_first(const record_driver_t **backend, void **data,
}
void recording_dump_frame(const void *data, unsigned width,
unsigned height, size_t pitch)
unsigned height, size_t pitch, bool is_idle)
{
struct ffemu_video_data ffemu_data = {0};
@ -205,7 +205,7 @@ void recording_dump_frame(const void *data, unsigned width,
msg_hash_to_str(MSG_VIEWPORT_SIZE_CALCULATION_FAILED));
command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL);
recording_dump_frame(data, width, height, pitch);
recording_dump_frame(data, width, height, pitch, is_idle);
return;
}
@ -229,7 +229,7 @@ void recording_dump_frame(const void *data, unsigned width,
/* Big bottleneck.
* Since we might need to do read-backs asynchronously,
* it might take 3-4 times before this returns true. */
if (!video_driver_read_viewport(gpu_buf))
if (!video_driver_read_viewport(gpu_buf, is_idle))
return;
ffemu_data.pitch = recording_gpu_width * 3;

View File

@ -145,7 +145,7 @@ bool record_driver_init_first(const record_driver_t **backend, void **data,
const struct ffemu_params *params);
void recording_dump_frame(const void *data, unsigned width,
unsigned height, size_t pitch);
unsigned height, size_t pitch, bool is_idle);
bool recording_deinit(void);

View File

@ -76,6 +76,7 @@ typedef struct
bool bgr24;
bool silence;
void *userbuf;
bool is_idle;
bool is_paused;
bool history_list_enable;
} screenshot_task_state_t;
@ -189,7 +190,9 @@ static bool screenshot_dump(
const void *frame,
unsigned width,
unsigned height,
int pitch, bool bgr24, void *userbuf, bool savestate,
int pitch, bool bgr24,
void *userbuf, bool savestate,
bool is_idle,
bool is_paused)
{
char screenshot_path[PATH_MAX_LENGTH];
@ -211,6 +214,7 @@ static bool screenshot_dump(
screenshot_dir = screenshot_path;
}
state->is_idle = is_idle;
state->is_paused = is_paused;
state->bgr24 = bgr24;
state->height = height;
@ -263,7 +267,7 @@ static bool screenshot_dump(
#if !defined(VITA)
static bool take_screenshot_viewport(const char *name_base, bool savestate,
bool is_paused)
bool is_idle, bool is_paused)
{
struct video_viewport vp;
uint8_t *buffer = NULL;
@ -286,13 +290,13 @@ static bool take_screenshot_viewport(const char *name_base, bool savestate,
if (!buffer)
return false;
if (!video_driver_read_viewport(buffer))
if (!video_driver_read_viewport(buffer, is_idle))
goto error;
/* Data read from viewport is in bottom-up order, suitable for BMP. */
if (!screenshot_dump(name_base,
buffer, vp.width, vp.height,
vp.width * 3, true, buffer, savestate, is_paused))
vp.width * 3, true, buffer, savestate, is_idle, is_paused))
goto error;
return true;
@ -305,7 +309,7 @@ error:
#endif
static bool take_screenshot_raw(const char *name_base, void *userbuf,
bool savestate, bool is_paused)
bool savestate, bool is_idle, bool is_paused)
{
size_t pitch;
unsigned width, height;
@ -318,7 +322,7 @@ static bool take_screenshot_raw(const char *name_base, void *userbuf,
*/
if (!screenshot_dump(name_base,
(const uint8_t*)data + (height - 1) * pitch,
width, height, -pitch, false, userbuf, savestate, is_paused))
width, height, -pitch, false, userbuf, savestate, is_idle, is_paused))
return false;
return true;
@ -347,14 +351,14 @@ static bool take_screenshot_choice(const char *name_base, bool savestate,
if (!is_idle)
video_driver_cached_frame();
#if defined(VITA)
return take_screenshot_raw(name_base, NULL, savestate, is_paused);
return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused);
#else
return take_screenshot_viewport(name_base, savestate, is_paused);
return take_screenshot_viewport(name_base, savestate, is_idle, is_paused);
#endif
}
if (!video_driver_cached_frame_has_valid_framebuffer())
return take_screenshot_raw(name_base, NULL, savestate, is_paused);
return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused);
if (!video_driver_supports_read_frame_raw())
return false;
@ -371,7 +375,7 @@ static bool take_screenshot_choice(const char *name_base, bool savestate,
if (frame_data)
{
video_driver_set_cached_frame_ptr(frame_data);
if (take_screenshot_raw(name_base, frame_data, savestate, is_paused))
if (take_screenshot_raw(name_base, frame_data, savestate, is_idle, is_paused))
ret = true;
}