Add RARCH_DISPLAY_CTL_{DEINIT/INIT}

This commit is contained in:
twinaphex 2015-11-20 19:01:13 +01:00
parent c1fa9dc637
commit 21cabec759
3 changed files with 12 additions and 8 deletions

View File

@ -384,7 +384,7 @@ void init_drivers(int flags)
video_monitor_reset(); video_monitor_reset();
init_video(); video_driver_ctl(RARCH_DISPLAY_CTL_INIT, NULL);
if (!driver->video_cache_context_ack if (!driver->video_cache_context_ack
&& hw_render->context_reset) && hw_render->context_reset)
@ -464,7 +464,7 @@ void uninit_drivers(int flags)
uninit_audio(); uninit_audio();
if (flags & DRIVERS_VIDEO_INPUT) if (flags & DRIVERS_VIDEO_INPUT)
uninit_video_input(); video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT, NULL);
if (flags & DRIVER_VIDEO) if (flags & DRIVER_VIDEO)
{ {

View File

@ -399,7 +399,7 @@ static void video_driver_unset_callback(void)
hw_render = NULL; hw_render = NULL;
} }
void uninit_video_input(void) static bool uninit_video_input(void)
{ {
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
@ -425,9 +425,11 @@ void uninit_video_input(void)
video_driver_unset_callback(); video_driver_unset_callback();
event_command(EVENT_CMD_SHADER_DIR_DEINIT); event_command(EVENT_CMD_SHADER_DIR_DEINIT);
video_monitor_compute_fps_statistics(); video_monitor_compute_fps_statistics();
return true;
} }
bool init_video(void) static bool init_video(void)
{ {
unsigned max_dim, scale, width, height; unsigned max_dim, scale, width, height;
video_viewport_t *custom_vp = NULL; video_viewport_t *custom_vp = NULL;
@ -1148,6 +1150,10 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
switch (state) 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: case RARCH_DISPLAY_CTL_SET_ASPECT_RATIO:
if (!poke || !poke->set_aspect_ratio) if (!poke || !poke->set_aspect_ratio)
return false; return false;

View File

@ -221,6 +221,8 @@ enum rarch_display_type
enum rarch_display_ctl_state enum rarch_display_ctl_state
{ {
RARCH_DISPLAY_CTL_NONE = 0, RARCH_DISPLAY_CTL_NONE = 0,
RARCH_DISPLAY_CTL_INIT,
RARCH_DISPLAY_CTL_DEINIT,
RARCH_DISPLAY_CTL_APPLY_STATE_CHANGES, RARCH_DISPLAY_CTL_APPLY_STATE_CHANGES,
RARCH_DISPLAY_CTL_FIND_DRIVER, RARCH_DISPLAY_CTL_FIND_DRIVER,
RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE, 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, bool video_driver_set_shader(enum rarch_shader_type type,
const char *shader); const char *shader);
void uninit_video_input(void);
bool init_video(void);
bool video_driver_set_rotation(unsigned rotation); bool video_driver_set_rotation(unsigned rotation);
void video_driver_set_video_mode(unsigned width, void video_driver_set_video_mode(unsigned width,