aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2012-09-30 17:25:29 -0700
committerJordan Justen <jordan.l.justen@intel.com>2012-10-19 18:10:43 -0700
commitb3e3b82f65b5aefede8baf1287bdac135ad97e7b (patch)
treefaa861a300f7468e647ec7baae39f79e3a07537f
parent12d99db8866a4715d2dcf7c303547bfacfdd45e3 (diff)
downloadpiglit-b3e3b82f65b5aefede8baf1287bdac135ad97e7b.tar.gz
piglit framework: add gbm support
Use gbm for testing if the PIGLIT_PLATFORM environment variable is set to gbm. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--CMakeLists.txt3
-rw-r--r--tests/util/CMakeLists.txt1
-rw-r--r--tests/util/piglit-framework-gl/piglit_gbm_framework.c78
-rw-r--r--tests/util/piglit-framework-gl/piglit_gbm_framework.h29
-rw-r--r--tests/util/piglit-framework-gl/piglit_wfl_framework.c10
-rw-r--r--tests/util/piglit-framework-gl/piglit_winsys_framework.c6
6 files changed, 127 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4854b6e..51db413d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,9 @@ if(PIGLIT_BUILD_CL_TESTS)
endif(PIGLIT_BUILD_CL_TESTS)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ set(PIGLIT_HAS_GBM True)
+ add_definitions(-DPIGLIT_HAS_GBM)
+
set(PIGLIT_HAS_X11 True)
add_definitions(-DPIGLIT_HAS_X11)
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index bb29c625..a4784b1d 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -27,6 +27,7 @@ set(UTIL_GL_SOURCES
if(PIGLIT_USE_WAFFLE)
list(APPEND UTIL_GL_SOURCES
+ piglit-framework-gl/piglit_gbm_framework.c
piglit-framework-gl/piglit_fbo_framework.c
piglit-framework-gl/piglit_wfl_framework.c
piglit-framework-gl/piglit_winsys_framework.c
diff --git a/tests/util/piglit-framework-gl/piglit_gbm_framework.c b/tests/util/piglit-framework-gl/piglit_gbm_framework.c
new file mode 100644
index 00000000..4df38612
--- /dev/null
+++ b/tests/util/piglit-framework-gl/piglit_gbm_framework.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2012 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 <assert.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "piglit-util-gl-common.h"
+#include "piglit_gbm_framework.h"
+
+static void
+enter_event_loop(struct piglit_winsys_framework *winsys_fw)
+{
+}
+
+static void
+show_window(struct piglit_winsys_framework *winsys_fw)
+{
+ waffle_window_show(winsys_fw->wfl_fw.window);
+}
+
+static void
+destroy(struct piglit_gl_framework *gl_fw)
+{
+ struct piglit_winsys_framework *winsys_fw= piglit_winsys_framework(gl_fw);
+
+ if (winsys_fw == NULL)
+ return;
+
+ piglit_winsys_framework_teardown(winsys_fw);
+ free(winsys_fw);
+}
+
+struct piglit_gl_framework*
+piglit_gbm_framework_create(const struct piglit_gl_test_config *test_config)
+{
+ struct piglit_winsys_framework *winsys_fw = NULL;
+ struct piglit_gl_framework *gl_fw = NULL;
+ bool ok = true;
+
+ winsys_fw = calloc(1, sizeof(*winsys_fw));
+ gl_fw = &winsys_fw->wfl_fw.gl_fw;
+
+ ok = piglit_winsys_framework_init(winsys_fw, test_config,
+ WAFFLE_PLATFORM_GBM);
+ if (!ok)
+ goto fail;
+
+ winsys_fw->show_window = show_window;
+ winsys_fw->enter_event_loop = enter_event_loop;
+ gl_fw->destroy = destroy;
+
+ return gl_fw;
+
+fail:
+ destroy(gl_fw);
+ return NULL;
+}
diff --git a/tests/util/piglit-framework-gl/piglit_gbm_framework.h b/tests/util/piglit-framework-gl/piglit_gbm_framework.h
new file mode 100644
index 00000000..2fd97790
--- /dev/null
+++ b/tests/util/piglit-framework-gl/piglit_gbm_framework.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2012 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.
+ */
+
+#pragma once
+
+#include "piglit_winsys_framework.h"
+
+struct piglit_gl_framework*
+piglit_gbm_framework_create(const struct piglit_gl_test_config *test_config);
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index 1bce65e9..600ac088 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -56,6 +56,16 @@ piglit_wfl_framework_choose_platform(void)
#endif
}
+ else if (strcmp(env, "gbm") == 0) {
+#ifdef PIGLIT_HAS_GBM
+ return WAFFLE_PLATFORM_GBM;
+#else
+ fprintf(stderr, "environment var PIGLIT_PLATFORM=gbm, but "
+ "piglit was built without GBM support\n");
+ piglit_report_result(PIGLIT_FAIL);
+#endif
+ }
+
else if (strcmp(env, "glx") == 0) {
#ifdef PIGLIT_HAS_GLX
return WAFFLE_PLATFORM_GLX;
diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
index 3e4c4182..ebc938c8 100644
--- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
@@ -27,6 +27,7 @@
#include "piglit-util-gl-common.h"
#include "piglit-util-waffle.h"
+#include "piglit_gbm_framework.h"
#include "piglit_gl_framework.h"
#include "piglit_winsys_framework.h"
#include "piglit_wl_framework.h"
@@ -141,6 +142,11 @@ piglit_winsys_framework_factory(const struct piglit_gl_test_config *test_config)
return piglit_x11_framework_create(test_config, platform);
#endif
+#ifdef PIGLIT_HAS_GBM
+ case WAFFLE_PLATFORM_GBM:
+ return piglit_gbm_framework_create(test_config);
+#endif
+
/* There is no need to #ifdef out Piglit support for Wayland yet
* because Piglit calls no Wayland functions.
*/