EGL: add GPU frame completion tracing

This change adds a debug option to EGL to use an EGLSyncKHR each frame to
determine when the GPU finishes rendering the frame.

Change-Id: I09ce071db904b44f07ca814c586c291c8b59385a
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index b80afd6..6b6f8cf 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -67,7 +67,7 @@
 egl_display_t egl_display_t::sDisplay[NUM_DISPLAYS];
 
 egl_display_t::egl_display_t() :
-    magic('_dpy'), finishOnSwap(false), refs(0) {
+    magic('_dpy'), finishOnSwap(false), traceGpuCompletion(false), refs(0) {
 }
 
 egl_display_t::~egl_display_t() {
@@ -239,6 +239,11 @@
         finishOnSwap = true;
     }
 
+    property_get("debug.egl.traceGpuCompletion", value, "0");
+    if (atoi(value)) {
+        traceGpuCompletion = true;
+    }
+
     refs++;
     if (major != NULL)
         *major = VERSION_MAJOR;