Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec94ab09 authored by Takazumi Matsumoto's avatar Takazumi Matsumoto Committed by Ricardo Cerqueira
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
parent 1608ceb6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
    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 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
     */
    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);
        }
    }