summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_android.c
diff options
context:
space:
mode:
authorHaixia Shi <hshi@chromium.org>2016-07-28 10:51:12 -0700
committerChad Versace <chad@kiwitree.net>2016-08-09 15:49:28 -0700
commita7c6993a33e894556e45fc2882ad19f34274d689 (patch)
tree48058437e33ffe24da22e26c17df21a593a1559c /src/egl/drivers/dri2/platform_android.c
parentc4cd0e8ecd6ab9fc427d26ba7a9a360590291d24 (diff)
downloadexternal_mesa3d-a7c6993a33e894556e45fc2882ad19f34274d689.zip
external_mesa3d-a7c6993a33e894556e45fc2882ad19f34274d689.tar.gz
external_mesa3d-a7c6993a33e894556e45fc2882ad19f34274d689.tar.bz2
egl: android: query native window default width and height (v2)
On android platform, the width and height of a native window surface may be updated after initialization. It is therefore necessary to query android framework for the current width and height. v2: remove Android specific #ifdef's and just implement the fallback directly if the platform query_surface() callback is not provided. TEST=dEQP-EGL.functional.resize.surface_size#* on cyan-cheets Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org> (v1) Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Chad Versace <chad@kiwitree.net> Change-Id: I673f7d2f1d90c3bf572b30f63da537f2cae1496e
Diffstat (limited to 'src/egl/drivers/dri2/platform_android.c')
-rw-r--r--src/egl/drivers/dri2/platform_android.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 25ceb0e..925c1a5 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -593,6 +593,32 @@ droid_create_image_from_name(_EGLDisplay *disp, _EGLContext *ctx,
return &dri2_img->base;
}
+static EGLBoolean
+droid_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+ EGLint attribute, EGLint *value)
+{
+ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+ switch (attribute) {
+ case EGL_WIDTH:
+ if (dri2_surf->base.Type == EGL_WINDOW_BIT && dri2_surf->window) {
+ dri2_surf->window->query(dri2_surf->window,
+ NATIVE_WINDOW_DEFAULT_WIDTH, value);
+ return EGL_TRUE;
+ }
+ break;
+ case EGL_HEIGHT:
+ if (dri2_surf->base.Type == EGL_WINDOW_BIT && dri2_surf->window) {
+ dri2_surf->window->query(dri2_surf->window,
+ NATIVE_WINDOW_DEFAULT_HEIGHT, value);
+ return EGL_TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+ return _eglQuerySurface(drv, dpy, surf, attribute, value);
+}
+
static _EGLImage *
dri2_create_image_android_native_buffer(_EGLDisplay *disp,
_EGLContext *ctx,
@@ -860,6 +886,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
.post_sub_buffer = dri2_fallback_post_sub_buffer,
.copy_buffers = dri2_fallback_copy_buffers,
.query_buffer_age = dri2_fallback_query_buffer_age,
+ .query_surface = droid_query_surface,
.create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
.get_sync_values = dri2_fallback_get_sync_values,
.get_dri_drawable = dri2_surface_get_dri_drawable,