summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2019-12-16 17:46:02 +0200
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>2020-01-08 18:12:03 +0200
commitc85fad35569a09c11edff0f921aad9c5a34d63b7 (patch)
tree8ed9967f0c0efe68a1b135cbd086a716cf646315
parent8a9045c65b446f5ecae7a69a6d545fa39a754288 (diff)
tests: add test for assert in INTEL_performance_query
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2235
-rw-r--r--tests/opengl.py6
-rw-r--r--tests/spec/CMakeLists.txt1
-rw-r--r--tests/spec/intel_performance_query/CMakeLists.gl.txt13
-rw-r--r--tests/spec/intel_performance_query/CMakeLists.txt1
-rw-r--r--tests/spec/intel_performance_query/issue_2235.c93
5 files changed, 114 insertions, 0 deletions
diff --git a/tests/opengl.py b/tests/opengl.py
index 2a16ca1a1..4d0cf3b76 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -5062,6 +5062,12 @@ with profile.test_list.group_manager(
g(['intel_blackhole-draw_gles2'])
g(['intel_blackhole-draw_gles3'])
+# Group INTEL_performance_query
+with profile.test_list.group_manager(
+ PiglitGLTest,
+ grouptools.join('spec', 'INTEL_performance_query')) as g:
+ g(['intel_performance_query-issue_2235'])
+
# Group ARB_bindless_texture
with profile.test_list.group_manager(
PiglitGLTest,
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 974d7fd6b..95403263b 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -195,3 +195,4 @@ add_subdirectory (khr_parallel_shader_compile)
add_subdirectory (ext_direct_state_access)
add_subdirectory (arb_gpu_shader_int64)
add_subdirectory (oes_egl_image_external_essl3)
+add_subdirectory (intel_performance_query)
diff --git a/tests/spec/intel_performance_query/CMakeLists.gl.txt b/tests/spec/intel_performance_query/CMakeLists.gl.txt
new file mode 100644
index 000000000..78d25cd18
--- /dev/null
+++ b/tests/spec/intel_performance_query/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (intel_performance_query-issue_2235 issue_2235.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/intel_performance_query/CMakeLists.txt b/tests/spec/intel_performance_query/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/intel_performance_query/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/intel_performance_query/issue_2235.c b/tests/spec/intel_performance_query/issue_2235.c
new file mode 100644
index 000000000..71ae568e0
--- /dev/null
+++ b/tests/spec/intel_performance_query/issue_2235.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * 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.
+ */
+
+/**
+ * @file issue_2235.c
+ * @author Lionel Landwerlin
+ *
+ * Reproduction for INTEL performance query assert when tearing down a
+ * context with an active query.
+ */
+
+#include <time.h>
+
+#include "piglit-util-egl.h"
+#include "piglit-util-gl.h"
+
+int main(int argc, char **argv)
+{
+ EGLint major, minor;
+ EGLDisplay dpy;
+ EGLContext ctx1;
+ EGLint attr[] = {
+ EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
+ EGL_CONTEXT_MINOR_VERSION_KHR, 2,
+ EGL_NONE
+ };
+ GLuint query, query_handle;
+ bool ok;
+
+ dpy = piglit_egl_get_default_display(EGL_NONE);
+
+ ok = eglInitialize(dpy, &major, &minor);
+ if (!ok) {
+ piglit_report_result(PIGLIT_FAIL);
+ return -1;
+ }
+
+ ctx1 = eglCreateContext(dpy, EGL_NO_CONFIG_KHR, EGL_NO_CONTEXT, attr);
+
+ if (!ctx1) {
+ piglit_report_result(PIGLIT_FAIL);
+ return -1;
+ }
+
+ dpy = piglit_egl_get_default_display(EGL_NONE);
+ /*
+ * Bind first context, make some shaders, draw something.
+ */
+ eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx1);
+
+ piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
+
+ piglit_require_extension("GL_INTEL_performance_query");
+
+ glGetFirstPerfQueryIdINTEL(&query);
+ if (!query) {
+ /* No query available */
+ piglit_report_result(PIGLIT_SKIP);
+ return 0;
+ }
+
+ glCreatePerfQueryINTEL(query, &query_handle);
+
+ glBeginPerfQueryINTEL(query_handle);
+
+ eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+
+ eglDestroyContext(dpy, ctx1);
+
+ piglit_report_result(PIGLIT_PASS);
+
+ return 0;
+}