Move video_active to gfx/video_driver.c

This commit is contained in:
twinaphex 2015-11-29 21:38:47 +01:00
parent 12e301825b
commit b62738465c
5 changed files with 18 additions and 12 deletions

View File

@ -273,11 +273,10 @@ void driver_set_nonblock_state(void)
{
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
driver_t *driver = driver_get_ptr();
bool enable = input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL);
/* Only apply non-block-state for video if we're using vsync. */
if (driver->video_active && video_driver_get_ptr(false))
if (video_driver_ctl(RARCH_DISPLAY_CTL_IS_ACTIVE, NULL) && video_driver_get_ptr(false))
{
bool video_nonblock = enable;

View File

@ -216,7 +216,6 @@ typedef struct driver
void *netplay_data;
void *ui_companion_data;
bool video_active;
bool camera_active;
bool location_active;
bool osk_enable;

View File

@ -75,6 +75,8 @@ typedef struct video_pixel_scaler
void *scaler_out;
} video_pixel_scaler_t;
static bool video_active;
/* Last message given to the video driver */
static char current_msg[PATH_MAX_LENGTH];
@ -1653,6 +1655,14 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
break;
case RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT_ACK:
return video_cache_context_ack;
case RARCH_DISPLAY_CTL_SET_ACTIVE:
video_active = true;
break;
case RARCH_DISPLAY_CTL_UNSET_ACTIVE:
video_active = false;
break;
case RARCH_DISPLAY_CTL_IS_ACTIVE:
return video_active;
case RARCH_DISPLAY_CTL_NONE:
default:
break;
@ -1813,11 +1823,10 @@ void video_frame(const void *data, unsigned width,
unsigned output_height = 0;
unsigned output_pitch = 0;
const char *msg = NULL;
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
if (!driver->video_active)
if (!video_active)
return;
if (video_pixel_frame_scale(data, width, height, pitch))
@ -1861,7 +1870,7 @@ void video_frame(const void *data, unsigned width,
if (!current_video->frame(
video_data, data, width, height, *frame_count,
pitch, current_msg))
driver->video_active = false;
video_active = false;
*frame_count = *frame_count + 1;
}

View File

@ -322,7 +322,10 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT,
RARCH_DISPLAY_CTL_SET_VIDEO_CACHE_CONTEXT_ACK,
RARCH_DISPLAY_CTL_UNSET_VIDEO_CACHE_CONTEXT_ACK,
RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT_ACK
RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT_ACK,
RARCH_DISPLAY_CTL_SET_ACTIVE,
RARCH_DISPLAY_CTL_UNSET_ACTIVE,
RARCH_DISPLAY_CTL_IS_ACTIVE
};
bool video_driver_ctl(enum rarch_display_ctl_state state, void *data);

View File

@ -1025,11 +1025,7 @@ static void rarch_init_savefile_paths(void)
static bool init_state(void)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return false;
driver->video_active = true;
video_driver_ctl(RARCH_DISPLAY_CTL_SET_ACTIVE, NULL);
audio_driver_ctl(RARCH_AUDIO_CTL_SET_ACTIVE, NULL);
return true;