Snap for 5595753 from fb065fe01a7813e6356e0dbd4b54d102d3536072 to qt-release

Change-Id: I788af55ac4c63b54367083c03b22febf800ca184
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp
index b0b510b..60d17e5 100644
--- a/system/egl/egl.cpp
+++ b/system/egl/egl.cpp
@@ -920,7 +920,11 @@
 
 const char* eglQueryString(EGLDisplay dpy, EGLint name)
 {
-    VALIDATE_DISPLAY_INIT(dpy, NULL);
+    // EGL_BAD_DISPLAY is generated if display is not an EGL display connection, unless display is
+    // EGL_NO_DISPLAY and name is EGL_EXTENSIONS.
+    if (dpy || name != EGL_EXTENSIONS) {
+        VALIDATE_DISPLAY_INIT(dpy, NULL);
+    }
 
     return s_display.queryString(name);
 }