[Piglit] [PATCH] egl: test that EGL_BAD_PARAMETER is returned for an invalid EGLImage attrib

Micah Fedke micah.fedke at collabora.co.uk
Tue Jan 10 14:42:06 UTC 2017


You're right, I was testing it with the x11_egl platform only, where 
much of the EGL setup is done implicitly by waffle.  Will resubmit an 
egl-util platform reroll.


-mf

On 01/10/2017 05:51 AM, Tapani Pälli wrote:
> This test does not work correctly for me (skips because
> EGL_KHR_image_base is unsupported even though driver supports it). I
> believe you either would need to utilize egl-util framework (check the
> other tests in egl directory) or initialize EGL manually ground up like
> some tests do. Or is this depending on some compilation flags of Piglit?
>
> On 01/09/2017 10:16 PM, Micah Fedke wrote:
>> This tests the following statement from EGL_KHR_image_base.txt:
>> If an attribute specified in <attrib_list> is not one of the attributes
>> listed in Table bbb, the error EGL_BAD_PARAMETER is generated.
>>
>> Signed-off-by: Micah Fedke <micah.fedke at collabora.co.uk>
>> ---
>>  tests/all.py                 |  2 +
>>  tests/egl/CMakeLists.gl.txt  |  2 +
>>  tests/egl/egl-invalid-attr.c | 97
>> ++++++++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 101 insertions(+)
>>  create mode 100644 tests/egl/egl-invalid-attr.c
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index 93d64e6..fdc1947 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -4394,6 +4394,8 @@ with profile.group_manager(
>>      g(['egl-create-largest-pbuffer-surface'],
>>        'largest possible eglCreatePbufferSurface and then glClear',
>>        run_concurrent=False)
>> +    g(['egl-invalid-attr'],
>> +      run_concurrent=False)
>>
>>  with profile.group_manager(
>>          PiglitGLTest,
>> diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
>> index 06fbecb..7a3eb6d 100644
>> --- a/tests/egl/CMakeLists.gl.txt
>> +++ b/tests/egl/CMakeLists.gl.txt
>> @@ -27,6 +27,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>>      target_link_libraries(egl-configless-context pthread ${X11_X11_LIB})
>>      piglit_add_executable (egl-gl-colorspace egl-util.c
>> egl-gl-colorspace.c)
>>      target_link_libraries(egl-gl-colorspace pthread ${X11_X11_LIB})
>> +    piglit_add_executable (egl-invalid-attr egl-invalid-attr.c)
>> +    target_link_libraries(egl-invalid-attr pthread ${X11_X11_LIB})
>>  ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>>
>>  # vim: ft=cmake:
>> diff --git a/tests/egl/egl-invalid-attr.c b/tests/egl/egl-invalid-attr.c
>> new file mode 100644
>> index 0000000..52f3af0
>> --- /dev/null
>> +++ b/tests/egl/egl-invalid-attr.c
>> @@ -0,0 +1,97 @@
>> +/*
>> + * Copyright © 2016 Collabora Ltd.
>> + *
>> + * Permission is hereby granted, free of charge, to any person
>> obtaining a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including
>> the next
>> + * paragraph) shall be included in all copies or substantial portions
>> of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
>> SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
>> OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
>> OTHER DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +#include <unistd.h>
>> +#include <drm_fourcc.h>
>> +
>> +#include "piglit-util-egl.h"
>> +#include "piglit-util-gl.h"
>> +
>> +/**
>> + * @file egl-invalid-attr.c
>> + *
>> + * From EGL_KHR_image_base.txt: If an attribute specified in
>> <attrib_list> is
>> + * not one of the attributes listed in Table bbb, the error
>> EGL_BAD_PARAMETER
>> + * is generated.
>> + */
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +        config.supports_gl_core_version = 31;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +    GLuint tex;
>> +    enum piglit_result result = PIGLIT_FAIL;
>> +    const unsigned char src[] = { 0x00, 0x00, 0x00, 0x00 };
>> +    EGLint attr[] = {
>> +        0xFFFF, 0, //invalid attr
>> +        EGL_NONE
>> +    };
>> +    PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR = NULL;
>> +
>> +    if (piglit_is_egl_extension_supported (eglGetCurrentDisplay(),
>> +                                               "EGL_KHR_image_base")) {
>> +        eglCreateImageKHR =
>> +                   (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress
>> ("eglCreateImageKHR");
>> +    } else {
>> +        printf ("could not get address for eglCreateImageKHR,
>> skipping\n");
>> +        return PIGLIT_SKIP;
>> +    }
>> +
>> +    glGenTextures(1, &tex);
>> +    glBindTexture(GL_TEXTURE_2D, tex);
>> +
>> +    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
>> +           GL_UNSIGNED_BYTE, src);
>> +
>> +    if (piglit_is_egl_extension_supported (eglGetCurrentDisplay(),
>> +
>> "EGL_KHR_gl_texture_2D_image")) {
>> +        eglCreateImageKHR(eglGetCurrentDisplay(),
>> +                                  eglGetCurrentContext(),
>> +                                  EGL_GL_TEXTURE_2D_KHR,
>> +                                  (EGLClientBuffer)(intptr_t)tex,
>> +                                  attr);
>> +        } else {
>> +        printf ("EGL_KHR_gl_texture_2D_image not available,
>> skipping\n");
>> +        return PIGLIT_SKIP;
>> +        }
>> +
>> +    if (piglit_check_egl_error(EGL_BAD_PARAMETER)) {
>> +        result = PIGLIT_PASS;
>> +    }
>> +
>> +    glDeleteTextures(1, &tex);
>> +
>> +
>> +    return result;
>> +}
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +}
>>

-- 

Micah Fedke
Collabora Ltd.
+44 1223 362967
https://www.collabora.com/
https://twitter.com/collaboraltd


More information about the Piglit mailing list