diff options
author | Michael Gernoth <michael@gernoth.net> | 2015-01-18 19:29:43 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-10-16 14:46:53 -0700 |
commit | d25fef5357480af5bee11ed00baa7e2b27616f18 (patch) | |
tree | 656d61cf074253ac4402a52e993e1aea2d282077 | |
parent | 0e4ac33b1eab6be4b7cdc3492a9777aaefb3affd (diff) | |
download | frameworks_base-d25fef5357480af5bee11ed00baa7e2b27616f18.zip frameworks_base-d25fef5357480af5bee11ed00baa7e2b27616f18.tar.gz frameworks_base-d25fef5357480af5bee11ed00baa7e2b27616f18.tar.bz2 |
Camera2 legacy: retry EGL config without EGL_RECORDABLE_ANDROID
Some older blobs don't support EGL_RECORDABLE_ANDROID and return no
configuration when this attribute is present. Retry eglChooseConfig
without it in this case. This fixes the flashlight for devices
affected by this and doesn't break camera-functionality.
Change-Id: Ic479231744343567233edaa1cccea7bdaafaa14f
-rw-r--r-- | core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java index bc80fc1..86eb01d 100644 --- a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java +++ b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java @@ -433,6 +433,20 @@ public class SurfaceTextureRenderer { EGL14.eglChooseConfig(mEGLDisplay, attribList, /*offset*/ 0, configs, /*offset*/ 0, configs.length, numConfigs, /*offset*/ 0); checkEglError("eglCreateContext RGB888+recordable ES2"); + if (numConfigs[0] == 0) { + Log.w(TAG, "eglChooseConfig returned no configs, retrying without EGL_RECORDABLE_ANDROID"); + int[] attribList2 = { + EGL14.EGL_RED_SIZE, EGL_COLOR_BITLENGTH, + EGL14.EGL_GREEN_SIZE, EGL_COLOR_BITLENGTH, + EGL14.EGL_BLUE_SIZE, EGL_COLOR_BITLENGTH, + EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, + EGL14.EGL_SURFACE_TYPE, EGL14.EGL_PBUFFER_BIT | EGL14.EGL_WINDOW_BIT, + EGL14.EGL_NONE + }; + EGL14.eglChooseConfig(mEGLDisplay, attribList2, /*offset*/ 0, configs, /*offset*/ 0, + configs.length, numConfigs, /*offset*/ 0); + checkEglError("eglCreateContext RGB888 ES2"); + } mConfigs = configs[0]; int[] attrib_list = { EGL14.EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION, |