Pass video_info to swap_buffers too

This commit is contained in:
twinaphex 2017-01-09 14:59:15 +01:00
parent 3d92ce140e
commit 6b3cc9068d
29 changed files with 44 additions and 52 deletions

View File

@ -1465,7 +1465,7 @@ static bool d3d_frame(void *data, const void *frame,
performance_counter_stop(&d3d_frame);
video_context_driver_swap_buffers();
video_context_driver_swap_buffers(video_info);
return true;
}

View File

@ -1331,11 +1331,11 @@ static bool gl_frame(void *data, const void *frame,
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
{
video_context_driver_swap_buffers();
video_context_driver_swap_buffers(video_info);
glClear(GL_COLOR_BUFFER_BIT);
}
video_context_driver_swap_buffers();
video_context_driver_swap_buffers(video_info);
#ifdef HAVE_GL_SYNC
if (video_info.hard_sync && gl->have_sync)

View File

@ -428,7 +428,7 @@ static bool vg_frame(void *data, const void *frame,
performance_counter_stop(&vg_fr);
video_context_driver_swap_buffers();
video_context_driver_swap_buffers(video_info);
return true;
}

View File

@ -1464,7 +1464,7 @@ static void vulkan_readback(vk_t *vk)
VK_PIPELINE_STAGE_HOST_BIT);
}
static void vulkan_inject_black_frame(vk_t *vk)
static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info)
{
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
@ -1515,7 +1515,7 @@ static void vulkan_inject_black_frame(vk_t *vk)
slock_unlock(vk->context->queue_lock);
#endif
video_context_driver_swap_buffers();
video_context_driver_swap_buffers(video_info);
}
static bool vulkan_frame(void *data, const void *frame,
@ -1910,7 +1910,7 @@ static bool vulkan_frame(void *data, const void *frame,
performance_counter_stop(&queue_submit);
performance_counter_start(&swapbuffers);
video_context_driver_swap_buffers();
video_context_driver_swap_buffers(video_info);
performance_counter_stop(&swapbuffers);
if (!vk->context->swap_interval_emulation_lock)
@ -1937,7 +1937,7 @@ static bool vulkan_frame(void *data, const void *frame,
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
{
vulkan_inject_black_frame(vk);
vulkan_inject_black_frame(vk, video_info);
}
/* Vulkan doesn't directly support swap_interval > 1, so we fake it by duping out more frames. */

View File

@ -37,7 +37,6 @@
#endif
#include "../../frontend/drivers/platform_linux.h"
#include "../../configuration.h"
#include "../../runloop.h"
static enum gfx_ctx_api android_api = GFX_CTX_NONE;
@ -492,7 +491,7 @@ dpi_fallback:
return true;
}
static void android_gfx_ctx_swap_buffers(void *data)
static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info)
{
android_ctx_data_t *and = (android_ctx_data_t*)data;

View File

@ -42,7 +42,6 @@
#include "../common/gl_common.h"
#endif
#include "../../configuration.h"
#include "../../runloop.h"
#define WINDOW_BUFFERS 2
@ -363,7 +362,7 @@ static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned swap_interval)
#endif
}
static void gfx_ctx_qnx_swap_buffers(void *data)
static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t video_info)
{
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;

View File

@ -29,9 +29,7 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../configuration.h"
#include "../video_context_driver.h"
typedef int CGSConnectionID;
@ -97,7 +95,7 @@ static void gfx_ctx_cgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_cgl_swap_buffers(void *data)
static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t video_info)
{
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data;

View File

@ -536,7 +536,7 @@ static bool cocoagl_gfx_ctx_has_windowed(void *data)
#endif
}
static void cocoagl_gfx_ctx_swap_buffers(void *data)
static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info)
{
if (!(--g_fast_forward_skips < 0))
return;

View File

@ -29,7 +29,6 @@
#include "../drivers/d3d.h"
#include "../common/win32_common.h"
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../../ui/ui_companion_driver.h"
@ -77,7 +76,7 @@ static bool gfx_ctx_d3d_set_resize(void *data, unsigned new_width, unsigned new_
return true;
}
static void gfx_ctx_d3d_swap_buffers(void *data)
static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;

View File

@ -226,10 +226,9 @@ static bool gfx_ctx_drm_queue_flip(void)
return false;
}
static void gfx_ctx_drm_swap_buffers(void *data)
static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info)
{
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
settings_t *settings = config_get_ptr();
switch (drm_api)
{
@ -255,7 +254,7 @@ static void gfx_ctx_drm_swap_buffers(void *data)
waiting_for_flip = gfx_ctx_drm_queue_flip();
/* Triple-buffered page flips */
if (settings->video.max_swapchain_images >= 3 &&
if (video_info.max_swapchain_images >= 3 &&
gbm_surface_has_free_buffers(g_gbm_surface))
return;

View File

@ -24,7 +24,6 @@
#include "../../config.h"
#endif
#include "../../configuration.h"
#include "../../runloop.h"
#include "../video_context_driver.h"
@ -36,10 +35,6 @@
#include "../common/gl_common.h"
#endif
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
typedef struct
{
#ifdef HAVE_EGL
@ -80,7 +75,7 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
*quit = false;
}
static void gfx_ctx_emscripten_swap_buffers(void *data)
static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t video_info)
{
(void)data;
/* no-op in emscripten, no way to force swap/wait for VSync in browsers */

View File

@ -35,7 +35,7 @@ static void gfx_ctx_null_check_window(void *data, bool *quit,
(void)resize;
}
static void gfx_ctx_null_swap_buffers(void *data)
static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t video_info)
{
(void)data;
}

View File

@ -17,7 +17,6 @@
#include "../../config.h"
#endif
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../frontend/frontend_driver.h"
#include "../common/vulkan_common.h"
@ -201,7 +200,7 @@ static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_inte
}
}
static void gfx_ctx_khr_display_swap_buffers(void *data)
static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t video_info)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index);

View File

@ -37,7 +37,6 @@
#endif
#include "../../frontend/frontend_driver.h"
#include "../../configuration.h"
#include "../../runloop.h"
typedef struct
@ -269,7 +268,7 @@ static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_inter
#endif
}
static void gfx_ctx_mali_fbdev_swap_buffers(void *data)
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t video_info)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;

View File

@ -29,7 +29,6 @@
#endif
#include "../../frontend/frontend_driver.h"
#include "../../configuration.h"
#include "../../runloop.h"
typedef struct
@ -232,7 +231,7 @@ static bool gfx_ctx_opendingux_has_windowed(void *data)
return false;
}
static void gfx_ctx_opendingux_swap_buffers(void *data)
static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t video_info)
{
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;

View File

@ -361,7 +361,7 @@ static bool osmesa_ctx_has_windowed(void *data)
return true;
}
static void osmesa_ctx_swap_buffers(void *data)
static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t video_info)
{
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
osmesa_fifo_accept(osmesa);

View File

@ -16,6 +16,10 @@
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef __PSL1GHT__
#include <sys/spu_initialize.h>
#endif
@ -31,10 +35,6 @@
#include "../common/gl_common.h"
#include "../video_context_driver.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
typedef struct gfx_ctx_ps3_data
{
#if defined(HAVE_PSGL)
@ -178,7 +178,7 @@ static bool gfx_ctx_ps3_has_windowed(void *data)
return false;
}
static void gfx_ctx_ps3_swap_buffers(void *data)
static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t video_info)
{
(void)data;
#ifdef HAVE_LIBDBGFONT

View File

@ -378,7 +378,7 @@ static bool sdl_ctx_has_windowed(void *data)
return true;
}
static void sdl_ctx_swap_buffers(void *data)
static void sdl_ctx_swap_buffers(void *data, video_frame_info_t video_info)
{
#ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;

View File

@ -607,7 +607,7 @@ error:
return false;
}
static void gfx_ctx_vc_swap_buffers(void *data)
static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t video_info)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;

View File

@ -28,7 +28,6 @@
#include "../common/gl_common.h"
#endif
#include "../../configuration.h"
#include "../../frontend/frontend_driver.h"
#include "../../runloop.h"
@ -246,7 +245,7 @@ static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval
#endif
}
static void gfx_ctx_vivante_swap_buffers(void *data)
static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t video_info)
{
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;

View File

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

View File

@ -39,7 +39,6 @@
#include "../../config.h"
#endif
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../../runloop.h"
#include "../video_context_driver.h"
@ -331,7 +330,7 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_wgl_swap_buffers(void *data)
static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t video_info)
{
(void)data;

View File

@ -250,7 +250,7 @@ static void gfx_ctx_x_swap_interval(void *data, unsigned interval)
}
}
static void gfx_ctx_x_swap_buffers(void *data)
static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t video_info)
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
@ -570,6 +570,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
video_info.hard_sync = settings->video.hard_sync;
video_info.hard_sync_frames = settings->video.hard_sync_frames;
video_info.fps_show = settings->fps_show;
video_info.max_swapchain_images = settings->video.max_swapchain_images;
x11_set_window_attr(g_x11_dpy, g_x11_win);
x11_update_window_title(NULL, video_info);

View File

@ -362,6 +362,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
video_info.hard_sync = settings->video.hard_sync;
video_info.hard_sync_frames = settings->video.hard_sync_frames;
video_info.fps_show = settings->fps_show;
video_info.max_swapchain_images = settings->video.max_swapchain_images;
x11_set_window_attr(g_x11_dpy, g_x11_win);
x11_update_window_title(NULL, video_info);
@ -503,7 +504,7 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state)
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_xegl_swap_buffers(void *data)
static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t video_info)
{
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;

View File

@ -122,7 +122,7 @@ typedef struct gfx_ctx_driver
/* Swaps buffers. VBlank sync depends on
* earlier calls to swap_interval. */
void (*swap_buffers)(void*);
void (*swap_buffers)(void*, video_frame_info_t video_info);
/* Most video backends will want to use a certain input driver.
* Checks for it here. */
@ -294,9 +294,9 @@ void video_context_driver_destroy(void);
if (current_video_context && current_video_context->update_window_title) \
current_video_context->update_window_title(video_context_data, video_info)
#define video_context_driver_swap_buffers() \
#define video_context_driver_swap_buffers(video_info) \
if (current_video_context && current_video_context->swap_buffers) \
current_video_context->swap_buffers(video_context_data)
current_video_context->swap_buffers(video_context_data, video_info)
#define video_context_driver_focus() ((video_context_data && current_video_context->has_focus && current_video_context->has_focus(video_context_data)) ? true : false)

View File

@ -2112,6 +2112,7 @@ void video_driver_frame(const void *data, unsigned width,
video_info.hard_sync = settings->video.hard_sync;
video_info.hard_sync_frames = settings->video.hard_sync_frames;
video_info.fps_show = settings->fps_show;
video_info.max_swapchain_images = settings->video.max_swapchain_images;
if (!current_video || !current_video->frame(
video_driver_data, data, width, height,

View File

@ -88,6 +88,7 @@ typedef struct video_frame_info
bool hard_sync;
unsigned hard_sync_frames;
bool fps_show;
unsigned max_swapchain_images;
} video_frame_info_t;
/* Optionally implemented interface to poke more

View File

@ -622,6 +622,7 @@ static void video_thread_loop(void *data)
video_info.hard_sync = settings->video.hard_sync;
video_info.hard_sync_frames = settings->video.hard_sync_frames;
video_info.fps_show = settings->fps_show;
video_info.max_swapchain_images = settings->video.max_swapchain_images;
ret = thr->driver->frame(thr->driver_data,
thr->frame.buffer, thr->frame.width, thr->frame.height,

View File

@ -17,6 +17,9 @@
#ifndef __RETROARCH_RUNLOOP_H
#define __RETROARCH_RUNLOOP_H
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_common_api.h>