mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Handle orientation without explict calls.
Appears to fix some kind of "race condition" in EGL.
This commit is contained in:
parent
71505ccb87
commit
9fbd888566
@ -179,21 +179,6 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
|
|||||||
break;
|
break;
|
||||||
case APP_CMD_CONFIG_CHANGED:
|
case APP_CMD_CONFIG_CHANGED:
|
||||||
RARCH_LOG("engine_handle_cmd: APP_CMD_CONFIG_CHANGED.\n");
|
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;
|
break;
|
||||||
case APP_CMD_TERM_WINDOW:
|
case APP_CMD_TERM_WINDOW:
|
||||||
RARCH_LOG("engine_handle_cmd: APP_CMD_TERM_WINDOW.\n");
|
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_LOG("RetroArch started.\n");
|
||||||
rarch_init_msg_queue();
|
rarch_init_msg_queue();
|
||||||
g_android.last_orient = AConfiguration_getOrientation(android_app->config);
|
|
||||||
driver_set_monitor_refresh_rate(g_android.disp_refresh_rate);
|
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());
|
while((input_key_pressed_func(RARCH_PAUSE_TOGGLE)) ? android_run_events(g_android.app) : rarch_main_iterate());
|
||||||
RARCH_LOG("RetroArch stopped.\n");
|
RARCH_LOG("RetroArch stopped.\n");
|
||||||
|
@ -63,32 +63,19 @@ static void gfx_ctx_destroy(void)
|
|||||||
|
|
||||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
(void)width;
|
|
||||||
(void)height;
|
|
||||||
|
|
||||||
if (g_egl_dpy)
|
if (g_egl_dpy)
|
||||||
{
|
{
|
||||||
EGLint gl_width, gl_height;
|
EGLint gl_width, gl_height;
|
||||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
|
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
|
||||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
|
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
|
||||||
*width = gl_width;
|
*width = gl_width;
|
||||||
*height = gl_height;
|
*height = gl_height;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
static void gfx_ctx_orientation_update(void)
|
*width = 0;
|
||||||
{
|
*height = 0;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_init(void)
|
static bool gfx_ctx_init(void)
|
||||||
@ -161,12 +148,6 @@ static bool gfx_ctx_init(void)
|
|||||||
goto error;
|
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;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@ -190,9 +171,14 @@ static void gfx_ctx_check_window(bool *quit,
|
|||||||
|
|
||||||
*quit = false;
|
*quit = false;
|
||||||
|
|
||||||
*resize = g_resize;
|
unsigned new_width, new_height;
|
||||||
g_resize = false;
|
gfx_ctx_get_video_size(&new_width, &new_height);
|
||||||
gfx_ctx_get_video_size(width, height);
|
if (new_width != *width || new_height != *height)
|
||||||
|
{
|
||||||
|
*width = new_width;
|
||||||
|
*height = new_height;
|
||||||
|
*resize = true;
|
||||||
|
}
|
||||||
|
|
||||||
RARCH_PERFORMANCE_INIT(alooper_pollonce);
|
RARCH_PERFORMANCE_INIT(alooper_pollonce);
|
||||||
RARCH_PERFORMANCE_START(alooper_pollonce);
|
RARCH_PERFORMANCE_START(alooper_pollonce);
|
||||||
|
2
gfx/gl.c
2
gfx/gl.c
@ -695,7 +695,7 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full,
|
|||||||
gl->vp_out_height = height;
|
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)
|
static void gl_set_rotation(void *data, unsigned rotation)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user