summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2017-12-19 09:43:17 +0200
committerTapani Pälli <tapani.palli@intel.com>2018-03-02 10:48:28 +0200
commitb8e7cc0e59cf21fe5f98a2d8280cf9a03d02f542 (patch)
tree462756bde6d74549948d210d650a26310d418fdd /tests
parent2879b1ef60d4dfdbae88e6795426ab1342de5ba3 (diff)
egl: API test for EGL_ANDROID_blob_cache extension
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/all.py1
-rw-r--r--tests/egl/CMakeLists.gles2.txt18
-rw-r--r--tests/egl/egl-blob-cache.c109
3 files changed, 128 insertions, 0 deletions
diff --git a/tests/all.py b/tests/all.py
index 9bd9d5b10..4cd911fab 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4534,6 +4534,7 @@ with profile.test_list.group_manager(
run_concurrent=False)
g(['egl-invalid-attr'])
g(['egl-context-priority'])
+ g(['egl-blob-cache'])
with profile.test_list.group_manager(
PiglitGLTest,
diff --git a/tests/egl/CMakeLists.gles2.txt b/tests/egl/CMakeLists.gles2.txt
new file mode 100644
index 000000000..f6e69d9b0
--- /dev/null
+++ b/tests/egl/CMakeLists.gles2.txt
@@ -0,0 +1,18 @@
+
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${EGL_LDFLAGS}
+ ${OPENGL_gl_LIBRARY}
+)
+
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ piglit_add_executable (egl-blob-cache egl-blob-cache.c)
+ target_link_libraries(egl-blob-cache pthread)
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+# vim: ft=cmake:
diff --git a/tests/egl/egl-blob-cache.c b/tests/egl/egl-blob-cache.c
new file mode 100644
index 000000000..81af606fe
--- /dev/null
+++ b/tests/egl/egl-blob-cache.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2017 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.
+ */
+
+#include "piglit-util-egl.h"
+#include "piglit-util-gl.h"
+
+/**
+ * @file egl-blob-cache.c
+ *
+ * EGL API tests for EGL_ANDROID_blob_cache extension:
+ * https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_blob_cache.txt
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/* dummy */
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+static void
+set_blob(const void* key, EGLsizeiANDROID keySize,
+ const void* value, EGLsizeiANDROID valueSize)
+{
+}
+
+static EGLsizeiANDROID
+get_blob(const void* key, EGLsizeiANDROID keySize, void* value,
+ EGLsizeiANDROID valueSize)
+{
+ return 0;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ EGLint major, minor;
+ EGLDisplay dpy;
+
+ /* Require EGL_MESA_platform_surfaceless extension. */
+ const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ if (!strstr(exts, "EGL_MESA_platform_surfaceless"))
+ piglit_report_result(PIGLIT_SKIP);
+
+ dpy = piglit_egl_get_default_display(EGL_PLATFORM_SURFACELESS_MESA);
+
+ if (!eglInitialize(dpy, &major, &minor))
+ piglit_report_result(PIGLIT_FAIL);
+
+ piglit_require_egl_extension(dpy, "EGL_MESA_configless_context");
+ piglit_require_egl_extension(dpy, "EGL_ANDROID_blob_cache");
+
+ PFNEGLSETBLOBCACHEFUNCSANDROIDPROC peglSetBlobCacheFuncs =
+ (PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)
+ eglGetProcAddress ("eglSetBlobCacheFuncsANDROID");
+
+ if (!peglSetBlobCacheFuncs)
+ piglit_report_result(PIGLIT_FAIL);
+
+#define EXPECT(x) if (!piglit_check_egl_error(x)) piglit_report_result(PIGLIT_FAIL);
+
+ /* Check error cases for passing NULL. */
+ peglSetBlobCacheFuncs(dpy, NULL, NULL);
+ EXPECT(EGL_BAD_PARAMETER);
+
+ peglSetBlobCacheFuncs(dpy, set_blob, NULL);
+ EXPECT(EGL_BAD_PARAMETER);
+
+ peglSetBlobCacheFuncs(dpy, NULL, get_blob);
+ EXPECT(EGL_BAD_PARAMETER);
+
+ /* Successful call. */
+ peglSetBlobCacheFuncs(dpy, set_blob, get_blob);
+ EXPECT(EGL_SUCCESS);
+
+ /* Failure, functions already set. */
+ peglSetBlobCacheFuncs(dpy, set_blob, get_blob);
+ EXPECT(EGL_BAD_PARAMETER);
+
+#undef EXPECT
+
+ piglit_report_result(PIGLIT_PASS);
+}