Handle orientation without explict calls.

Appears to fix some kind of "race condition" in EGL.
This commit is contained in:
Themaister 2012-12-28 00:12:18 +01:00
parent 71505ccb87
commit 9fbd888566
3 changed files with 15 additions and 45 deletions

View File

@ -179,21 +179,6 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
break;
case APP_CMD_CONFIG_CHANGED:
RARCH_LOG("engine_handle_cmd: APP_CMD_CONFIG_CHANGED.\n");
/* PREEXEC */
AConfiguration_fromAssetManager(android_app->config,
android_app->activity->assetManager);
print_cur_config(android_app);
int32_t new_orient = AConfiguration_getOrientation(g_android.app->config);
if (new_orient != g_android.last_orient && g_android.window_ready)
{
g_android.last_orient = new_orient;
gfx_ctx_orientation_update();
// reinit video driver for new window dimensions
}
break;
case APP_CMD_TERM_WINDOW:
RARCH_LOG("engine_handle_cmd: APP_CMD_TERM_WINDOW.\n");
@ -465,7 +450,6 @@ static void* android_app_entry(void* param)
{
RARCH_LOG("RetroArch started.\n");
rarch_init_msg_queue();
g_android.last_orient = AConfiguration_getOrientation(android_app->config);
driver_set_monitor_refresh_rate(g_android.disp_refresh_rate);
while((input_key_pressed_func(RARCH_PAUSE_TOGGLE)) ? android_run_events(g_android.app) : rarch_main_iterate());
RARCH_LOG("RetroArch stopped.\n");

View File

@ -63,32 +63,19 @@ static void gfx_ctx_destroy(void)
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
(void)width;
(void)height;
if (g_egl_dpy)
{
EGLint gl_width, gl_height;
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
*width = gl_width;
*width = gl_width;
*height = gl_height;
}
}
static void gfx_ctx_orientation_update(void)
{
gl_t *gl = (gl_t*)driver.video_data;
if (!gl)
return;
unsigned width = 0, height = 0;
gfx_ctx_get_video_size(&width, &height);
gl->full_x = width;
gl->full_y = height;
RARCH_LOG("GL: New orientation %ux%u\n", width, height);
g_resize = true;
else
{
*width = 0;
*height = 0;
}
}
static bool gfx_ctx_init(void)
@ -161,12 +148,6 @@ static bool gfx_ctx_init(void)
goto error;
}
if (g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT))
{
RARCH_LOG("[ANDROID/EGL]: Setting up reentrant state.\n");
gfx_ctx_orientation_update();
}
return true;
error:
@ -190,9 +171,14 @@ static void gfx_ctx_check_window(bool *quit,
*quit = false;
*resize = g_resize;
g_resize = false;
gfx_ctx_get_video_size(width, height);
unsigned new_width, new_height;
gfx_ctx_get_video_size(&new_width, &new_height);
if (new_width != *width || new_height != *height)
{
*width = new_width;
*height = new_height;
*resize = true;
}
RARCH_PERFORMANCE_INIT(alooper_pollonce);
RARCH_PERFORMANCE_START(alooper_pollonce);

View File

@ -695,7 +695,7 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full,
gl->vp_out_height = height;
}
//RARCH_LOG("Setting viewport @ %ux%u\n", width, height);
RARCH_LOG("Setting viewport @ %ux%u\n", width, height);
}
static void gl_set_rotation(void *data, unsigned rotation)