Mesa (master): egl/android: Implement the eglSwapinterval for Android.
Emil Velikov
evelikov at kemper.freedesktop.org
Fri Mar 16 14:07:16 UTC 2018
Module: Mesa
Branch: master
Commit: 5fc21c6044166b199d32006d37f94e6d54aef62a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fc21c6044166b199d32006d37f94e6d54aef62a
Author: Wu, Zhongmin <zhongmin.wu at intel.com>
Date: Thu Jan 18 15:39:22 2018 +0800
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 <zhongmin.wu at intel.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Tomasz Figa <tfiga at chromium.org>
[Emil Velikov: polish inline comment, add dEQP stats, s/dpy/disp/]
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/egl/drivers/dri2/platform_android.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 4f25cb7469..7f1a496ea2 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;
More information about the mesa-commit
mailing list