Bug 66886 - eglChooseConfig returns true even if it fails matching the config
Summary: eglChooseConfig returns true even if it fails matching the config
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-14 03:37 UTC by Francois Coulombe
Modified: 2019-09-18 18:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Francois Coulombe 2013-07-14 03:37:20 UTC
eglconfig.c:727
i think this should return false
http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglChooseConfig.html

i was trying to run this function with 
const EGLint pi32ConfigAttribs[] =
    {
        EGL_LEVEL,				0,
        EGL_SURFACE_TYPE,		EGL_WINDOW_BIT,
        EGL_RENDERABLE_TYPE,	EGL_OPENGL_ES2_BIT,
        EGL_NATIVE_RENDERABLE,	EGL_FALSE,
        EGL_DEPTH_SIZE,			EGL_DONT_CARE,
        EGL_NONE
    };
and it would fail matching a config but the function would return true letting me think that everything went fine.

https://bugs.freedesktop.org/show_bug.cgi?id=50870 <-- might be similar to this 

i changed the data to this
	EGLint pi32ConfigAttribs[5];
	pi32ConfigAttribs[0] = EGL_SURFACE_TYPE;
	pi32ConfigAttribs[1] = EGL_WINDOW_BIT;
	pi32ConfigAttribs[2] = EGL_RENDERABLE_TYPE;
	pi32ConfigAttribs[3] = EGL_OPENGL_ES2_BIT;
	pi32ConfigAttribs[4] = EGL_NONE;
and it worked
Comment 1 Chad Versace 2013-07-16 15:59:32 UTC
From my understanding of the EGL spec, Mesa behaves correctly.

eglChooseConfig should return false only if an error occured. And, if an error occurred, then there is always an accompanying error emitted by eglGetError. Suppose that the user calls eglChooseConfig, passes it a valid attribute list, no internal EGL errors occur, and the EGL implementation determines that no available config matches the requested attribute list. No error has actually occured. Moreover, there is no EGL error code appropriate for this situation. If no error gets emitted, then there is no error.

If you are checking only the return code of eglChooseConfig, then you use the function incorrectly. If the function succeeds, you must inspect the 'num_config' out-param before reading the 'configs' output. If no configs were returned, and no error occurred, then 'num_config' will be 0. However, you must check the return value of eglChooseConfig for failure *before* checking 'num_config', because 'num_config' remains unmodified when the function fails, according to the spec.

Francois, for your first example attribute list, did eglChooseConfg set 'num_config' to 0? If so, then the bug should be closed as NOTABUG.
Comment 2 GitLab Migration User 2019-09-18 18:05:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/148.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.