Merge "don't log EGL errors due to unimplemented proprietary extensions"
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 23f67d5..1f9ce68 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1480,7 +1480,7 @@
         }
     }
 
-    return setError(EGL_BAD_DISPLAY, 0);;
+    return setErrorQuiet(EGL_BAD_DISPLAY, 0);
 }
 
 EGLuint64NV eglGetSystemTimeNV()
@@ -1500,5 +1500,5 @@
         }
     }
 
-    return setError(EGL_BAD_DISPLAY, 0);;
+    return setErrorQuiet(EGL_BAD_DISPLAY, 0);
 }
diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp
index f3c8d2c..b341ddb 100644
--- a/opengl/libs/EGL/egl_tls.cpp
+++ b/opengl/libs/EGL/egl_tls.cpp
@@ -67,19 +67,23 @@
     }
 }
 
-void egl_tls_t::setErrorEtcImpl(const char* caller, int line, EGLint error) {
+void egl_tls_t::setErrorEtcImpl(
+        const char* caller, int line, EGLint error, bool quiet) {
     validateTLSKey();
     egl_tls_t* tls = getTLS();
     if (tls->error != error) {
-        LOGE("%s:%d error %x (%s)", caller, line, error, egl_strerror(error));
-        tls->error = error;
-        char value[PROPERTY_VALUE_MAX];
-        property_get("debug.egl.callstack", value, "0");
-        if (atoi(value)) {
-            CallStack stack;
-            stack.update();
-            stack.dump();
+        if (!quiet) {
+            LOGE("%s:%d error %x (%s)",
+                    caller, line, error, egl_strerror(error));
+            char value[PROPERTY_VALUE_MAX];
+            property_get("debug.egl.callstack", value, "0");
+            if (atoi(value)) {
+                CallStack stack;
+                stack.update();
+                stack.dump();
+            }
         }
+        tls->error = error;
     }
 }
 
diff --git a/opengl/libs/EGL/egl_tls.h b/opengl/libs/EGL/egl_tls.h
index a7989ef..78b0b2f 100644
--- a/opengl/libs/EGL/egl_tls.h
+++ b/opengl/libs/EGL/egl_tls.h
@@ -41,7 +41,8 @@
 
     egl_tls_t();
     static void validateTLSKey();
-    static void setErrorEtcImpl(const char* caller, int line, EGLint error);
+    static void setErrorEtcImpl(
+            const char* caller, int line, EGLint error, bool quiet);
 
 public:
     static egl_tls_t* getTLS();
@@ -55,13 +56,17 @@
 
     template<typename T>
     static T setErrorEtc(const char* caller,
-            int line, EGLint error, T returnValue) {
-        setErrorEtcImpl(caller, line, error);
+            int line, EGLint error, T returnValue, bool quiet = false) {
+        setErrorEtcImpl(caller, line, error, quiet);
         return returnValue;
     }
 };
 
-#define setError(_e, _r) egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
+#define setError(_e, _r)        \
+    egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
+
+#define setErrorQuiet(_e, _r)   \
+    egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r, true)
 
 // ----------------------------------------------------------------------------