don't use compile-time configuration of libgui as much as possible

We now detect at runtime which sync features to use, which
allows us to remove a lot of the compile-time configuration
options. There  is still one option though, to disable
KHR_fence_sync on some devices (which are more efficient
without it).

- added a backdoor to get the vendor's EGL strings

the new logic is:
- use always ANDROID_native_fence_sync if available
- fallback to KHR_fence_sync if available and not disabled
  by the compile-time option
- use KHR_wait_sync if available and either of the above is
  enabled

Change-Id: I9c4b49d9ff1151faf902cc93bd53ea5f205aaabf
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0a210f7..3ed8b1b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -53,6 +53,7 @@
 #include <utils/Trace.h>
 
 #include <private/android_filesystem_config.h>
+#include <private/gui/SyncFeatures.h>
 
 #include "clz.h"
 #include "DdmConnection.h"
@@ -68,11 +69,10 @@
 #include "DisplayHardware/HWComposer.h"
 #include "DisplayHardware/VirtualDisplaySurface.h"
 
-
-#define EGL_VERSION_HW_ANDROID  0x3143
-
 #define DISPLAY_COUNT       1
 
+EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
+
 namespace android {
 // ---------------------------------------------------------------------------
 
@@ -2280,6 +2280,10 @@
     appendGuiConfigString(result);
     result.append("\n");
 
+    result.append("Sync configuration: ");
+    result.append(SyncFeatures::getInstance().toString());
+    result.append("\n");
+
     /*
      * Dump the visible layer list
      */
@@ -2313,17 +2317,20 @@
     HWComposer& hwc(getHwComposer());
     sp<const DisplayDevice> hw(getDefaultDisplayDevice());
     const GLExtensions& extensions(GLExtensions::getInstance());
+
+    snprintf(buffer, SIZE, "EGL implementation : %s\n",
+            eglQueryStringImplementationANDROID(mEGLDisplay, EGL_VERSION));
+    result.append(buffer);
+    snprintf(buffer, SIZE, "%s\n",
+            eglQueryStringImplementationANDROID(mEGLDisplay, EGL_EXTENSIONS));
+    result.append(buffer);
+
     snprintf(buffer, SIZE, "GLES: %s, %s, %s\n",
             extensions.getVendor(),
             extensions.getRenderer(),
             extensions.getVersion());
     result.append(buffer);
-
-    snprintf(buffer, SIZE, "EGL : %s\n",
-            eglQueryString(mEGLDisplay, EGL_VERSION_HW_ANDROID));
-    result.append(buffer);
-
-    snprintf(buffer, SIZE, "EXTS: %s\n", extensions.getExtension());
+    snprintf(buffer, SIZE, "%s\n", extensions.getExtension());
     result.append(buffer);
 
     hw->undefinedRegion.dump(result, "undefinedRegion");