Permalink
Browse files

GLSurfaceView: add property to default to RGB565

Some legacy devices (like the Xoom) are not capable of handling
RGB888 surfaces, which is now the default. This results in some
OpenGL apps crashing with "No config chosen" errors.

Set ro.opengles.surface.rgb565=true to go back to the old default
of RGB565 surfaces.

Credit to dreamcwli for the original patch.

Change-Id: I5ad9aa8e98eb6fd554b01022439141fe4a55bd70
  • Loading branch information...
1 parent 0fd25ff commit d0bfd5601a58b9a8b903a4593d9007c1c0ba2679 @TDR TDR committed Jan 4, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 opengl/java/android/opengl/GLSurfaceView.java
@@ -169,6 +169,8 @@
private final static boolean LOG_RENDERER = false;
private final static boolean LOG_RENDERER_DRAW_FRAME = false;
private final static boolean LOG_EGL = false;
+
+ private final static boolean RGB565 = SystemProperties.getBoolean("ro.opengles.surface.rgb565", false);
/**
* The renderer only renders
* when the surface is created, or when {@link #requestRender} is called.
@@ -974,7 +976,7 @@ private int findConfigAttrib(EGL10 egl, EGLDisplay display,
*/
private class SimpleEGLConfigChooser extends ComponentSizeChooser {
public SimpleEGLConfigChooser(boolean withDepthBuffer) {
- super(8, 8, 8, 0, withDepthBuffer ? 16 : 0, 0);
+ super(RGB565 ? 5 : 8, RGB565 ? 6 : 8, RGB565 ? 5 : 8, 0, withDepthBuffer ? 16 : 0, 0);
}
}

0 comments on commit d0bfd56

Please sign in to comment.