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
Hi Thomas & Community,
Thanks for follow-up.
I cant use egGetdisplay() as my application(Conformance test suite) uses eglGetPlatformDisplayEXT. Should I disable this method of getting display and use method as mentioned above reply?Also I dont know what must be needed from vender/libMali.so side in order to use eglGetPlatformDisplayEXT() API?
Reference : https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_platform_base.txt
BR,
If I understand the problem correctly, :
And therefore you have a circular dependencies problem.
One basic way to check if eglGetPlatformDisplayEXT is available on some platforms is to use dlsym. Something akin to :
EGLDisplay display; if (dlsym(NULL, "eglGetPlatformDisplayEXT")) { display = eglGetPlatformDisplayEXT(...); ... } else { display = eglGetDisplay(your_own_getNativeDisplay_procedure()); ... }
dlsym(NULL, "symbolName") will search for symbolName in the current program and all the shared libraries dependencies declared in the current program executable file.
Would you be able to send me the reference of the hardware you are using or at least the version of the Mali driver?
To do so you can use the following command:
strings libMali.so | grep -E "r[0-9]*p[0-9]-[0-9]*rel[0-9]"
Also could you send the code inside the function getPlatformExtensions, and what exactly the error you got was?
For code formatting you can use the advanced editor syntax highlighting option (Reply -> Advanced Editor top right -> Double > symbol).
Cheers,
Thomas
Exactly. Its circular dependency problem .
I will try out one above basic way and come back with results.
VK
Hi Thomas,
I am using r5p1 driver.Please find output of strings libMali.so | grep -E "r[0-9]*p[0-9]-[0-9]*rel[0-9]" :
gles: BUILD=RELEASE ARCH=arch_011_udd PLATFORM=default_8a TRACE=0 THREAD= GEOM=mali_gp_geometry_common CORES=MALI400 USING_MALI400=1 TARGET_CORE_REVISION=0x0101 TOPLEVEL_REPO_URL=14c81bf REVISION=14c81bf CHANGED_REVISION=14c81bf REPO_URL=remotes/origin/r5p1-01rel0-compiler-10-g14c81bf BUILD_DATE=Wed Jun 1 16:00:15 UTC 2016 CHANGE_DATE=2016-05-19 23:26:47 +0000 TARGET_TOOLCHAIN=aarch64-linux-gcc HOST_TOOLCHAIN=gcc TARGET_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) HOST_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) TARGET_SYSTEM=aarch64-linux-gcc HOST_SYSTEM=gcc-aarch64-linux CPPFLAGS= CUSTOMER=internal VARIANT=mali400-r1p1-gles20-gles11-dma_buf-linux--no_Werror HOSTLIB=direct INSTRUMENTED=FALSE USING_MRI=FALSE MALI_TEST_API= UDD_OS=linux gles20: BUILD=RELEASE ARCH=arch_011_udd PLATFORM=default_8a TRACE=0 THREAD= GEOM=mali_gp_geometry_common CORES=MALI400 USING_MALI400=1 TARGET_CORE_REVISION=0x0101 TOPLEVEL_REPO_URL=14c81bf REVISION=14c81bf CHANGED_REVISION=14c81bf REPO_URL=remotes/origin/r5p1-01rel0-compiler-10-g14c81bf BUILD_DATE=Wed Jun 1 16:00:15 UTC 2016 CHANGE_DATE=2016-05-19 23:26:47 +0000 TARGET_TOOLCHAIN=aarch64-linux-gcc HOST_TOOLCHAIN=gcc TARGET_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) HOST_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) TARGET_SYSTEM=aarch64-linux-gcc HOST_SYSTEM=gcc-aarch64-linux CPPFLAGS= CUSTOMER=internal VARIANT=mali400-r1p1-gles20-gles11-dma_buf-linux--no_Werror HOSTLIB=direct INSTRUMENTED=FALSE USING_MRI=FALSE MALI_TEST_API= UDD_OS=linux 1.4 Linux-r5p1-01rel0 egl: BUILD=RELEASE ARCH=arch_011_udd PLATFORM=default_8a TRACE=0 THREAD= GEOM= CORES=MALI400 USING_MALI400=1 TARGET_CORE_REVISION=0x0101 TOPLEVEL_REPO_URL=537f1be REVISION=537f1be CHANGED_REVISION=537f1be REPO_URL=remotes/origin/r5p1-01rel0-compiler-11-g537f1be BUILD_DATE=Fri Jun 10 07:45:50 UTC 2016 CHANGE_DATE=2016-06-01 16:05:33 +0000 TARGET_TOOLCHAIN=aarch64-linux-gcc HOST_TOOLCHAIN=gcc TARGET_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) HOST_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) TARGET_SYSTEM=aarch64-linux-gcc HOST_SYSTEM=gcc-aarch64-linux CPPFLAGS= CUSTOMER=internal VARIANT=mali400-r1p1-gles20-gles11-dma_buf-linux--no_Werror HOSTLIB=direct INSTRUMENTED=FALSE USING_MRI=FALSE MALI_TEST_API= UDD_OS=linux base: BUILD=RELEASE ARCH=arch_011_udd PLATFORM=default_8a TRACE=0 THREAD= GEOM= CORES=MALI400 USING_MALI400=1 TARGET_CORE_REVISION=0x0101 TOPLEVEL_REPO_URL=14c81bf REVISION=14c81bf CHANGED_REVISION=14c81bf REPO_URL=remotes/origin/r5p1-01rel0-compiler-10-g14c81bf BUILD_DATE=Wed Jun 1 16:00:15 UTC 2016 CHANGE_DATE=2016-05-19 23:26:47 +0000 TARGET_TOOLCHAIN=aarch64-linux-gcc HOST_TOOLCHAIN=gcc TARGET_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) HOST_TOOLCHAIN_VERSION=gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) TARGET_SYSTEM=aarch64-linux-gcc HOST_SYSTEM=gcc-aarch64-linux CPPFLAGS= CUSTOMER=internal VARIANT=mali400-r1p1-gles20-gles11-dma_buf-linux--no_Werror HOSTLIB=direct INSTRUMENTED=FALSE USING_MRI=FALSE MALI_TEST_API= UDD_OS=linux Mali online shader compiler r5p1-01rel0 [Revision 96995].
Code inside the function getPlatformExtensions:
vector<string> getExtensions (const Library& egl, EGLDisplay display) { const char* const extensionStr = egl.queryString(display, EGL_EXTENSIONS); EGLU_CHECK_MSG(egl, "Querying extensions failed"); return de::splitString(extensionStr, ' '); } vector<string> getPlatformExtensions (const Library& egl) { tcu::print("#####GET EXTENSSS DISPLAY\n "); return getExtensions(egl, EGL_NO_DISPLAY); }
I am getting error EGL_BAD_DISPLAY at line no 03 of above code.(i.e. while querying string)
I checked in our driver and in r5p1 EGL_EXT_platform_base was not yet implemented.
If EGL_EXT_platform_base was implemented eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS) would have been a valid function call (see Additions third paragraph).
The best way to solve your problem would be to follow myy answer and branch based on the output of the available symbols query.