Hi, I'm trying to run a benchmarking tool on the Samsung Galaxy S5 to test some optimizations and perhaps start experimenting with the use of ASTC. It seems like the GL driver is failing to create a context without an associated window to render into. As you may know, opening a window on Android is a fairly involved process, so ideally I'd like to avoid it. I've attached the code that should be initializing the context and the results below:
EGLint error = EGL_SUCCESS; if (EGL_SUCCESS != (error = eglGetError())) { Debugf("Prior EGL error: %s\n", getEGLErrorStr(error)); return NULL; } fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (fDisplay == EGL_NO_DISPLAY || EGL_SUCCESS != (error = eglGetError())) { Debugf("eglGetDisplay failed -- error: %s\n", getEGLErrorStr(error)); return NULL; } EGLint majorVersion; EGLint minorVersion; if (EGL_TRUE != eglInitialize(fDisplay, &majorVersion, &minorVersion)) { if (EGL_SUCCESS != (error = eglGetError())) { Debugf("eglInitialize failed -- error: %s\n", getEGLErrorStr(error)); return NULL; } } Debugf("Major: %d, minor: %d\n", majorVersion, minorVersion); Debugf("VENDOR: %s\n", eglQueryString(fDisplay, EGL_VENDOR)); Debugf("APIS: %s\n", eglQueryString(fDisplay, EGL_CLIENT_APIS)); Debugf("VERSION: %s\n", eglQueryString(fDisplay, EGL_VERSION)); Debugf("EXTENSIONS %s\n", eglQueryString(fDisplay, EGL_EXTENSIONS)); if (!eglBindAPI(EGL_OPENGL_ES_API)) { return NULL; } if (EGL_SUCCESS != (error = eglGetError())) { Debugf("eglBindAPI failed -- error: %s\n", getEGLErrorStr(error)); return NULL; } EGLint numConfigs; const EGLint configAttribs[] = { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, EGL_DONT_CARE, EGL_DEPTH_SIZE, EGL_DONT_CARE, EGL_STENCIL_SIZE, EGL_DONT_CARE, EGL_NONE }; EGLConfig surfaceConfig; if (!eglChooseConfig(fDisplay, configAttribs, &surfaceConfig, 1, &numConfigs)) { Debugf("eglChooseConfig failed. EGL Error: 0x%08x\n", eglGetError()); return NULL; }
The output:
Major: 1, minor: 4
VENDOR: Android
APIS: OpenGL_ES
VERSION: 1.4 Android META-EGL
EXTENSIONS EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time
eglChooseConfig failed. EGL Error: 0x00003001
I'm hesitant to say that this is a bug in the driver, but I'm not totally sure what I'm doing wrong in my initialization code. Any help would be appreciated . Also, if this isn't an appropriate forum for a question like this, I'd be glad to direct it to the right place.
Hi mokosha,
seems a bit strange. 0x3001 is EGL_NOT_INITIALIZED which according to the man page for eglChooseConfig() can be raised if display has not been initialized, yet you've only just executed other queries on that display.
Do you need the eglBindAPI()? It "affects the behavior of other EGL commands including ... eglGetCurrentDisplay" and "The initial value of the current rendering API is EGL_OPENGL_ES_API " so maybe it's unnecessary. Could you remove it and rule it out as causing problems with the display?
Do you get any output if you use eglGetConfigs() to query how many configs then grab that many configs?
Cheers, Pete
EGL Reference Pages
Hi Pete,
Thanks for your reply.
Do you need the eglBindAPI()? Could you remove it and rule it out as causing problems with the display?
Removing this function call has no effect. I still fail in the same place.
I added the following code:
static const EGLint kMaxConfigs = 1000; EGLConfig configs[kMaxConfigs]; if (EGL_FALSE == eglGetConfigs(fDisplay, configs, kMaxConfigs, &numConfigs)) { if (EGL_SUCCESS != (error = eglGetError())) { Debugf("eglGetConfigs failed -- error: %s\n", getEGLErrorStr(error)); return NULL; } }
This produced the following error:
eglGetConfigs failed -- error: EGL_NOT_INITIALIZED
Thanks for taking the time to look at this!