summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2
diff options
context:
space:
mode:
authorWu, Zhongmin <[email protected]>2018-01-18 15:39:22 +0800
committerEmil Velikov <[email protected]>2018-03-16 13:58:56 +0000
commit5fc21c6044166b199d32006d37f94e6d54aef62a (patch)
treebdf1ecc341b004b410656339b307702a4b0cea3f /src/egl/drivers/dri2
parent3a9fb4f7ad6de14b5560b85d5f1c723d0555a49b (diff)
egl/android: Implement the eglSwapinterval for Android.
Implement the eglSwapinterval for Android platform to enable the async mode for some GFX benchmarks such as Daimler C217, CityBench. Results of the dEQP-EGL.*swap_interval tests 'dEQP-EGL.functional.query_config.get_config_attrib.max_swap_interval'.. 'dEQP-EGL.functional.query_config.get_config_attrib.min_swap_interval'.. 'dEQP-EGL.functional.choose_config.simple.selection_only.max_swap_interval'.. 'dEQP-EGL.functional.choose_config.simple.selection_only.min_swap_interval'.. 'dEQP-EGL.functional.choose_config.simple.selection_and_sort.max_swap_interval'.. 'dEQP-EGL.functional.choose_config.simple.selection_and_sort.min_swap_interval'.. 'dEQP-EGL.functional.negative_api.swap_interval'.. Test run totals: Passed: 7/7 (100.0%) Failed: 0/7 (0.0%) Not supported: 0/7 (0.0%) Warnings: 0/7 (0.0%) Signed-off-by: Zhongmin Wu <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> [Emil Velikov: polish inline comment, add dEQP stats, s/dpy/disp/] Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r--src/egl/drivers/dri2/platform_android.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 4f25cb74691..7f1a496ea24 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -417,6 +417,20 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
return EGL_TRUE;
}
+static EGLBoolean
+droid_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLSurface *surf, EGLint interval)
+{
+ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+ struct ANativeWindow *window = dri2_surf->window;
+
+ if (window->setSwapInterval(window, interval))
+ return EGL_FALSE;
+
+ surf->SwapInterval = interval;
+ return EGL_TRUE;
+}
+
static int
update_buffers(struct dri2_egl_surface *dri2_surf)
{
@@ -1127,6 +1141,7 @@ static const struct dri2_egl_display_vtbl droid_display_vtbl = {
.swap_buffers = droid_swap_buffers,
.swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, /* Android implements the function */
.swap_buffers_region = dri2_fallback_swap_buffers_region,
+ .swap_interval = droid_swap_interval,
#if ANDROID_API_LEVEL >= 23
.set_damage_region = droid_set_damage_region,
#else
@@ -1241,6 +1256,12 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
dri2_setup_screen(disp);
+ /* We set the maximum swap interval as 1 for Android platform, since it is
+ * the maximum value supported by Android according to the value of
+ * ANativeWindow::maxSwapInterval.
+ */
+ dri2_setup_swap_interval(disp, 1);
+
if (!droid_add_configs_for_visuals(drv, disp)) {
err = "DRI2: failed to add configs";
goto cleanup;