[Piglit] [PATCH 2/2] egl_khr_create_context: Explain why context creation must succeed

Matt Turner mattst88 at gmail.com
Mon Jan 28 17:32:28 PST 2013


On Mon, Jan 28, 2013 at 5:04 PM, Chad Versace
<chad.versace at linux.intel.com> wrote:
> In test egl_khr_create_context/default-minor-version-gl, context creation
> is not required to succeed. When it fails, the test skips.
>
> However, for tests default-{major,minor}-version-gles, context creation
> *is*  required to succeed. This patch adds comments explaining why,
>
> CC: Matt Turner <mattst88 at gmail.com>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  tests/egl/spec/egl_khr_create_context/default-major-version-gles.c | 3 +++
>  tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c | 4 ++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c b/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
> index cf61e01..e7da845 100644
> --- a/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
> +++ b/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
> @@ -45,6 +45,9 @@ int main(int argc, char **argv)
>          * Request an OpenGL ES 1.x context by explicitly setting the minor
>          * version to 0 and leaving the major version at the default value of
>          * 1.
> +        *
> +        * The EGL_OPENGL_ES_BIT is set in EGLConfig's EGL_RENDERABLE_TYPE,
> +        * so the driver is required to succeed in creating an ES1 context.
>          */
>         ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);
>         if (ctx == EGL_NO_CONTEXT) {
> diff --git a/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c b/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c
> index 2331832..5fbb8d4 100644
> --- a/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c
> +++ b/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c
> @@ -49,6 +49,10 @@ int main(int argc, char **argv)
>          * Request an OpenGL ES 1.x or 2.0 context by explicitly setting the
>          * major version and leaving the minor version at the default value of
>          * 0.
> +        *
> +        * The EGLConfig's EGL_RENDERABLE_TYPE and the attribute list's
> +        * EGL_CONTEXT_MAJOR_VERSION_KHR have been chosen so that the driver
> +        * is required to succeed at context creation.
>          */
>         ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);
>         if (ctx == EGL_NO_CONTEXT) {
> --
> 1.8.1.1

I had to go back and look at the test to understand. Basically if
we've gotten to eglCreateContext it's because we already have done
this:

        if (!EGL_KHR_create_context_setup(EGL_OPENGL_ES_BIT)) {
                fprintf(stderr, "ES 1 not available, trying ES 2.\n");
                attribs[1] = 2;
                if (!EGL_KHR_create_context_setup(EGL_OPENGL_ES2_BIT)) {
                        fprintf(stderr, "ES 2 not available.\n");
                        piglit_report_result(PIGLIT_SKIP);
                }
        }

which requires that the ES1 or ES2 bit is set (and attribs[1] is set
to the major version).

I guess there's something about the wording "have been chosen" that
tripped me up. It's more like "we've already asked the driver and it
said yes, so it can't back out now."

In any case: Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the Piglit mailing list