diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2012-09-14 00:38:51 +0300 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2012-10-09 19:08:31 -0700 |
commit | c4ac466824952a90e0373bd57d9e164c7751dd6d (patch) | |
tree | b604eb3de8b0a97b1514fa5060f450b7de2f74a6 | |
parent | 05c8d2e058af7c63043da9880bc8e88ed66353b1 (diff) |
util,glut_waffle: Remove unused sources from old GL test framework
Remove directory src/glut_waffle.
Remove piglit-framework-{fbo,glut}*.
Reviewed-and-tested-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r-- | src/glut_waffle/CMakeLists.no_api.txt | 11 | ||||
-rw-r--r-- | src/glut_waffle/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/glut_waffle/README.txt | 5 | ||||
-rw-r--r-- | src/glut_waffle/TODO.txt | 2 | ||||
-rw-r--r-- | src/glut_waffle/glut_waffle.c | 352 | ||||
-rw-r--r-- | src/glut_waffle/glut_waffle.h | 72 | ||||
-rw-r--r-- | src/glut_waffle/priv/common.c | 66 | ||||
-rw-r--r-- | src/glut_waffle/priv/common.h | 81 | ||||
-rw-r--r-- | src/glut_waffle/priv/x11.c | 89 | ||||
-rw-r--r-- | src/glut_waffle/priv/x11.h | 31 | ||||
-rw-r--r-- | tests/util/piglit-framework-fbo.c | 349 | ||||
-rw-r--r-- | tests/util/piglit-framework-fbo.h | 35 | ||||
-rw-r--r-- | tests/util/piglit-framework-glut.c | 155 | ||||
-rw-r--r-- | tests/util/piglit-framework-glut.h | 37 |
14 files changed, 0 insertions, 1288 deletions
diff --git a/src/glut_waffle/CMakeLists.no_api.txt b/src/glut_waffle/CMakeLists.no_api.txt deleted file mode 100644 index 780f01a3a..000000000 --- a/src/glut_waffle/CMakeLists.no_api.txt +++ /dev/null @@ -1,11 +0,0 @@ -link_libraries( - ${WAFFLE_LIBRARIES} - X11 - ) - -add_library(glut_waffle SHARED - glut_waffle.c - - priv/common.c - priv/x11.c - ) diff --git a/src/glut_waffle/CMakeLists.txt b/src/glut_waffle/CMakeLists.txt deleted file mode 100644 index c88d07279..000000000 --- a/src/glut_waffle/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -include_directories(.) - -piglit_include_target_api() diff --git a/src/glut_waffle/README.txt b/src/glut_waffle/README.txt deleted file mode 100644 index a8fe20e37..000000000 --- a/src/glut_waffle/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -glut_waffle is transitionary only and not intended to be a permanent -addition to Piglit. Its purpose is to make Piglit's transition from GLUT -to Waffle go smoothly. Once the transition is complete, piglit-framework.c -will be updated to use Waffle directly, and libglut_waffle will be -removed. diff --git a/src/glut_waffle/TODO.txt b/src/glut_waffle/TODO.txt deleted file mode 100644 index 866382575..000000000 --- a/src/glut_waffle/TODO.txt +++ /dev/null @@ -1,2 +0,0 @@ -* Support basic input. -* Support multiple windows. diff --git a/src/glut_waffle/glut_waffle.c b/src/glut_waffle/glut_waffle.c deleted file mode 100644 index 5496edb0b..000000000 --- a/src/glut_waffle/glut_waffle.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2012 Intel Corporation - * Copyright 2010 LunarG Inc. - * - * 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 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 <stdarg.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <waffle_glx.h> -#include <waffle_x11_egl.h> - -#include "priv/common.h" - -#ifdef PIGLIT_HAS_X11 -# include "priv/x11.h" -#endif - -void -glutInitAPIMask(int mask) -{ - switch (mask) { - case GLUT_OPENGL_BIT: - _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL; - break; - case GLUT_OPENGL_ES1_BIT: - _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES1; - break; - case GLUT_OPENGL_ES2_BIT: - _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES2; - break; - default: - glutFatal("api_mask has bad value %#x", mask); - break; - } -} - -void -glutInit(int *argcp, char **argv) -{ - const char *piglit_platform; - const char *display_name = NULL; - bool ok = true; - int i; - - int32_t waffle_init_attrib_list[] = { - WAFFLE_PLATFORM, 0x31415925, - 0, - }; - - for (i = 1; i < *argcp; i++) { - if (strcmp(argv[i], "-display") == 0) - display_name = argv[++i]; - else if (strcmp(argv[i], "-info") == 0) { - printf("waffle_glut: ignoring -info\n"); - } - } - - _glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL; - - piglit_platform = getenv("PIGLIT_PLATFORM"); - if (piglit_platform == NULL) { - _glut->waffle_platform = WAFFLE_PLATFORM_GLX; - } else if (!strcmp(piglit_platform, "glx")) { - _glut->waffle_platform = WAFFLE_PLATFORM_GLX; - } else if (!strcmp(piglit_platform, "x11_egl")) { - _glut->waffle_platform = WAFFLE_PLATFORM_X11_EGL; - } else if (!strcmp(piglit_platform, "wayland")) { - _glut->waffle_platform = WAFFLE_PLATFORM_WAYLAND; - } else { - glutFatal("environment var PIGLIT_PLATFORM has bad " - "value \"%s\"", piglit_platform); - } - -#ifndef PIGLIT_HAS_X11 - if (_glut->waffle_platform == WAFFLE_PLATFORM_GLX || - _glut->waffle_platform == WAFFLE_PLATFORM_X11_EGL) - glutFatal("piglit was built without x11 support"); -#endif - - waffle_init_attrib_list[1] = _glut->waffle_platform; - ok = waffle_init(waffle_init_attrib_list); - if (!ok) - glutFatalWaffleError("waffle_init"); - - _glut->display = waffle_display_connect(display_name); - if (!_glut->display) - glutFatalWaffleError("waffle_display_connect"); -} - -void -glutInitDisplayMode(unsigned int mode) -{ - _glut->display_mode = mode; -} - -void -glutInitWindowPosition(int x, int y) -{ - // empty -} - -void -glutInitWindowSize(int width, int height) -{ - _glut->window_width = width; - _glut->window_height = height; -} - -static struct waffle_config* -glutChooseConfig(void) -{ - struct waffle_config *config = NULL; - int32_t attrib_list[64]; - int i = 0; - - #define ADD_ATTR(name, value) \ - do { \ - attrib_list[i++] = name; \ - attrib_list[i++] = value; \ - } while (0) - - ADD_ATTR(WAFFLE_CONTEXT_API, _glut->waffle_context_api); - - /* It is impossible to not request RGBA because GLUT_RGB and - * GLUT_RGBA are both 0. That is, (display_mode & (GLUT_RGB - * | GLUT_RGBA)) is unconditonally true. - */ - ADD_ATTR(WAFFLE_RED_SIZE, 1); - ADD_ATTR(WAFFLE_GREEN_SIZE, 1); - ADD_ATTR(WAFFLE_BLUE_SIZE, 1); - ADD_ATTR(WAFFLE_ALPHA_SIZE, 1); - - if (_glut->display_mode & GLUT_DEPTH) { - ADD_ATTR(WAFFLE_DEPTH_SIZE, 1); - } - - if (_glut->display_mode & GLUT_STENCIL) { - ADD_ATTR(WAFFLE_STENCIL_SIZE, 1); - } - - if (!(_glut->display_mode & GLUT_DOUBLE)) { - ADD_ATTR(WAFFLE_DOUBLE_BUFFERED, false); - } - - if (_glut->display_mode & GLUT_ACCUM) { - ADD_ATTR(WAFFLE_ACCUM_BUFFER, true); - } - - attrib_list[i++] = WAFFLE_NONE; - - config = waffle_config_choose(_glut->display, attrib_list); - if (!config) - glutFatalWaffleError("waffle_config_choose"); - return config; -} - -void -glutPostRedisplay(void) -{ - _glut->redisplay = 1; -} - -static void -_glutDefaultKeyboard(unsigned char key, int x, int y) -{ - if (key == 27) - exit(0); -} - -int -glutCreateWindow(const char *title) -{ - bool ok = true; - struct waffle_config *config = NULL; - union waffle_native_window *n_window = NULL; - - if (_glut->window) - glutFatal("cannot create window; one already exists"); - - config = glutChooseConfig(); - - _glut->context = waffle_context_create(config, NULL); - if (!_glut->context) - glutFatalWaffleError("waffle_context_create"); - - _glut->window = calloc(1, sizeof(*_glut->window)); - if (!_glut->window) - glutFatal("out of memory"); - - _glut->window->waffle = waffle_window_create(config, - _glut->window_width, - _glut->window_height); - if (!_glut->window->waffle) - glutFatalWaffleError("waffle_window_create"); - - n_window = waffle_window_get_native(_glut->window->waffle); - if (!n_window) - glutFatalWaffleError("waffle_window_get_native"); - - switch (_glut->waffle_platform) { -#ifdef PIGLIT_HAS_X11 - case WAFFLE_PLATFORM_GLX: - _glut->window->x11.display = n_window->glx->xlib_display; - _glut->window->x11.window = n_window->glx->xlib_window; - break; - case WAFFLE_PLATFORM_X11_EGL: - _glut->window->x11.display = n_window->x11_egl->display.xlib_display; - _glut->window->x11.window = n_window->x11_egl->xlib_window; - break; -#endif - case WAFFLE_PLATFORM_WAYLAND: - printf("glut_waffle: warning: input is not yet " - "implemented for Wayland\n"); - break; - default: - assert(0); - break; - } - - ok = waffle_make_current(_glut->display, _glut->window->waffle, - _glut->context); - if (!ok) - glutFatalWaffleError("waffle_make_current"); - - _glut->window->id = ++_glut->window_id_pool; - _glut->window->keyboard_cb = _glutDefaultKeyboard; - - return _glut->window->id; -} - -void -glutDestroyWindow(int win) -{ - bool ok = true; - - if (!_glut->window || _glut->window->id != win) - glutFatal("bad window id"); - - ok = waffle_window_destroy(_glut->window->waffle); - if (!ok) - glutFatalWaffleError("waffle_window_destroy"); - - free(_glut->window); - _glut->window = NULL; -} - -void -glutShowWindow(int win) -{ - bool ok = true; - - if (!_glut->window || _glut->window->id != win) - glutFatal("bad window id"); - - ok = waffle_window_show(_glut->window->waffle); - if (!ok) - glutFatalWaffleError("waffle_window_show"); -} - -void -glutDisplayFunc(GLUT_EGLdisplayCB func) -{ - _glut->window->display_cb = func; -} - -void -glutReshapeFunc(GLUT_EGLreshapeCB func) -{ - _glut->window->reshape_cb = func; -} - -void -glutKeyboardFunc(GLUT_EGLkeyboardCB func) -{ - _glut->window->keyboard_cb = func; -} - -void -glutMainLoop(void) -{ - bool ok = true; - - if (!_glut->window) - glutFatal("no window is created"); - - ok = waffle_window_show(_glut->window->waffle); - if (!ok) - glutFatalWaffleError("waffle_window_show"); - - if (_glut->window->reshape_cb) - _glut->window->reshape_cb(_glut->window_width, - _glut->window_height); - - if (_glut->window->display_cb) - _glut->window->display_cb(); - - switch (_glut->waffle_platform) { -#ifdef PIGLIT_HAS_X11 - case WAFFLE_PLATFORM_GLX: - case WAFFLE_PLATFORM_X11_EGL: - x11_event_loop(); - break; -#endif - case WAFFLE_PLATFORM_WAYLAND: - /* The Wayland window fails to appear on the first call to - * swapBuffers (which occured in display_cb above). This is - * likely due to swapBuffers being called before receiving an - * expose event. Until piglit has proper Wayland support, - * call swapBuffers again as a workaround. - */ - if (_glut->window->display_cb) - _glut->window->display_cb(); - - /* FINISHME: Write event loop for Wayland. */ - sleep(20); - break; - default: - assert(0); - break; - } -} - -void -glutSwapBuffers(void) -{ - bool ok = waffle_window_swap_buffers(_glut->window->waffle); - if (!ok) - glutFatalWaffleError("waffle_window_swap_buffers() failed"); -} diff --git a/src/glut_waffle/glut_waffle.h b/src/glut_waffle/glut_waffle.h deleted file mode 100644 index aa33c58da..000000000 --- a/src/glut_waffle/glut_waffle.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2010 LunarG Inc. - * - * 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 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. - * - * Authors: - * Chia-I Wu <olv@lunarg.com> - */ - -#pragma once - -enum glut_display_mode { - GLUT_RGB = 0, - GLUT_RGBA = 0, - GLUT_INDEX = 1, - GLUT_SINGLE = 0, - GLUT_DOUBLE = 2, - GLUT_ACCUM = 4, - GLUT_ALPHA = 8, - GLUT_DEPTH = 16, - GLUT_STENCIL = 32, -}; - -/* used by glutInitAPIMask */ -enum glut_api { - GLUT_OPENGL_BIT = 0x1, - GLUT_OPENGL_ES1_BIT = 0x2, - GLUT_OPENGL_ES2_BIT = 0x4, -}; - -typedef void (*GLUT_EGLreshapeCB)(int, int); -typedef void (*GLUT_EGLdisplayCB)(void); -typedef void (*GLUT_EGLkeyboardCB)(unsigned char, int, int); - -void glutInitAPIMask(int mask); -void glutInitDisplayMode(unsigned int mode); -void glutInitWindowPosition(int x, int y); -void glutInitWindowSize(int width, int height); -void glutInit(int *argcp, char **argv); - -void glutPostRedisplay(void); - -void glutMainLoop(void); - -/** - * Create the window, but do not show it. - */ -int glutCreateWindow(const char *title); - -void glutDestroyWindow(int win); -void glutShowWindow(int win); - -void glutDisplayFunc(GLUT_EGLdisplayCB func); -void glutReshapeFunc(GLUT_EGLreshapeCB func); -void glutKeyboardFunc(GLUT_EGLkeyboardCB func); -void glutSwapBuffers(void); diff --git a/src/glut_waffle/priv/common.c b/src/glut_waffle/priv/common.c deleted file mode 100644 index 0020e46f1..000000000 --- a/src/glut_waffle/priv/common.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 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 <stdarg.h> -#include <stdio.h> -#include <stdlib.h> - -#include "common.h" - -struct glut_waffle_state _glut_waffle_state = { - .display_mode = GLUT_RGB, - .window_width = 300, - .window_height = 300, - .window_id_pool = 0, -}; - -struct glut_waffle_state *const _glut = &_glut_waffle_state; - -void -glutFatal(char *format, ...) -{ - va_list args; - - va_start(args, format); - - fflush(stdout); - fprintf(stderr, "glut_waffle: error: "); - vfprintf(stderr, format, args); - va_end(args); - putc('\n', stderr); - - exit(1); -} - -void -glutFatalWaffleError(const char *waffle_func) -{ - const struct waffle_error_info *info = waffle_error_get_info(); - const char *code = waffle_error_to_string(info->code); - - if (info->message_length > 0) - glutFatal("%s() failed: %s: %s", - waffle_func, code, info->message); - else - glutFatal("%s() failed: %s", - waffle_func, code); -} diff --git a/src/glut_waffle/priv/common.h b/src/glut_waffle/priv/common.h deleted file mode 100644 index e7775b68d..000000000 --- a/src/glut_waffle/priv/common.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 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 <waffle.h> - -#ifdef PIGLIT_HAS_X11 -# include <X11/Xlib.h> -#endif - -#include "glut_waffle.h" - -struct glut_window { - struct waffle_window *waffle; - -#ifdef PIGLIT_HAS_X11 - struct { - Display *display; - Window window; - } x11; -#endif - - int id; - - GLUT_EGLreshapeCB reshape_cb; - GLUT_EGLdisplayCB display_cb; - GLUT_EGLkeyboardCB keyboard_cb; -}; - -struct glut_waffle_state { - /** \brief One of `WAFFLE_PLATFORM_*`. */ - int waffle_platform; - - /** \brief One of `WAFFLE_CONTEXT_OPENGL*`. - * - * The default value is `WAFFLE_CONTEXT_OPENGL`. To change the value, - * call glutInitAPIMask(). - */ - int waffle_context_api; - - /** \brief A bitmask of enum glut_display_mode`. */ - int display_mode; - - int window_width; - int window_height; - - struct waffle_display *display; - struct waffle_context *context; - struct glut_window *window; - - int redisplay; - int window_id_pool; -}; - -extern struct glut_waffle_state *const _glut; - -void -glutFatal(char *format, ...); - -void -glutFatalWaffleError(const char *waffle_func); diff --git a/src/glut_waffle/priv/x11.c b/src/glut_waffle/priv/x11.c deleted file mode 100644 index 1ffe066eb..000000000 --- a/src/glut_waffle/priv/x11.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 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 <stdbool.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/keysym.h> - -#include "common.h" - -static void -x11_process_next_event(void) -{ - struct glut_window *gwin = _glut->window; - Display *xdpy = gwin->x11.display; - - bool redraw = false; - XEvent event; - - if (!XPending(xdpy)) - return; - - XNextEvent(xdpy, &event); - - switch (event.type) { - case Expose: - redraw = true; - break; - case ConfigureNotify: - if (gwin->reshape_cb) - gwin->reshape_cb(event.xconfigure.width, - event.xconfigure.height); - break; - case KeyPress: { - char buffer[1]; - KeySym sym; - int n; - - redraw = true; - n = XLookupString(&event.xkey, - buffer, - sizeof(buffer), &sym, NULL); - - if (n > 0 && gwin->keyboard_cb) - gwin->keyboard_cb(buffer[0], - event.xkey.x, event.xkey.y); - break; - } - default: - break; - } - - _glut->redisplay = redraw; -} - -void -x11_event_loop(void) -{ - while (true) { - x11_process_next_event(); - - if (_glut->redisplay) { - _glut->redisplay = 0; - - if (_glut->window->display_cb) - _glut->window->display_cb(); - } - } -} diff --git a/src/glut_waffle/priv/x11.h b/src/glut_waffle/priv/x11.h deleted file mode 100644 index 9efa2b91c..000000000 --- a/src/glut_waffle/priv/x11.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 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 "common.h" - -struct glut_window* -x11_window_create(void); - -void -x11_event_loop(void); diff --git a/tests/util/piglit-framework-fbo.c b/tests/util/piglit-framework-fbo.c deleted file mode 100644 index 23ac311b2..000000000 --- a/tests/util/piglit-framework-fbo.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright © 2009-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. - */ - -#if defined(PIGLIT_USE_OPENGL_ES1) -# define PIGLIT_FRAMEWORK_FBO_DISABLED -#elif defined(PIGLIT_USE_WAFFLE) -# define PIGLIT_FRAMEWORK_FBO_USE_WAFFLE -#elif defined(PIGLIT_USE_GLX) -# define PIGLIT_FRAMEWORK_FBO_USE_GLX -#else -# define PIGLIT_FRAMEWORK_FBO_DISABLED -#endif - -#ifdef PIGLIT_USE_OPENGL_ES2 -# define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES -# define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES -#endif - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#include "piglit-util-gl-common.h" -#include "piglit-framework-gl.h" -#include "piglit-framework-fbo.h" - -#ifdef PIGLIT_FRAMEWORK_FBO_USE_GLX -#include "piglit-glx-util.h" -#endif - -#ifdef PIGLIT_FRAMEWORK_FBO_USE_WAFFLE -#include <waffle.h> -#endif - -#ifdef PIGLIT_FRAMEWORK_FBO_USE_GLX -Display *piglit_glx_dpy; -Window piglit_glx_window; -XVisualInfo *piglit_glx_visinfo; -GLXContext piglit_glx_context; -#endif - -#ifdef PIGLIT_FRAMEWORK_FBO_USE_WAFFLE -static struct waffle_display *piglit_waffle_display; -static struct waffle_window *piglit_waffle_window; -static struct waffle_context *piglit_waffle_context; -#endif - -static void -piglit_framework_fbo_destroy(void); - -#ifdef PIGLIT_FRAMEWORK_FBO_USE_GLX -static void -piglit_framework_fbo_glx_init() -{ - piglit_glx_dpy = piglit_get_glx_display(); - - /* Unfortunately in GLX we need a drawable to bind our context - * to. Make an unmapped window. - */ - piglit_glx_visinfo = piglit_get_glx_visual(piglit_glx_dpy); - - piglit_glx_context = piglit_get_glx_context(piglit_glx_dpy, - piglit_glx_visinfo); - - piglit_glx_window = piglit_get_glx_window_unmapped(piglit_glx_dpy, - piglit_glx_visinfo); - - glXMakeCurrent(piglit_glx_dpy, piglit_glx_window, piglit_glx_context); -} - -static void -piglit_framework_fbo_glx_destroy() -{ - glXMakeCurrent(piglit_glx_dpy, None, None); - glXDestroyContext(piglit_glx_dpy, piglit_glx_context); - XFree(piglit_glx_visinfo); - XCloseDisplay(piglit_glx_dpy); -} -#endif - -#ifdef PIGLIT_FRAMEWORK_FBO_USE_WAFFLE -/** - * \brief Print a description of the Waffle error and report test failure. - * - * The \a func_name is the name of the Waffle function that failed. - */ -static void -fatal_waffle_error(const char *func_name) -{ - const struct waffle_error_info *info = waffle_error_get_info(); - const char *error_name = waffle_error_to_string(info->code); - - fflush(stdout); - fprintf(stderr, "%s failed with error: %s", func_name, error_name); - if (info->message_length > 0) - fprintf(stderr, ": %s", info->message); - fprintf(stderr, "\n"); - - piglit_report_result(PIGLIT_FAIL); -} - -static void -piglit_framework_fbo_waffle_init(void) -{ - int i; - bool ok = true; - const char *env_platform; - int32_t waffle_platform; - int32_t waffle_context_api; - int32_t init_attrib_list[64]; - int32_t config_attrib_list[64]; - struct waffle_config *config; - - env_platform = getenv("WAFFLE_PLATFORM"); - - if (env_platform == NULL) { - waffle_platform = WAFFLE_PLATFORM_GLX; - } else if (!strcmp(env_platform, "glx")) { - waffle_platform = WAFFLE_PLATFORM_GLX; - } else if (!strcmp(env_platform, "x11_egl")) { - waffle_platform = WAFFLE_PLATFORM_X11_EGL; - } else if (!strcmp(env_platform, "wayland")) { - waffle_platform = WAFFLE_PLATFORM_WAYLAND; - } else { - fprintf(stderr, "environment var WAFFLE_PLATFORM has bad " - "value \"%s\"", env_platform); - } - -#if defined(PIGLIT_USE_OPENGL) - waffle_context_api = WAFFLE_CONTEXT_OPENGL; -#elif defined(PIGLIT_USE_OPENGL_ES1) - waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES1; -#elif defined(PIGLIT_USE_OPENGL_ES2) - waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES2; -#else -# error -#endif - i = 0; - init_attrib_list[i++] = WAFFLE_PLATFORM; - init_attrib_list[i++] = waffle_platform; - init_attrib_list[i++] = WAFFLE_NONE; - - i = 0; - config_attrib_list[i++] = WAFFLE_CONTEXT_API; - config_attrib_list[i++] = waffle_context_api; - config_attrib_list[i++] = WAFFLE_RED_SIZE; - config_attrib_list[i++] = 1; - config_attrib_list[i++] = WAFFLE_GREEN_SIZE; - config_attrib_list[i++] = 1; - config_attrib_list[i++] = WAFFLE_BLUE_SIZE; - config_attrib_list[i++] = 1; - config_attrib_list[i++] = WAFFLE_DOUBLE_BUFFERED; - config_attrib_list[i++] = 1; - config_attrib_list[i++] = WAFFLE_NONE; - - ok = waffle_init(init_attrib_list); - if (!ok) - fatal_waffle_error("waffle_init"); - - piglit_waffle_display = waffle_display_connect(NULL); - if (!piglit_waffle_display) - fatal_waffle_error("waffle_display_connect"); - - config = waffle_config_choose(piglit_waffle_display, - config_attrib_list); - if (!config) - fatal_waffle_error("waffle_config_choose"); - - piglit_waffle_context = waffle_context_create(config, NULL); - if (!piglit_waffle_context) - fatal_waffle_error("waffle_context_create"); - - piglit_waffle_window = waffle_window_create(config, - piglit_width, - piglit_height); - if (!piglit_waffle_window) - fatal_waffle_error("waffle_window_create"); - - ok = waffle_make_current(piglit_waffle_display, - piglit_waffle_window, - piglit_waffle_context); - if (!ok) - fatal_waffle_error("waffle_make_current"); - - // Cleanup. - ok = waffle_config_destroy(config); - if (!ok) - fatal_waffle_error("waffle_config_destroy"); -} - -static void -piglit_framework_fbo_waffle_destroy(void) -{ - bool ok = true; - - ok = waffle_make_current(piglit_waffle_display, NULL, NULL); - if (!ok) - fatal_waffle_error("waffle_make_current"); - - ok = waffle_context_destroy(piglit_waffle_context); - if (!ok) - fatal_waffle_error("waffle_context_destroy"); - - ok = waffle_display_disconnect(piglit_waffle_display); - if (!ok) - fatal_waffle_error("waffle_display_connect"); - - piglit_waffle_display = NULL; - piglit_waffle_context = NULL; -} -#endif - -static bool -piglit_framework_fbo_gl_init(const struct piglit_gl_test_config *info) -{ -#ifdef PIGLIT_FRAMEWORK_FBO_DISABLED - return false; -#else - GLuint tex, depth = 0; - GLenum status; - -#ifdef PIGLIT_USE_OPENGL - glewInit(); - - if (piglit_get_gl_version() < 20) - return false; -#endif - - glGenFramebuffers(1, &piglit_winsys_fbo); - glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo); - - glGenTextures(1, &tex); - glBindTexture(GL_TEXTURE_2D, tex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, - piglit_width, piglit_height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glFramebufferTexture2D(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - tex, - 0); - - if (info->window_visual & (PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL)) { - /* Create a combined depth+stencil texture and attach it - * to the depth and stencil attachment points. - */ - glGenTextures(1, &depth); - glBindTexture(GL_TEXTURE_2D, depth); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL, - piglit_width, piglit_height, 0, - GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL); - glFramebufferTexture2D(GL_FRAMEBUFFER, - GL_DEPTH_ATTACHMENT, - GL_TEXTURE_2D, - depth, - 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, - GL_STENCIL_ATTACHMENT, - GL_TEXTURE_2D, - depth, - 0); - } - - glBindTexture(GL_TEXTURE_2D, 0); - - status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - if (status != GL_FRAMEBUFFER_COMPLETE) { - fprintf(stderr, - "-fbo resulted in incomplete FBO, falling back\n"); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - glDeleteTextures(1, &depth); - glDeleteTextures(1, &tex); - - piglit_framework_fbo_destroy(); - - return false; - } - - return true; -#endif /* PIGLIT_FRAMEWORK_FBO_DISABLED */ -} - -bool -piglit_framework_fbo_init(const struct piglit_gl_test_config *config) -{ -#if defined(PIGLIT_FRAMEWORK_FBO_USE_GLX) - piglit_framework_fbo_glx_init(); -#elif defined(PIGLIT_FRAMEWORK_FBO_USE_WAFFLE) - piglit_framework_fbo_waffle_init(); -#endif - - return piglit_framework_fbo_gl_init(config); -} - -static void -piglit_framework_fbo_destroy(void) -{ -#ifdef PIGLIT_USE_OPENGL - glDeleteFramebuffers(1, &piglit_winsys_fbo); -#endif - - piglit_winsys_fbo = 0; - -#if defined(PIGLIT_FRAMEWORK_FBO_USE_GLX) - piglit_framework_fbo_glx_destroy(); -#elif defined(PIGLIT_FRAMEWORK_FBO_USE_WAFFLE) - piglit_framework_fbo_waffle_destroy(); -#endif -} - -void -piglit_framework_fbo_run(const struct piglit_gl_test_config *config) -{ - enum piglit_result result = config->display(); - piglit_framework_fbo_destroy(); - piglit_report_result(result); -} - -void -piglit_framework_fbo_swap_buffers(void) -{ -#if defined(PIGLIT_FRAMEWORK_FBO_USE_GLX) - glXSwapBuffers(piglit_glx_dpy, piglit_glx_window); -#elif defined(PIGLIT_FRAMEWORK_FBO_USE_WAFFLE) - waffle_window_swap_buffers(piglit_waffle_window); -#endif -} diff --git a/tests/util/piglit-framework-fbo.h b/tests/util/piglit-framework-fbo.h deleted file mode 100644 index ec07c41d1..000000000 --- a/tests/util/piglit-framework-fbo.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 <stdbool.h> - -struct piglit_gl_test_config; - -bool -piglit_framework_fbo_init(const struct piglit_gl_test_config *config); - -void -piglit_framework_fbo_run(const struct piglit_gl_test_config *config); - -void -piglit_framework_fbo_swap_buffers(void); diff --git a/tests/util/piglit-framework-glut.c b/tests/util/piglit-framework-glut.c deleted file mode 100644 index fa5fcca71..000000000 --- a/tests/util/piglit-framework-glut.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2009-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 <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - -#include "piglit-util-gl-common.h" -#include "piglit-framework-gl.h" -#include "piglit-framework-glut.h" - -#ifdef PIGLIT_USE_GLX -#include "piglit-glx-util.h" -#endif - -/** - * \brief Set by piglit_framework_glut_init(). - * - * This global variable exists because GLUT's API requires that data be passed - * to the display function via a global. Ugh, what an awful API. - */ -static const struct piglit_gl_test_config *test_config; - -static int piglit_window; -static enum piglit_result result; - - -static void -display(void) -{ - result = test_config->display(); - - if (piglit_automatic) { - glutDestroyWindow(piglit_window); -#ifdef FREEGLUT - /* Tell GLUT to clean up and exit, so that we can - * reasonably valgrind our testcases for memory - * leaks by the GL. - */ - glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, - GLUT_ACTION_GLUTMAINLOOP_RETURNS); - glutLeaveMainLoop(); -#else - piglit_report_result(result); -#endif - } -} - -static void -reshape(int w, int h) -{ - if (piglit_automatic && - (w != piglit_width || - h != piglit_height)) { - printf("Got spurious window resize in automatic run " - "(%d,%d to %d,%d)\n", piglit_width, piglit_height, w, h); - piglit_report_result(PIGLIT_WARN); - } - - piglit_width = w; - piglit_height = h; - - glViewport(0, 0, w, h); -} - -/* Swapbuffers the results to the window in non-auto mode. */ -void -piglit_present_results() -{ - if (!piglit_automatic && !piglit_use_fbo) - glutSwapBuffers(); -} - -void -piglit_framework_glut_init(int argc, char *argv[], - const struct piglit_gl_test_config *config) -{ - if (test_config != NULL) - assert(!"already init"); - - test_config = config; - glutInit(&argc, argv); - -# if defined(PIGLIT_USE_WAFFLE) -# if defined(PIGLIT_USE_OPENGL) - glutInitAPIMask(GLUT_OPENGL_BIT); -# elif defined(PIGLIT_USE_OPENGL_ES1) - glutInitAPIMask(GLUT_OPENGL_ES1_BIT); -# elif defined(PIGLIT_USE_OPENGL_ES2) - glutInitAPIMask(GLUT_OPENGL_ES2_BIT); -# else -# error -# endif -# endif - - glutInitWindowPosition(0, 0); - glutInitWindowSize(config->window_width, - config->window_height); - glutInitDisplayMode(config->window_visual); - piglit_window = glutCreateWindow(argv[0]); - -#if defined(PIGLIT_USE_GLX) && !defined(PIGLIT_USE_WAFFLE) - /* If using waffle, then the current platform might not be GLX. - * So we can't call any GLX functions. - * - * FIXME: Detect the waffle platform and handle piglit_automatic - * FIXME: appropriately. - */ - if (piglit_automatic) - piglit_glx_set_no_input(); -#endif - - glutDisplayFunc(display); - glutReshapeFunc(reshape); - glutKeyboardFunc(piglit_escape_exit_key); - -#ifdef PIGLIT_USE_OPENGL - glewInit(); -#endif -} - -void -piglit_framework_glut_run(const struct piglit_gl_test_config *config) -{ - glutMainLoop(); - piglit_report_result(result); -} - -void -piglit_framework_glut_swap_buffers(void) -{ - glutSwapBuffers(); -} diff --git a/tests/util/piglit-framework-glut.h b/tests/util/piglit-framework-glut.h deleted file mode 100644 index 5024d7c3f..000000000 --- a/tests/util/piglit-framework-glut.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - -struct piglit_gl_test_config; - -void -piglit_framework_glut_init(int argc, char *argv[], - const struct piglit_gl_test_config *config); - -void -piglit_framework_glut_run(const struct piglit_gl_test_config *config); - - -void -piglit_framework_glut_swap_buffers(void); |