make GLConsumer's debug texture static

this is so that we don't burn a gralloc handle and a bit
of memory per GLConsumer.

Change-Id: I30c3e7ec45d7f1b5426aca8e06c7716870877706
diff --git a/include/gui/GLConsumer.h b/include/gui/GLConsumer.h
index 4c9aa87..742e8d1 100644
--- a/include/gui/GLConsumer.h
+++ b/include/gui/GLConsumer.h
@@ -297,6 +297,9 @@
     // binding the buffer without touching the EglSlots.
     status_t bindUnslottedBufferLocked(EGLDisplay dpy);
 
+    // returns a graphic buffer used when the texture image has been released
+    static sp<GraphicBuffer> getDebugTexImageBuffer();
+
     // The default consumer usage flags that GLConsumer always sets on its
     // BufferQueue instance; these will be OR:d with any additional flags passed
     // from the GLConsumer user. In particular, GLConsumer will always
@@ -414,9 +417,12 @@
     // attachToContext.
     bool mAttached;
 
+    // protects static initialization
+    static Mutex sStaticInitLock;
+
     // mReleasedTexImageBuffer is a dummy buffer used when in single buffer
     // mode and releaseTexImage() has been called
-    sp<GraphicBuffer> mReleasedTexImageBuffer;
+    static sp<GraphicBuffer> sReleasedTexImageBuffer;
 };
 
 // ----------------------------------------------------------------------------