Add parameter to video_context_driver's 'init' function

This commit is contained in:
twinaphex 2017-01-13 16:52:07 +01:00
parent fad63aa036
commit 1fa3475d79
24 changed files with 30 additions and 24 deletions

View File

@ -101,7 +101,7 @@ static void android_gfx_ctx_destroy(void *data)
free(data);
}
static void *android_gfx_ctx_init(void *video_driver)
static void *android_gfx_ctx_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_OPENGLES
EGLint n, major, minor;

View File

@ -303,7 +303,7 @@ static CGSSurfaceID attach_gl_context_to_window(CGLContextObj glCtx,
return sid;
}
static void *gfx_ctx_cgl_init(void *video_driver)
static void *gfx_ctx_cgl_init(video_frame_info_t video_info, void *video_driver)
{
CGError err;
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)calloc(1, sizeof(gfx_ctx_cgl_data_t));

View File

@ -213,7 +213,7 @@ void cocoagl_gfx_ctx_update(void)
#endif
}
static void *cocoagl_gfx_ctx_init(void *video_driver)
static void *cocoagl_gfx_ctx_init(video_frame_info_t video_info, void *video_driver)
{
(void)video_driver;

View File

@ -169,7 +169,7 @@ static bool gfx_ctx_d3d_bind_api(void *data,
#endif
}
static void *gfx_ctx_d3d_init(void *video_driver)
static void *gfx_ctx_d3d_init(video_frame_info_t video_info, void *video_driver)
{
win32_monitor_init();

View File

@ -356,7 +356,7 @@ static void gfx_ctx_drm_destroy_resources(gfx_ctx_drm_data_t *drm)
g_next_bo = NULL;
}
static void *gfx_ctx_drm_init(void *video_driver)
static void *gfx_ctx_drm_init(video_frame_info_t video_info, void *video_driver)
{
int fd, i;
unsigned monitor_index;

View File

@ -121,7 +121,7 @@ static void gfx_ctx_emscripten_destroy(void *data)
free(data);
}
static void *gfx_ctx_emscripten_init(void *video_driver)
static void *gfx_ctx_emscripten_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
unsigned width, height;

View File

@ -127,7 +127,7 @@ static void gfx_ctx_null_bind_hw_render(void *data, bool enable)
(void)enable;
}
static void *gfx_ctx_null_init(void *video_driver)
static void *gfx_ctx_null_init(video_frame_info_t video_info, void *video_driver)
{
(void)video_driver;

View File

@ -52,7 +52,7 @@ static void gfx_ctx_khr_display_get_video_size(void *data,
*height = khr->height;
}
static void *gfx_ctx_khr_display_init(void *video_driver)
static void *gfx_ctx_khr_display_init(video_frame_info_t video_info, void *video_driver)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)calloc(1, sizeof(*khr));
if (!khr)

View File

@ -87,7 +87,7 @@ static void gfx_ctx_mali_fbdev_get_video_size(void *data,
*height = mali->height;
}
static void *gfx_ctx_mali_fbdev_init(void *video_driver)
static void *gfx_ctx_mali_fbdev_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
EGLint n;

View File

@ -56,7 +56,7 @@ static void gfx_ctx_opendingux_destroy(void *data)
}
}
static void *gfx_ctx_opendingux_init(void *video_driver)
static void *gfx_ctx_opendingux_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
EGLint n;

View File

@ -140,7 +140,7 @@ static void osmesa_fifo_write(gfx_ctx_osmesa_data_t *osmesa)
}
}
static void *osmesa_ctx_init(void *video_driver)
static void *osmesa_ctx_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_OSMESA_CREATE_CONTEXT_ATTRIBS
const int attribs[] = {

View File

@ -225,7 +225,7 @@ static void gfx_ctx_ps3_get_video_size(void *data,
#endif
}
static void *gfx_ctx_ps3_init(void *video_driver)
static void *gfx_ctx_ps3_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_PSGL
PSGLdeviceParameters params;

View File

@ -72,7 +72,7 @@ static void gfx_ctx_qnx_destroy(void *data)
free(data);
}
static void *gfx_ctx_qnx_init(void *video_driver)
static void *gfx_ctx_qnx_init(video_frame_info_t video_info, void *video_driver)
{
EGLint n;
EGLint major, minor;

View File

@ -73,7 +73,7 @@ static void sdl_ctx_destroy_resources(gfx_ctx_sdl_data_t *sdl)
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
static void *sdl_ctx_init(void *video_driver)
static void *sdl_ctx_init(video_frame_info_t video_info, void *video_driver)
{
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)
calloc(1, sizeof(gfx_ctx_sdl_data_t));

View File

@ -157,7 +157,7 @@ static void gfx_ctx_vc_get_video_size(void *data,
static void gfx_ctx_vc_destroy(void *data);
static void *gfx_ctx_vc_init(void *video_driver)
static void *gfx_ctx_vc_init(video_frame_info_t video_info, void *video_driver)
{
VC_DISPMANX_ALPHA_T alpha;
EGLint n, major, minor;

View File

@ -58,7 +58,7 @@ static void gfx_ctx_vivante_destroy(void *data)
}
static void *gfx_ctx_vivante_init(void *video_driver)
static void *gfx_ctx_vivante_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
EGLint n;

View File

@ -780,7 +780,7 @@ static bool gfx_ctx_wl_get_metrics(void *data,
EGL_DEPTH_SIZE, 0
#endif
static void *gfx_ctx_wl_init(void *video_driver)
static void *gfx_ctx_wl_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_OPENGL
static const EGLint egl_attribs_gl[] = {

View File

@ -426,7 +426,7 @@ static void gfx_ctx_wgl_get_video_size(void *data,
}
}
static void *gfx_ctx_wgl_init(void *video_driver)
static void *gfx_ctx_wgl_init(video_frame_info_t video_info, void *video_driver)
{
WNDCLASSEX wndclass = {0};

View File

@ -332,7 +332,7 @@ static bool gfx_ctx_x_set_resize(void *data,
return false;
}
static void *gfx_ctx_x_init(void *data)
static void *gfx_ctx_x_init(video_frame_info_t video_info, void *data)
{
int nelements = 0;
int major = 0;

View File

@ -101,7 +101,7 @@ static bool gfx_ctx_xegl_set_resize(void *data,
return false;
}
static void *gfx_ctx_xegl_init(void *video_driver)
static void *gfx_ctx_xegl_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
static const EGLint egl_attribs_gl[] = {

View File

@ -183,15 +183,19 @@ static const gfx_ctx_driver_t *video_context_driver_init(
{
if (ctx->bind_api(data, api, major, minor))
{
settings_t *settings = config_get_ptr();
void *ctx_data = ctx->init(data);
video_frame_info_t video_info;
void *ctx_data = NULL;
video_driver_build_info(&video_info);
ctx_data = ctx->init(video_info, data);
if (!ctx_data)
return NULL;
if (ctx->bind_hw_render)
ctx->bind_hw_render(ctx_data,
settings->video.shared_context && hw_render_ctx);
video_info.shared_context && hw_render_ctx);
video_context_driver_set_data(ctx_data);
return ctx;

View File

@ -66,7 +66,7 @@ typedef struct gfx_ctx_driver
* to hold a pointer to it as the context never outlives the video driver.
*
* The context driver is responsible for it's own data.*/
void* (*init)(void *video_driver);
void* (*init)(video_frame_info_t video_info, void *video_driver);
void (*destroy)(void *data);
/* Which API to bind to. */

View File

@ -2205,6 +2205,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->max_swapchain_images = settings->video.max_swapchain_images;
video_info->windowed_fullscreen = settings->video.windowed_fullscreen;
video_info->monitor_index = settings->video.monitor_index;
video_info->shared_context = settings->video.shared_context;
}
/**

View File

@ -88,6 +88,7 @@ typedef struct video_info
typedef struct video_frame_info
{
float refresh_rate;
bool shared_context;
bool black_frame_insertion;
bool hard_sync;
unsigned hard_sync_frames;