[Piglit] [PATCH piglit v2] egl: add test for EGL_MESA_query_driver

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 22 16:24:38 UTC 2019


On Tue, 22 Jan 2019 at 15:32, Eric Engestrom <eric.engestrom at intel.com> wrote:
>
> Cc: Veluri Mithun <velurimithun38 at gmail.com>
> Cc: Emil Velikov <emil.l.velikov at gmail.com>
> Cc: Rob Clark <robdclark at gmail.com>
> Cc: Nicolai Hähnle <nicolai.haehnle at amd.com>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> ---
> The extension is currently in development in this MR:
> https://gitlab.freedesktop.org/mesa/mesa/merge_requests/47
>
> Veluri will send updated versions of this test if the spec changes.
> ---
>  tests/egl/spec/CMakeLists.txt                 |   1 +
>  .../CMakeLists.no_api.txt                     |   7 ++
>  .../spec/egl_mesa_query_driver/CMakeLists.txt |   1 +
>  .../egl_mesa_query_driver.c                   | 100 ++++++++++++++++++
>  tests/opengl.py                               |   6 ++
>  5 files changed, 115 insertions(+)
>  create mode 100644 tests/egl/spec/egl_mesa_query_driver/CMakeLists.no_api.txt
>  create mode 100644 tests/egl/spec/egl_mesa_query_driver/CMakeLists.txt
>  create mode 100644 tests/egl/spec/egl_mesa_query_driver/egl_mesa_query_driver.c
>
> diff --git a/tests/egl/spec/CMakeLists.txt b/tests/egl/spec/CMakeLists.txt
> index f38a4f62b6d4139719fb..378c8d7257518a4cc773 100644
> --- a/tests/egl/spec/CMakeLists.txt
> +++ b/tests/egl/spec/CMakeLists.txt
> @@ -12,6 +12,7 @@ add_subdirectory (egl_khr_fence_sync)
>  add_subdirectory (egl_khr_surfaceless_context)
>  add_subdirectory (egl_mesa_device_software)
>  add_subdirectory (egl_mesa_platform_surfaceless)
> +add_subdirectory (egl_mesa_query_driver)
>
>  if (PIGLIT_HAS_X11)
>         add_subdirectory (egl_chromium_sync_control)
> diff --git a/tests/egl/spec/egl_mesa_query_driver/CMakeLists.no_api.txt b/tests/egl/spec/egl_mesa_query_driver/CMakeLists.no_api.txt
> new file mode 100644
> index 00000000000000000000..d6f97ba5d294e930d050
> --- /dev/null
> +++ b/tests/egl/spec/egl_mesa_query_driver/CMakeLists.no_api.txt
> @@ -0,0 +1,7 @@
> +link_libraries(
> +       piglitutil
> +)
> +
> +piglit_add_executable(egl_mesa_query_driver egl_mesa_query_driver.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/egl/spec/egl_mesa_query_driver/CMakeLists.txt b/tests/egl/spec/egl_mesa_query_driver/CMakeLists.txt
> new file mode 100644
> index 00000000000000000000..144a306f4e7d38ba7da8
> --- /dev/null
> +++ b/tests/egl/spec/egl_mesa_query_driver/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/egl/spec/egl_mesa_query_driver/egl_mesa_query_driver.c b/tests/egl/spec/egl_mesa_query_driver/egl_mesa_query_driver.c
> new file mode 100644
> index 00000000000000000000..63d3217607ceac2516d5
> --- /dev/null
> +++ b/tests/egl/spec/egl_mesa_query_driver/egl_mesa_query_driver.c
> @@ -0,0 +1,100 @@
> +/*
> + * Copyright © 2016 Red Hat, Inc.
> + * Copyright 2015 Intel Corporation
> + * Copyright 2018 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 "piglit-util.h"
> +#include "piglit-util-egl.h"
> +
> +#ifndef EGL_MESA_query_driver
> +typedef char *PFNEGLGETDISPLAYDRIVERCONFIGPROC(EGLDisplay disp);
> +typedef const char *PFNEGLGETDISPLAYDRIVERNAMEPROC(EGLDisplay disp);
> +#endif
> +
> +int
> +main(void)
> +{
> +       EGLDisplay egl_display = EGL_NO_DISPLAY;
> +       EGLint egl_major, egl_minor;
> +       EGLint egl_error;
> +       const char *driver_name;
> +       char *driver_config;
> +
> +       egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
> +
> +       piglit_require_egl_extension(egl_display, "EGL_MESA_query_driver");
I think that this will fail with "extension not found".

As we get the extensions via eglQueryString() function will check the
dpy (_eglCheckDisplay) which in turn will
_eglError(EGL_NOT_INITIALIZED)

-Emil


More information about the Piglit mailing list