diff --git a/driver.c b/driver.c index 5c1f197481..0e89186eb2 100644 --- a/driver.c +++ b/driver.c @@ -384,7 +384,7 @@ void init_drivers(int flags) video_monitor_reset(); - init_video(); + video_driver_ctl(RARCH_DISPLAY_CTL_INIT, NULL); if (!driver->video_cache_context_ack && hw_render->context_reset) @@ -464,7 +464,7 @@ void uninit_drivers(int flags) uninit_audio(); if (flags & DRIVERS_VIDEO_INPUT) - uninit_video_input(); + video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT, NULL); if (flags & DRIVER_VIDEO) { diff --git a/gfx/video_driver.c b/gfx/video_driver.c index ac5f411ff7..584736cf09 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -399,7 +399,7 @@ static void video_driver_unset_callback(void) hw_render = NULL; } -void uninit_video_input(void) +static bool uninit_video_input(void) { driver_t *driver = driver_get_ptr(); @@ -425,9 +425,11 @@ void uninit_video_input(void) video_driver_unset_callback(); event_command(EVENT_CMD_SHADER_DIR_DEINIT); video_monitor_compute_fps_statistics(); + + return true; } -bool init_video(void) +static bool init_video(void) { unsigned max_dim, scale, width, height; video_viewport_t *custom_vp = NULL; @@ -1148,6 +1150,10 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data) switch (state) { + case RARCH_DISPLAY_CTL_INIT: + return init_video(); + case RARCH_DISPLAY_CTL_DEINIT: + return uninit_video_input(); case RARCH_DISPLAY_CTL_SET_ASPECT_RATIO: if (!poke || !poke->set_aspect_ratio) return false; diff --git a/gfx/video_driver.h b/gfx/video_driver.h index f777a78d9d..c526eb2dba 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -221,6 +221,8 @@ enum rarch_display_type enum rarch_display_ctl_state { RARCH_DISPLAY_CTL_NONE = 0, + RARCH_DISPLAY_CTL_INIT, + RARCH_DISPLAY_CTL_DEINIT, RARCH_DISPLAY_CTL_APPLY_STATE_CHANGES, RARCH_DISPLAY_CTL_FIND_DRIVER, RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE, @@ -291,10 +293,6 @@ retro_proc_address_t video_driver_get_proc_address(const char *sym); bool video_driver_set_shader(enum rarch_shader_type type, const char *shader); -void uninit_video_input(void); - -bool init_video(void); - bool video_driver_set_rotation(unsigned rotation); void video_driver_set_video_mode(unsigned width,