cmake: move defaults into the per-platform section
[piglit.git] / tests / egl / egl-util.h
bloba2f4f3cf550a1dec3165151254a0e0b9acd9443d
2 /**
3 * \file egl-util.h
4 * Common framework for EGL tests.
6 * \author Kristian Høgsberg <krh@bitplanet.net>
7 */
9 #ifndef EGL_UTIL_H
10 #define EGL_UTIL_H
12 #include <X11/Xlib.h>
13 #include <X11/Xutil.h>
14 #include <X11/keysym.h>
15 #include <EGL/egl.h>
16 #include <EGL/eglext.h>
18 #ifndef EGL_KHR_gl_colorspace
19 #define EGL_KHR_gl_colorspace 1
20 #define EGL_GL_COLORSPACE_KHR 0x309D
21 #define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
22 #define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
23 #endif /* EGL_KHR_gl_colorspace */
25 struct egl_state {
26 Display *dpy;
27 Window win;
28 EGLDisplay egl_dpy;
29 EGLConfig cfg;
30 EGLContext ctx;
31 EGLSurface surf;
32 EGLint major, minor;
33 int depth;
34 int width;
35 int height;
38 struct egl_test {
39 const EGLint *context_attribs;
40 const EGLint *config_attribs;
41 const EGLint *surface_attribs;
42 const char **extensions;
43 enum piglit_result (*draw)(struct egl_state *state);
44 EGLint window_width;
45 EGLint window_height;
46 bool stop_on_failure;
49 static const EGLint egl_default_attribs[] = {
50 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT,
51 EGL_RED_SIZE, 1,
52 EGL_GREEN_SIZE, 1,
53 EGL_BLUE_SIZE, 1,
54 EGL_DEPTH_SIZE, 1,
55 EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
56 EGL_NONE
59 static const EGLint egl_default_window_width = 300;
60 static const EGLint egl_default_window_height = 300;
62 /**
63 * \brief Initialize test to default values.
65 void
66 egl_init_test(struct egl_test *test);
68 EGLNativePixmapType
69 egl_util_create_native_pixmap(struct egl_state *state, int width, int height);
71 EGLSurface
72 egl_util_create_pixmap(struct egl_state *state,
73 int width, int height, const EGLint *attribs);
75 enum piglit_result egl_util_run(const struct egl_test *test, int argc, char *argv[]);
77 int
78 egl_probe_front_pixel_rgb(struct egl_state *state,
79 int x, int y, const float *expected);
81 #endif