Get rid of video_info struct for swap_buffers too

This commit is contained in:
twinaphex 2020-03-06 22:29:51 +01:00
parent 68664fdf1d
commit e20151a048
35 changed files with 56 additions and 87 deletions

View File

@ -73,7 +73,7 @@ static void emscripten_mainloop(void)
if ((emscripten_frame_count & 1) == 0) if ((emscripten_frame_count & 1) == 0)
{ {
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
video_info.cb_swap_buffers(video_info.context_data, &video_info); video_info.cb_swap_buffers(video_info.context_data);
return; return;
} }
} }

View File

@ -3103,12 +3103,12 @@ static bool gl2_frame(void *data, const void *frame,
&& !video_info->runloop_is_slowmotion && !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused) && !video_info->runloop_is_paused)
{ {
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
#endif #endif
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
/* check if we are fast forwarding or in menu, if we are ignore hard sync */ /* check if we are fast forwarding or in menu, if we are ignore hard sync */
if ( gl->have_sync if ( gl->have_sync

View File

@ -910,12 +910,12 @@ static bool gl1_gfx_frame(void *data, const void *frame,
&& !video_info->runloop_is_slowmotion && !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused) && !video_info->runloop_is_paused)
{ {
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
#endif #endif
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
/* check if we are fast forwarding or in menu, if we are ignore hard sync */ /* check if we are fast forwarding or in menu, if we are ignore hard sync */
if (video_info->hard_sync if (video_info->hard_sync

View File

@ -1965,11 +1965,11 @@ static bool gl_core_frame(void *data, const void *frame,
&& !video_info->runloop_is_slowmotion && !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused) && !video_info->runloop_is_paused)
{ {
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
if (video_info->hard_sync && if (video_info->hard_sync &&
!video_info->input_driver_nonblock_state && !video_info->input_driver_nonblock_state &&

View File

@ -454,8 +454,7 @@ static bool vg_frame(void *data, const void *frame,
video_info->cb_update_window_title( video_info->cb_update_window_title(
video_info->context_data); video_info->context_data);
video_info->cb_swap_buffers( video_info->cb_swap_buffers(video_info->context_data);
video_info->context_data, video_info);
return true; return true;
} }

View File

@ -1658,7 +1658,7 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
slock_unlock(vk->context->queue_lock); slock_unlock(vk->context->queue_lock);
#endif #endif
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
} }
static bool vulkan_frame(void *data, const void *frame, static bool vulkan_frame(void *data, const void *frame,
@ -2106,7 +2106,7 @@ static bool vulkan_frame(void *data, const void *frame,
slock_unlock(vk->context->queue_lock); slock_unlock(vk->context->queue_lock);
#endif #endif
video_info->cb_swap_buffers(video_info->context_data, video_info); video_info->cb_swap_buffers(video_info->context_data);
if (!vk->context->swap_interval_emulation_lock) if (!vk->context->swap_interval_emulation_lock)
video_info->cb_update_window_title( video_info->cb_update_window_title(

View File

@ -510,7 +510,7 @@ dpi_fallback:
return true; return true;
} }
static void android_gfx_ctx_swap_buffers(void *data, void *data2) static void android_gfx_ctx_swap_buffers(void *data)
{ {
android_ctx_data_t *and = (android_ctx_data_t*)data; android_ctx_data_t *and = (android_ctx_data_t*)data;

View File

@ -97,7 +97,7 @@ static void gfx_ctx_cgl_check_window(void *data, bool *quit,
} }
} }
static void gfx_ctx_cgl_swap_buffers(void *data, void *data2) static void gfx_ctx_cgl_swap_buffers(void *data)
{ {
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data; gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data;

View File

@ -616,7 +616,7 @@ static void cocoagl_gfx_ctx_swap_interval(void *data, int i)
} }
} }
static void cocoagl_gfx_ctx_swap_buffers(void *data, void *data2) static void cocoagl_gfx_ctx_swap_buffers(void *data)
{ {
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;

View File

@ -245,10 +245,9 @@ static void gfx_ctx_drm_check_window(void *data, bool *quit,
} }
#ifdef HAVE_ODROIDGO2 #ifdef HAVE_ODROIDGO2
static void gfx_ctx_drm_swap_buffers(void *data, void *data2) static void gfx_ctx_drm_swap_buffers(void *data)
{ {
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data; gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
video_frame_info_t *video_info = (video_frame_info_t*)data2;
switch (drm_api) switch (drm_api)
{ {
@ -273,10 +272,11 @@ static void gfx_ctx_drm_swap_buffers(void *data, void *data2)
} }
} }
#else #else
static void gfx_ctx_drm_swap_buffers(void *data, void *data2) static void gfx_ctx_drm_swap_buffers(void *data)
{ {
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data; gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
video_frame_info_t *video_info = (video_frame_info_t*)data2; settings_t *settings = config_get_ptr();
unsigned max_swapchain_images = settings->uints.video_max_swapchain_images;
switch (drm_api) switch (drm_api)
{ {
@ -302,7 +302,7 @@ static void gfx_ctx_drm_swap_buffers(void *data, void *data2)
waiting_for_flip = gfx_ctx_drm_queue_flip(); waiting_for_flip = gfx_ctx_drm_queue_flip();
/* Triple-buffered page flips */ /* Triple-buffered page flips */
if (video_info->max_swapchain_images >= 3 && if (max_swapchain_images >= 3 &&
gbm_surface_has_free_buffers(g_gbm_surface)) gbm_surface_has_free_buffers(g_gbm_surface))
return; return;

View File

@ -135,12 +135,12 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
*quit = false; *quit = false;
} }
static void gfx_ctx_emscripten_swap_buffers(void *data, void *data2) static void gfx_ctx_emscripten_swap_buffers(void *data)
{ {
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data; emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
/* doesn't really do anything in WebGL, but it might if we use WebGL workers /* doesn't really do anything in WebGL, but it might
* in the future */ * if we use WebGL workers in the future */
#ifdef HAVE_EGL #ifdef HAVE_EGL
egl_swap_buffers(&emscripten->egl); egl_swap_buffers(&emscripten->egl);
#endif #endif

View File

@ -159,11 +159,6 @@ static uint32_t gfx_ctx_fpga_get_flags(void *data)
return flags; return flags;
} }
static void gfx_ctx_fpga_swap_buffers(void *data, void *data2)
{
(void)data;
}
const gfx_ctx_driver_t gfx_ctx_fpga = { const gfx_ctx_driver_t gfx_ctx_fpga = {
gfx_ctx_fpga_init, gfx_ctx_fpga_init,
gfx_ctx_fpga_destroy, gfx_ctx_fpga_destroy,
@ -182,7 +177,7 @@ const gfx_ctx_driver_t gfx_ctx_fpga = {
gfx_ctx_fpga_has_focus, gfx_ctx_fpga_has_focus,
gfx_ctx_fpga_suppress_screensaver, gfx_ctx_fpga_suppress_screensaver,
gfx_ctx_fpga_has_windowed, gfx_ctx_fpga_has_windowed,
gfx_ctx_fpga_swap_buffers, NULL, /* swap_buffers */
gfx_ctx_fpga_input_driver, gfx_ctx_fpga_input_driver,
NULL, NULL,
NULL, NULL,

View File

@ -246,10 +246,8 @@ static uint32_t gfx_ctx_gdi_get_flags(void *data)
return flags; return flags;
} }
static void gfx_ctx_gdi_swap_buffers(void *data, void *data2) static void gfx_ctx_gdi_swap_buffers(void *data)
{ {
(void)data;
SwapBuffers(win32_gdi_hdc); SwapBuffers(win32_gdi_hdc);
} }

View File

@ -34,11 +34,6 @@ static void gfx_ctx_null_check_window(void *data, bool *quit,
(void)resize; (void)resize;
} }
static void gfx_ctx_null_swap_buffers(void *data, void *data2)
{
(void)data;
}
static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height) static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height)
{ {
(void)data; (void)data;
@ -157,7 +152,7 @@ const gfx_ctx_driver_t gfx_ctx_null = {
gfx_ctx_null_has_focus, gfx_ctx_null_has_focus,
gfx_ctx_null_suppress_screensaver, gfx_ctx_null_suppress_screensaver,
false, /* has_windowed */ false, /* has_windowed */
gfx_ctx_null_swap_buffers, NULL, /* swap_buffers */
gfx_ctx_null_input_driver, gfx_ctx_null_input_driver,
NULL, NULL,
NULL, NULL,

View File

@ -242,7 +242,7 @@ static void gfx_ctx_khr_display_set_swap_interval(void *data,
} }
} }
static void gfx_ctx_khr_display_swap_buffers(void *data, void *data2) static void gfx_ctx_khr_display_swap_buffers(void *data)
{ {
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data; khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index); vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index);

View File

@ -253,7 +253,7 @@ static void gfx_ctx_mali_fbdev_set_swap_interval(void *data,
#endif #endif
} }
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, void *data2) static void gfx_ctx_mali_fbdev_swap_buffers(void *data)
{ {
mali_ctx_data_t *mali = (mali_ctx_data_t*)data; mali_ctx_data_t *mali = (mali_ctx_data_t*)data;

View File

@ -147,7 +147,7 @@ static uint32_t gfx_ctx_network_get_flags(void *data)
return flags; return flags;
} }
static void gfx_ctx_network_swap_buffers(void *data, void *data2) static void gfx_ctx_network_swap_buffers(void *data)
{ {
(void)data; (void)data;
} }

View File

@ -211,7 +211,7 @@ static bool gfx_ctx_opendingux_suppress_screensaver(void *data, bool enable)
return false; return false;
} }
static void gfx_ctx_opendingux_swap_buffers(void *data, void *data2) static void gfx_ctx_opendingux_swap_buffers(void *data)
{ {
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data; opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;

View File

@ -233,7 +233,7 @@ static void orbis_ctx_set_swap_interval(void *data,
#endif #endif
} }
static void orbis_ctx_swap_buffers(void *data, void *data2) static void orbis_ctx_swap_buffers(void *data)
{ {
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;

View File

@ -340,7 +340,7 @@ static bool osmesa_ctx_suppress_screensaver(void *data, bool enable)
return false; return false;
} }
static void osmesa_ctx_swap_buffers(void *data, void *data2) static void osmesa_ctx_swap_buffers(void *data)
{ {
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data; gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
osmesa_fifo_accept(osmesa); osmesa_fifo_accept(osmesa);

View File

@ -173,7 +173,7 @@ static bool gfx_ctx_ps3_suppress_screensaver(void *data, bool enable)
return false; return false;
} }
static void gfx_ctx_ps3_swap_buffers(void *data, void *data2) static void gfx_ctx_ps3_swap_buffers(void *data)
{ {
(void)data; (void)data;
#ifdef HAVE_PSGL #ifdef HAVE_PSGL

View File

@ -413,7 +413,7 @@ static void gfx_ctx_qnx_set_swap_interval(void *data, int swap_interval)
#endif #endif
} }
static void gfx_ctx_qnx_swap_buffers(void *data, void *data2) static void gfx_ctx_qnx_swap_buffers(void *data)
{ {
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data; qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;

View File

@ -375,7 +375,7 @@ static bool sdl_ctx_suppress_screensaver(void *data, bool enable)
return false; return false;
} }
static void sdl_ctx_swap_buffers(void *data, void *data2) static void sdl_ctx_swap_buffers(void *data)
{ {
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;

View File

@ -147,11 +147,6 @@ static uint32_t gfx_ctx_sixel_get_flags(void *data)
return flags; return flags;
} }
static void gfx_ctx_sixel_swap_buffers(void *data, void *data2)
{
(void)data;
}
const gfx_ctx_driver_t gfx_ctx_sixel = { const gfx_ctx_driver_t gfx_ctx_sixel = {
gfx_ctx_sixel_init, gfx_ctx_sixel_init,
gfx_ctx_sixel_destroy, gfx_ctx_sixel_destroy,
@ -172,7 +167,7 @@ const gfx_ctx_driver_t gfx_ctx_sixel = {
gfx_ctx_sixel_has_focus, gfx_ctx_sixel_has_focus,
gfx_ctx_sixel_suppress_screensaver, gfx_ctx_sixel_suppress_screensaver,
true, /* has_windowed */ true, /* has_windowed */
gfx_ctx_sixel_swap_buffers, NULL, /* swap_buffers */
gfx_ctx_sixel_input_driver, gfx_ctx_sixel_input_driver,
NULL, NULL,
NULL, NULL,

View File

@ -240,9 +240,9 @@ static void switch_ctx_set_swap_interval(void *data,
#endif #endif
} }
static void switch_ctx_swap_buffers(void *data, void *data2) static void switch_ctx_swap_buffers(void *data)
{ {
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; switch_ctx_data_t *ctx_nx = (switch_ctx_data_t*)data;
#ifdef HAVE_EGL #ifdef HAVE_EGL
egl_swap_buffers(&ctx_nx->egl); egl_swap_buffers(&ctx_nx->egl);

View File

@ -154,18 +154,16 @@ static gfx_ctx_proc_t gfx_ctx_uwp_get_proc_address(const char* symbol)
} }
static void gfx_ctx_uwp_swap_buffers(void *data, void *data2) static void gfx_ctx_uwp_swap_buffers(void *data)
{ {
(void)data;
switch (uwp_api) switch (uwp_api)
{ {
case GFX_CTX_OPENGL_ES_API: case GFX_CTX_OPENGL_ES_API:
egl_swap_buffers(&uwp_egl); egl_swap_buffers(&uwp_egl);
break; break;
case GFX_CTX_NONE: case GFX_CTX_NONE:
default: default:
break; break;
} }
} }

View File

@ -194,18 +194,6 @@ static void *gfx_ctx_vc_init(video_frame_info_t *video_info, void *video_driver)
if (!vc) if (!vc)
return NULL; return NULL;
/* If we set this env variable, Broadcom's EGL implementation will block
* on vsync with a double buffer when we call eglSwapBuffers. Less input lag!
* Has to be done before any EGL call.
* NOTE this is commented out because it should be the right way to do it, but
* currently it doesn't work, so we are using an vsync callback based solution.*/
#if 0
if (video_info->max_swapchain_images <= 2)
setenv("V3D_DOUBLE_BUFFER", "1", 1);
else
setenv("V3D_DOUBLE_BUFFER", "0", 1);
#endif
bcm_host_init(); bcm_host_init();
#ifdef HAVE_EGL #ifdef HAVE_EGL
@ -648,11 +636,12 @@ error:
return false; return false;
} }
static void gfx_ctx_vc_swap_buffers(void *data, void *data2) static void gfx_ctx_vc_swap_buffers(void *data)
{ {
#ifdef HAVE_EGL #ifdef HAVE_EGL
vc_ctx_data_t *vc = (vc_ctx_data_t*)data; vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
video_frame_info_t *video_info = (video_frame_info_t*)data2; settings_t *settings = config_get_ptr();
unsigned max_swapchain_images = settings->uints.video_max_swapchain_images;
if (!vc) if (!vc)
return; return;
@ -661,7 +650,7 @@ static void gfx_ctx_vc_swap_buffers(void *data, void *data2)
/* Wait for vsync immediately if we don't /* Wait for vsync immediately if we don't
* want egl_swap_buffers to triple-buffer */ * want egl_swap_buffers to triple-buffer */
if (video_info->max_swapchain_images <= 2) if (max_swapchain_images <= 2)
{ {
/* We DON'T wait to wait without callback function ready! */ /* We DON'T wait to wait without callback function ready! */
if (!vc->vsync_callback_set) if (!vc->vsync_callback_set)

View File

@ -48,7 +48,7 @@ static void vita_check_window(void *data, bool *quit,
*quit = (bool)false; *quit = (bool)false;
} }
static void vita_swap_buffers(void *data, void *data2) static void vita_swap_buffers(void *data)
{ {
(void)data; (void)data;
vglStopRendering(); vglStopRendering();

View File

@ -225,7 +225,7 @@ static void gfx_ctx_vivante_set_swap_interval(void *data, int swap_interval)
#endif #endif
} }
static void gfx_ctx_vivante_swap_buffers(void *data, void *data2) static void gfx_ctx_vivante_swap_buffers(void *data)
{ {
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;

View File

@ -1816,7 +1816,7 @@ static void *gfx_ctx_wl_get_context_data(void *data)
} }
#endif #endif
static void gfx_ctx_wl_swap_buffers(void *data, void *data2) static void gfx_ctx_wl_swap_buffers(void *data)
{ {
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

View File

@ -536,7 +536,7 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit,
} }
} }
static void gfx_ctx_wgl_swap_buffers(void *data, void *data2) static void gfx_ctx_wgl_swap_buffers(void *data)
{ {
(void)data; (void)data;

View File

@ -354,7 +354,7 @@ static void gfx_ctx_x_swap_interval(void *data, int interval)
} }
} }
static void gfx_ctx_x_swap_buffers(void *data, void *data2) static void gfx_ctx_x_swap_buffers(void *data)
{ {
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data; gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;

View File

@ -520,7 +520,7 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state)
x11_show_mouse(g_x11_dpy, g_x11_win, state); x11_show_mouse(g_x11_dpy, g_x11_win, state);
} }
static void gfx_ctx_xegl_swap_buffers(void *data, void *data2) static void gfx_ctx_xegl_swap_buffers(void *data)
{ {
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data; xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;

View File

@ -21772,7 +21772,7 @@ bool video_driver_started_fullscreen(void)
/* Stub functions */ /* Stub functions */
static void update_window_title_null(void *data) { } static void update_window_title_null(void *data) { }
static void swap_buffers_null(void *data, void *data2) { } static void swap_buffers_null(void *data) { }
static bool get_metrics_null(void *data, enum display_metric_types type, static bool get_metrics_null(void *data, enum display_metric_types type,
float *value) { return false; } float *value) { return false; }
static bool set_resize_null(void *a, unsigned b, unsigned c) { return false; } static bool set_resize_null(void *a, unsigned b, unsigned c) { return false; }

View File

@ -1188,7 +1188,7 @@ typedef struct video_frame_info
} osd_stat_params; } osd_stat_params;
void (*cb_update_window_title)(void*); void (*cb_update_window_title)(void*);
void (*cb_swap_buffers)(void*, void *); void (*cb_swap_buffers)(void*);
bool (*cb_get_metrics)(void *data, enum display_metric_types type, bool (*cb_get_metrics)(void *data, enum display_metric_types type,
float *value); float *value);
bool (*cb_set_resize)(void*, unsigned, unsigned); bool (*cb_set_resize)(void*, unsigned, unsigned);
@ -1268,7 +1268,7 @@ typedef struct gfx_ctx_driver
/* Swaps buffers. VBlank sync depends on /* Swaps buffers. VBlank sync depends on
* earlier calls to swap_interval. */ * earlier calls to swap_interval. */
void (*swap_buffers)(void*, void *); void (*swap_buffers)(void*);
/* Most video backends will want to use a certain input driver. /* Most video backends will want to use a certain input driver.
* Checks for it here. */ * Checks for it here. */