Re: [Piglit] [PATCH piglit v2] egl: add test for EGL_MESA_query_driver
On Tue, 22 Jan 2019 at 15:32, Eric Engestrom wrote: > > Cc: Veluri Mithun > Cc: Emil Velikov > Cc: Rob Clark > Cc: Nicolai Hähnle > Signed-off-by: Eric Engestrom > --- > 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 ..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 ..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 ..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 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH piglit v2] egl: add test for EGL_MESA_query_driver
Cc: Veluri Mithun Cc: Emil Velikov Cc: Rob Clark Cc: Nicolai Hähnle Signed-off-by: Eric Engestrom --- 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 ..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 ..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 ..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"); + + PFNEGLGETDISPLAYDRIVERNAMEPROC *GetDisplayDriverName = + (void *)eglGetProcAddress("eglGetDisplayDriverName"); + PFNEGLGETDISPLAYDRIVERCONFIGPROC *GetDisplayDriverconfig = + (void *)eglGetProcAddress("eglGetDisplayDriverconfig"); + + if (!GetDisplayDriverName || !GetDisplayDriverconfig) { + printf("Query driver entrypoints missing\n"); + piglit_report_result(PIGLIT_FAIL); + } + + driver_name = GetDisplayDriverName(EGL_NO_DISPLAY); + if (!piglit_check_egl_error(EGL_BAD_DISPLAY)) + piglit_report_result(PIGLIT_FAIL); + + driver_config = GetDisplayDriverconfig(EGL_NO_DISPLAY); + if (!piglit_check_egl_error(EGL_BAD_DISPLAY)) { +