Chromium Code Reviews| Index: ui/gl/gl_surface_egl.cc |
| diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc |
| index 8c29342ab408e2f0e10fb0ff370807d449c5646c..67e2a15629559e03aa50250bdedb237e592bad94 100644 |
| --- a/ui/gl/gl_surface_egl.cc |
| +++ b/ui/gl/gl_surface_egl.cc |
| @@ -9,6 +9,7 @@ |
| #include "ui/gl/gl_surface_egl.h" |
| #if defined(OS_ANDROID) |
| +#include "base/android/sys_utils.h" |
| #include <android/native_window_jni.h> |
| #endif |
| @@ -125,6 +126,11 @@ bool GLSurfaceEGL::InitializeOneOff() { |
| return false; |
| } |
| + bool use_16bit_surface = false; |
| +#if defined(OS_ANDROID) |
| + use_16bit_surface = base::android::SysUtils::IsLowEndDevice(); |
|
no sievers
2013/08/13 01:13:58
can you make this static so it's clear that we are
kaanb
2013/08/13 04:20:40
Done.
|
| +#endif |
| + |
| // Choose an EGL configuration. |
| // On X this is only used for PBuffer surfaces. |
| static const EGLint kConfigAttribs[] = { |
| @@ -138,9 +144,16 @@ bool GLSurfaceEGL::InitializeOneOff() { |
| EGL_NONE |
| }; |
| + static const EGLint kConfigAttribs16bit[] = { |
| + EGL_BUFFER_SIZE, 16, |
| + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
| + EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
|
no sievers
2013/08/13 01:13:58
We need to make sure that this config works across
|
| + EGL_NONE |
| + }; |
| + |
| EGLint num_configs; |
| if (!eglChooseConfig(g_display, |
| - kConfigAttribs, |
| + use_16bit_surface ? kConfigAttribs16bit : kConfigAttribs, |
| NULL, |
| 0, |
| &num_configs)) { |
| @@ -155,7 +168,7 @@ bool GLSurfaceEGL::InitializeOneOff() { |
| } |
| if (!eglChooseConfig(g_display, |
| - kConfigAttribs, |
| + use_16bit_surface ? kConfigAttribs16bit : kConfigAttribs, |
|
no sievers
2013/08/13 01:13:58
It seems like num_configs could be >0 (since it's
kaanb
2013/08/13 04:20:40
The trouble is if you explicitly ask for 5-6-5 you
|
| &g_config, |
| 1, |
| &num_configs)) { |
| @@ -164,6 +177,17 @@ bool GLSurfaceEGL::InitializeOneOff() { |
| return false; |
|
no sievers
2013/08/13 01:13:58
Also, if we don't get a 16bit config, should we fa
kaanb
2013/08/13 04:20:40
I think the eglChooseConfig will automatically sel
|
| } |
| + if (use_16bit_surface) { |
| + EGLint red_size, green_size, blue_size; |
| + eglGetConfigAttrib(g_display, g_config, EGL_RED_SIZE, &red_size); |
| + eglGetConfigAttrib(g_display, g_config, EGL_GREEN_SIZE, &green_size); |
| + eglGetConfigAttrib(g_display, g_config, EGL_BLUE_SIZE, &blue_size); |
| + |
| + DCHECK_EQ(5, red_size); |
| + DCHECK_EQ(6, green_size); |
| + DCHECK_EQ(5, blue_size); |
| + } |
| + |
| g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS); |
| g_egl_create_context_robustness_supported = |
| HasEGLExtension("EGL_EXT_create_context_robustness"); |