Failed to choose config, error = EGL_SUCCESS (EglManager.cpp)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Failed to choose config, error = EGL_SUCCESS (EglManager.cpp)

20,755 Views
ennebi
Contributor II

I found a possible issue in Android EGL Manager code provided with L5.0.0_1.0.0-ga:

 

Under frameworks/base/libs/hwui/renderthread/EglManager.cpp, have a look around line #130

 

    EGLint num_configs = 1;     if (!eglChooseConfig(mEglDisplay, attribs, &mEglConfig, num_configs, &num_configs)             || num_configs != 1) {          // Failed to get a valid config         if (mCanSetDirtyRegions) {             ALOGW("Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...");             // Try again without dirty regions enabled             mCanSetDirtyRegions = false;             loadConfig();         } else {             LOG_ALWAYS_FATAL("Failed to choose config, error = %s", egl_error_str());         }     } 

 

Please note the following:

 

- mEglConfig is initialized as nullptr in constructor

- https://www.khronos.org/registry/egl/sdk/docs/man/html/eglChooseConfig.xhtml

 

What is the purpose of the "num_configs != 1"? According to documentation, when configs (mEglConfig) is null, the structure is allocated by the library.

Thus, it may contain more than one item. In my case, I was getting the error: "Failed to choose config, error = EGL_SUCCESS". By changing the line below:

 

    if (!eglChooseConfig(mEglDisplay, attribs, &mEglConfig, num_configs, &num_configs)             || num_configs < 1) {          // Failed to get a valid config

 

The OpenGL inistalization works as expected.

 

Here is a minimal patch.

Any feedback?

Original Attachment has been moved to: attachFile.zip

0 Kudos
Reply
0 Replies