EGLWindow: workaround eglQueryString behavior before Android 10

EGL_NO_DISPLAY + EGL_EXTENSIONS returns NULL before angle support
introduced in Android 10. See aosp/760681 for the reference.

Bug: b/255844932
Test: build and run angle trace on Android Pie
Change-Id: I23a8236cbd220ce34ebbcc602d6ced351fc76619
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3988422
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Yiwei Zhang
2022-10-27 23:18:46 +00:00
committed by Angle LUCI CQ
parent ac5a9c53c1
commit fd3bfb778d

View File

@@ -178,8 +178,14 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
LoadUtilEGL(getProcAddress);
#endif // defined(ANGLE_USE_UTIL_LOADER)
// EGL_NO_DISPLAY + EGL_EXTENSIONS returns NULL before Android 10
const char *extensionString =
static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
if (!extensionString)
{
// fallback to an empty string for strstr
extensionString = "";
}
std::vector<EGLAttrib> displayAttributes;
displayAttributes.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
@@ -879,10 +885,11 @@ void EGLWindow::Delete(EGLWindow **window)
void EGLWindow::queryFeatures()
{
// EGL_NO_DISPLAY + EGL_EXTENSIONS returns NULL before Android 10
const char *extensionString =
static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
const bool hasFeatureControlANGLE =
strstr(extensionString, "EGL_ANGLE_feature_control") != nullptr;
extensionString && strstr(extensionString, "EGL_ANGLE_feature_control") != nullptr;
if (!hasFeatureControlANGLE)
{