Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save steven676/7667657 to your computer and use it in GitHub Desktop.

Select an option

Save steven676/7667657 to your computer and use it in GitHub Desktop.
[PATCH 5/6] SurfaceFlinger: allow targets to disable GLESv2 rendering path (against android-4.4_r1.2 frameworks/native)
From 9906b04e5a3ecc8358ed250afe6cdc5106bbf609 Mon Sep 17 00:00:00 2001
From: Steven Luo <[email protected]>
Date: Sat, 2 Nov 2013 21:46:49 -0700
Subject: [PATCH 5/6] SurfaceFlinger: allow targets to disable GLESv2
rendering path
There are targets where a GLESv2 rendering path is available, but
undesirable to use (because of performance problems or bugs, for
example). Add a new BoardConfig flag to allow these targets to force
the use of GLESv1.
Change-Id: Ic3531cc253f64870c7fbe778813419e6986e3060
---
services/surfaceflinger/Android.mk | 4 ++++
services/surfaceflinger/SurfaceFlinger.cpp | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index c3daa64..6a496f3 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -51,6 +51,10 @@ ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
endif
+ifeq ($(TARGET_DISABLE_SURFACEFLINGER_GLES2),true)
+ LOCAL_CFLAGS += -DTARGET_DISABLE_SURFACEFLINGER_GLES2
+endif
+
ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 8578302..3b5fa6f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -556,8 +556,13 @@ void SurfaceFlinger::init() {
*static_cast<HWComposer::EventHandler *>(this));
// First try to get an ES2 config
+#ifdef TARGET_DISABLE_SURFACEFLINGER_GLES2
+ ALOGW("OpenGL ES 2.0 disabled for this device");
+ err = !NO_ERROR;
+#else
err = selectEGLConfig(mEGLDisplay, mHwc->getVisualID(), EGL_OPENGL_ES2_BIT,
&mEGLConfig);
+#endif
if (err != NO_ERROR) {
// If ES2 fails, try ES1
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment