From a6bb107434ad36739c21e1f72ac8d0107808a7b9 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 7 Aug 2013 20:10:20 -0700 Subject: [PATCH] make sure we have a context when creating the 1st surface also add an option to dump the stack trace when calling a GL function without a context. Change-Id: I57b72bb8c322ac4253c3077bf150621bd9863b69 --- opengl/libs/EGL/egl.cpp | 5 +++++ services/surfaceflinger/SurfaceFlinger.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index 86637dc37..f759e6b6e 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -331,6 +331,11 @@ EGLBoolean egl_init_drivers() { void gl_unimplemented() { ALOGE("called unimplemented OpenGL ES API"); + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.callstack", value, "0"); + if (atoi(value)) { + CallStack stack(LOG_TAG); + } } void gl_noop() { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index bc1085386..4a84e5a53 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -487,6 +487,10 @@ status_t SurfaceFlinger::readyToRun() } } + // make the GLContext current so that we can create textures when creating Layers + // (which may happens before we render something) + getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext); + // start the EventThread mEventThread = new EventThread(this); mEventQueue.setEventThread(mEventThread);