We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Community,
I am building test suite for Open GL ES 2.0 with EGL support.When I run app ,i am getting above error while getting EGL extensions with API egl.querystring().
Anything I am missing here OR is it because of libMAli.so/libEGL.so/user-space-driver issue?
My platform is linux with x11 as window manager.
Let me know if you want more information
Thanks,
Vaibhav
Message was edited by: vaibhav
According to eglQueryString manual :
EGL_BAD_DISPLAY is generated if display is not an EGL display connection.
Are you sure that the EGL display was initialised correctly ?
What does eglGetError returns after eglGetDisplay ?
Hi myy,
Firstly,Thanks for the response.
Here,is the code snipped from where i am getting error :
const char* const extensionStr = egl.queryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
#################################################################
Here is my snapshot of whole code.Actually i am querying extension before getting egl_display.
So if i am getting any platformEXT,then i will get EGL display connection using that.Otherwise ,i am trying to get EGL display using legacy method.
IS IT CORRECT WAY?
##################################################################
Whole ocde snippet:
EGLDisplay getDisplay (NativeDisplay& nativeDisplay)
{
const Library& egl = nativeDisplay.getLibrary();
const bool supportsLegacyGetDisplay = (nativeDisplay.getCapabilities() & NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY) != 0;
const bool supportsPlatformGetDisplay = (nativeDisplay.getCapabilities() & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM) != 0;
bool usePlatformExt = false;
EGLDisplay display = EGL_NO_DISPLAY;
TCU_CHECK_INTERNAL(supportsLegacyGetDisplay || supportsPlatformGetDisplay);
if (supportsPlatformGetDisplay)
const vector<string> platformExts = getPlatformExtensions(egl);<-------------------------------------------------------------------here i am getting error
usePlatformExt = de::contains(platformExts.begin(), platformExts.end(), string("EGL_EXT_platform_base")) &&
de::contains(platformExts.begin(), platformExts.end(), string(nativeDisplay.getPlatformExtensionName()));
}
if (usePlatformExt)
tcu::print("##### 2DISPLAY = %d\n",(EGLDisplay)display);
const vector<EGLint> legacyAttribs = toLegacyAttribList(nativeDisplay.getPlatformAttributes());
display = egl.getPlatformDisplayEXT(nativeDisplay.getPlatformType(), nativeDisplay.getPlatformNative(), &legacyAttribs[0]);
EGLU_CHECK_MSG(egl, "eglGetPlatformDisplayEXT()");
TCU_CHECK(display != EGL_NO_DISPLAY);
So, after trying to build a minimal eglQueryString example, I found two problems :
- If eglGetDisplay is not called, eglQueryString will return NULL and an EGL Error will be raised.
- If eglInitialize is not called, eglQueryString will also return NULL and an EGL Error will be raised.
Here's a quick working minimal example on how to use of eglQueryString. The example is in C but should be easy to adapt.
/* Compile with gcc -g3 -o example example.c -lX11 -lEGL */ #include <assert.h> #include <stdio.h> #include <EGL/egl.h> #include <EGL/eglplatform.h> void printEGLError(); int main(void) { Display* x_display = XOpenDisplay(NULL); EGLDisplay display = eglGetDisplay(x_display); assert(display != EGL_NO_DISPLAY); EGLint major, minor; eglInitialize(display, &major, &minor); char *string = eglQueryString(display, EGL_CLIENT_APIS); assert(string); printf("%s\n", string); return 0; } /* Use printEGLError to show a description of the last EGL Error. The descriptions are taken from the eglGetError manual */ #define ERROR_DESC(...) fprintf(stderr, "%s\n", __VA_ARGS__); break void printEGLError() { switch(eglGetError()) { case(EGL_SUCCESS): ERROR_DESC("The last function succeeded without error."); case(EGL_NOT_INITIALIZED): ERROR_DESC("EGL is not initialized, or could not be initialized, for the specified EGL display connection."); case(EGL_BAD_ACCESS): ERROR_DESC("EGL cannot access a requested resource (for example a context is bound in another thread)."); case(EGL_BAD_ALLOC): ERROR_DESC("EGL failed to allocate resources for the requested operation."); case(EGL_BAD_ATTRIBUTE): ERROR_DESC("An unrecognized attribute or attribute value was passed in the attribute list."); case(EGL_BAD_CONTEXT): ERROR_DESC("An EGLContext argument does not name a valid EGL rendering context."); case(EGL_BAD_CONFIG): ERROR_DESC("An EGLConfig argument does not name a valid EGL frame buffer configuration."); case(EGL_BAD_CURRENT_SURFACE): ERROR_DESC("The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid."); case(EGL_BAD_DISPLAY): ERROR_DESC("An EGLDisplay argument does not name a valid EGL display connection."); case(EGL_BAD_SURFACE): ERROR_DESC("An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering."); case(EGL_BAD_MATCH): ERROR_DESC("Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface)."); case(EGL_BAD_PARAMETER): ERROR_DESC("One or more argument values are invalid."); case(EGL_BAD_NATIVE_PIXMAP): ERROR_DESC("A NativePixmapType argument does not refer to a valid native pixmap."); case(EGL_BAD_NATIVE_WINDOW): ERROR_DESC("A NativeWindowType argument does not refer to a valid native window."); case(EGL_CONTEXT_LOST): ERROR_DESC("A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering. "); } }
Hi vaibhav810,
QueryString in this case is expecting a valid EGL_DISPLAY.
Could you try to initialize your display using this method:
display = eglGetDisplay(EGL_DEFAULT_DISPLAY); if(display == EGL_NO_DISPLAY) { EGLint error = eglGetError(); LOGE("eglGetError(): %i (0x%.4x)\n", (int)error, (int)error); LOGE("No EGL Display available at %s:%i\n", __FILE__, __LINE__); exit(1); }
And then use the display you got inside your query string.
For implementation example, you can refer yourself to the simple-framework project included in our OpenGL ES SDK for linux available here: Mali OpenGL ES SDK for Linux - Mali Developer Center