예제 #1
0
enum piglit_result
draw(Display *dpy)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	GLXContext ctx;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
	glClearColor(1.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glXDestroyContext(dpy, ctx);

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);

	glClearColor(0.0, 1.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	pass &= piglit_probe_pixel_rgb(1, 1, green);

	glXSwapBuffers(dpy, win);

	/* Free our resources when we're done. */
	glXMakeCurrent(dpy, None, NULL);
	glXDestroyContext(dpy, ctx);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
예제 #2
0
enum piglit_result
draw(Display *dpy)
{
	bool pass = true;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	GLXContext ctx;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	/* Clear to green */
	glClearColor(0.0, 1.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);

	/* Noop */
	glXSwapBuffers(dpy, win);

	/* We want to actually catch any X error that leaks through as
	 * a result of glXSwapBuffers() before we go saying "pass" or
	 * "fail".
	 */
	XSync(dpy, False);

	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
draw(Display *dpy)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0.0, 1.0, 0.0, 1.0};
	float blue[] = {0.0, 0.0, 1.0, 1.0};
	float gray[] = {0.5, 0.5, 0.5, 1.0};
	pthread_t thread1, thread2;
	void *retval;
	int ret;
	int x1 = 10, x2 = 30;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);
	glewInit();

	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");

	/* Clear background to gray */
	glClearColor(0.5, 0.5, 0.5, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	pthread_mutex_init(&mutex, NULL);

	/* Now, spawn some threads that do some drawing, both with this
	 * context
	 */
	pthread_create(&thread1, NULL, thread1_func, &x1);
	pthread_create(&thread2, NULL, thread2_func, &x2);

	ret = pthread_join(thread1, &retval);
	assert(ret == 0);
	ret = pthread_join(thread2, &retval);
	assert(ret == 0);

	pthread_mutex_destroy(&mutex);

	glColor4f(0.0, 1.0, 0.0, 0.0);
	piglit_draw_rect(50, 10, 10, 10);

	pass &= piglit_probe_rect_rgba( 0, 10, 10, 10, gray);
	pass &= piglit_probe_rect_rgba(10, 10, 10, 10, green);
	pass &= piglit_probe_rect_rgba(20, 10, 10, 10, gray);
	pass &= piglit_probe_rect_rgba(30, 10, 10, 10, blue);
	pass &= piglit_probe_rect_rgba(40, 10, 10, 10, gray);
	pass &= piglit_probe_rect_rgba(50, 10, 10, 10, green);
	pass &= piglit_probe_rect_rgba(60, 10, 10, 10, gray);

	pass &= piglit_probe_rect_rgba(0, 0, piglit_width, 10, gray);
	pass &= piglit_probe_rect_rgba(0, 20, piglit_width, 10, gray);

	glXSwapBuffers(dpy, win);

	glXMakeCurrent(dpy, None, None);
	glXDestroyContext(dpy, ctx);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
예제 #4
0
void
piglit_oml_sync_control_test_run(bool fullscreen, enum piglit_result (*draw)(Display *dpy))
{
	Display *dpy;
	GLXContext ctx;

	dpy = XOpenDisplay(NULL);
	if (dpy == NULL) {
		fprintf(stderr, "couldn't open display\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	piglit_require_glx_extension(dpy, "GLX_OML_sync_control");
	piglit_glx_get_all_proc_addresses(procs, ARRAY_SIZE(procs));

	visinfo = piglit_get_glx_visual(dpy);
	if (fullscreen)
		win = piglit_get_glx_window_fullscreen(dpy, visinfo);
	else
		win = piglit_get_glx_window(dpy, visinfo);
	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);

	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	XMapWindow(dpy, win);

	piglit_glx_event_loop(dpy, draw);
}
예제 #5
0
enum piglit_result
piglit_glx_iterate_visuals(enum piglit_result (*draw)(Display *dpy,
						      GLXFBConfig config))
{
	int screen;
	GLXFBConfig *configs;
	int n_configs;
	int i;
	bool any_fail = false;
	bool any_pass = false;

	Display *dpy = XOpenDisplay(NULL);
	if (!dpy) {
		fprintf(stderr, "couldn't open display\n");
		piglit_report_result(PIGLIT_FAIL);
	}
	screen = DefaultScreen(dpy);

	configs = glXGetFBConfigs(dpy, screen, &n_configs);
	if (!configs) {
		fprintf(stderr, "No GLX FB configs\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	for (i = 0; i < n_configs; i++) {
		enum piglit_result result;
		XVisualInfo *visinfo;
		GLXContext ctx;
		GLXDrawable d;

		visinfo = glXGetVisualFromFBConfig(dpy, configs[i]);
		if (!visinfo)
			continue;

		ctx = piglit_get_glx_context(dpy, visinfo);
		d = piglit_get_glx_window(dpy, visinfo);
		glXMakeCurrent(dpy, d, ctx);
		XFree(visinfo);

		result = piglit_iterate_visuals_event_loop(dpy, draw,
							   configs[i]);
		if (result == PIGLIT_FAIL)
			any_fail = true;
		else if (result == PIGLIT_PASS)
			any_pass = true;

		XDestroyWindow(dpy, d);
		glXDestroyContext(dpy, ctx);
	}

	if (any_fail)
		return PIGLIT_FAIL;
	else if (any_pass)
		return PIGLIT_PASS;
	else
		return PIGLIT_SKIP;
}
예제 #6
0
enum piglit_result
draw(Display *dpy)
{
	GLXContext ctx;
	bool pass = true;
	unsigned int age;
	int i;
	static GLfloat colors[5][4] = {
		{1.0, 0.0, 0.0, 1.0},
		{0.0, 1.0, 0.0, 1.0},
		{0.0, 0.0, 1.0, 1.0},
		{1.0, 0.0, 1.0, 1.0},
		{0.0, 1.0, 1.0, 1.0}
	};

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, window, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	glXQueryDrawable(dpy, window, GLX_BACK_BUFFER_AGE_EXT, &age);
	if (age != 0) {
		fprintf(stderr, "Initial age was %d, should be 0\n", age);
		pass = false;
	}

	for (i = 0; i < 5; i++) {
		glClearColor(colors[i][0],
			     colors[i][1],
			     colors[i][2],
			     colors[i][3]);
		glClear(GL_COLOR_BUFFER_BIT);
		glXSwapBuffers(dpy, window);

		glXQueryDrawable(dpy, window, GLX_BACK_BUFFER_AGE_EXT, &age);
		printf("Frame %d: age %d\n", i + 1, age);

		if (age > 0) {
			int color_i = i - (age - 1);
			if (color_i < 0) {
				fprintf(stderr, "too old\n");
				pass = false;
			} else {
				pass = piglit_probe_rect_rgba(0, 0,
							      piglit_width,
							      piglit_height,
							      colors[color_i])
					&& pass;
			}
		}
	}

	glXMakeCurrent(dpy, None, NULL);
	glXDestroyContext(dpy, ctx);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
예제 #7
0
int
main(int argc, char **argv)
{
	Pixmap p;
	GLXPixmap g;
	GLXContext ctx;

	dpy = XOpenDisplay(NULL);
	if (dpy == NULL) {
		fprintf(stderr, "couldn't open display\n");
		piglit_report_result(PIGLIT_FAIL);
	}

        piglit_glx_get_error(dpy, NULL);
	piglit_require_glx_version(dpy, 1, 3);

	visinfo = piglit_get_glx_visual(dpy);
	p = XCreatePixmap(dpy, DefaultRootWindow(dpy), piglit_width,
			  piglit_height, visinfo->depth);

	g = glXCreateGLXPixmap(dpy, visinfo, p);

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, g, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	/* Clear to green */
	glClearColor(0.0, 1.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);

	/* Noop */
	XSetErrorHandler(handler);
	glXSwapBuffers(dpy, p);

	/* We want to actually catch any X error that leaks through as
	 * a result of glXSwapBuffers() before we go saying "pass" or
	 * "fail".
	 */
	XSync(dpy, False);

	glXDestroyPixmap(dpy, g);

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);

	return 0;
}
예제 #8
0
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 *
thread_func(void *arg)
{
	Display *dpy;
	XVisualInfo *visinfo;
	Window win;
	unsigned i;

	dpy = piglit_get_glx_display();
	visinfo = piglit_get_glx_visual(dpy);
	win = piglit_get_glx_window(dpy, visinfo);

	for (i = 0; i < 100; ++i) {
		GLXContext ctx;
		GLuint vert_shader, frag_shader;
		GLuint program;

		ctx = piglit_get_glx_context(dpy, visinfo);
		glXMakeCurrent(dpy, win, ctx);

		/* Ok, not nice but should be safe due to all threads working
		 * on the same type of context.
                 */
		pthread_mutex_lock(&mutex);
		piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
		pthread_mutex_unlock(&mutex);

		vert_shader = piglit_compile_shader_text(GL_VERTEX_SHADER, vert_shader_text);
		piglit_check_gl_error(GL_NO_ERROR);

		frag_shader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag_shader_text);
		piglit_check_gl_error(GL_NO_ERROR);

		program = piglit_link_simple_program(vert_shader, frag_shader);
		piglit_check_gl_error(GL_NO_ERROR);

		glUseProgram(program);
		piglit_check_gl_error(GL_NO_ERROR);

		glXDestroyContext(dpy, ctx);
	}

	return NULL;
}
예제 #10
0
enum piglit_result
draw(Display *dpy)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	pthread_t thread1, thread2;
	void *retval;
	int ret;
	int x1 = 10, x2 = 30;
	GLXContext ctx;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	/* Clear background to gray */
	glClearColor(0.5, 0.5, 0.5, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glFinish();

	pthread_mutex_init(&mutex, NULL);
	/* Now, spawn some threads that do some drawing, both with this
	 * context
	 */
	pthread_create(&thread1, NULL, thread_func, &x1);
	pthread_create(&thread2, NULL, thread_func, &x2);

	ret = pthread_join(thread1, &retval);
	assert(ret == 0);
	ret = pthread_join(thread2, &retval);
	assert(ret == 0);

	pthread_mutex_destroy(&mutex);

	pass &= piglit_probe_pixel_rgb(15, 15, green);
	pass &= piglit_probe_pixel_rgb(35, 15, green);

	glXSwapBuffers(dpy, win);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
int
main(int argc, char **argv)
{
	XVisualInfo *visinfo;
	int i;

	for (i = 1; i < argc; ++i) {
		if (!strcmp(argv[i], "-auto"))
			piglit_automatic = 1;
		else
			fprintf(stderr, "Unknown option: %s\n", argv[i]);
	}

	dpy = XOpenDisplay(NULL);
	if (dpy == NULL) {
		fprintf(stderr, "couldn't open display\n");
		piglit_report_result(PIGLIT_FAIL);
	}
	visinfo = piglit_get_glx_visual(dpy);

	win = piglit_get_glx_window(dpy, visinfo);
	XMapWindow(dpy, win);

	for (i = 0; i < num_contexts; i++) {
		ctx[i] = piglit_get_glx_context(dpy, visinfo);
	}

	glXMakeCurrent(dpy, win, ctx[0]);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	piglit_glx_event_loop(dpy, draw);

	XFree(visinfo);
	glXDestroyWindow(dpy, win);
	for (i = 0; i < num_contexts; i++) {
		glXDestroyContext(dpy, ctx[i]);
	}

	return 0;
}
예제 #12
0
int main(int argc, char **argv) {
	Display *display;
	XVisualInfo *visual;
	Window window;
	GLXContext ctx;
	void (*test_func)(Display*, GLXDrawable);

	parse_args(argc, argv, &test_func);

	display = piglit_get_glx_display();
	visual = piglit_get_glx_visual(display);
	window = piglit_get_glx_window(display, visual);
	ctx = piglit_get_glx_context(display, visual);
	glXMakeCurrent(display, window, ctx);

	/* Must initialize static variables of this function. */
	piglit_glx_get_error(display, NULL);

	test_func(display, window);

	return 0;
}
예제 #13
0
enum piglit_result
draw(Display *dpy)
{
	GLXContext ctx;
	GLboolean pass = GL_TRUE;
	static float red[]   = {1.0, 0.0, 0.0, 0.0};
	static float green[] = {0.0, 1.0, 0.0, 0.0};

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win_one, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	glClearColor(1.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glXSwapBuffers(dpy, win_one);

	glClearColor(0.0, 1.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	CopySubBuffer(dpy, win_one,
		      piglit_width / 4,
		      piglit_height / 4,
		      piglit_width / 2,
		      piglit_height / 2);

	glReadBuffer(GL_FRONT);

	pass &= piglit_probe_rect_rgb(0, 0, piglit_width / 4, piglit_height / 4,
				      red);
	pass &= piglit_probe_rect_rgb(piglit_width / 4, piglit_width / 4,
				      piglit_width / 2, piglit_height / 2,
				      green);

	glXMakeCurrent(dpy, None, NULL);
	glXDestroyContext(dpy, ctx);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
예제 #14
0
enum piglit_result
draw(Display *dpy)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	GLXContext ctx;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);

	/* Clear background to gray */
	glClearColor(0.0, 1.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glXSwapBuffers(dpy, win);
	glClearColor(1.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glXSwapBuffers(dpy, win);

	pass = piglit_probe_pixel_rgba(0, 0, green);

	glXSwapBuffers(dpy, win);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
예제 #15
0
static void *
thread_func(void *arg)
{
	GLXContext ctx;
	int *x = arg;
	Bool ret;

	pthread_mutex_lock(&mutex);

	ctx = piglit_get_glx_context(dpy, visinfo);
	ret = glXMakeCurrent(dpy, win, ctx);
	assert(ret);

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
	glColor4f(0.0, 1.0, 0.0, 0.0);
	piglit_draw_rect(*x, 10, 10, 10);

	glFinish();
	glXDestroyContext(dpy, ctx);

	pthread_mutex_unlock(&mutex);

	return NULL;
}
예제 #16
0
int
main(int argc, char **argv)
{
   Display *dpy;
   XVisualInfo *visinfo;
   int i;

   for (i = 1; i < argc; i++) {
      if (strcmp(argv[i], "-auto") == 0) {
         piglit_automatic = 1;
         break;
      }
   }

   dpy = XOpenDisplay(NULL);
   if (!dpy) {
      fprintf(stderr, "Failed to open display\n");
      piglit_report_result(PIGLIT_FAIL);
   }

   visinfo = piglit_get_glx_visual(dpy);
   Windows[0] = piglit_get_glx_window(dpy, visinfo);
   Windows[1] = piglit_get_glx_window(dpy, visinfo);

   XMapWindow(dpy, Windows[0]);
   XMapWindow(dpy, Windows[1]);

   ctx = piglit_get_glx_context(dpy, visinfo);

   glXMakeCurrent(dpy, Windows[0], ctx);
   piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

   piglit_glx_event_loop(dpy, draw);

   return 0;
}
예제 #17
0
파일: glx-tfp.c 프로젝트: blaztinn/piglit
int main(int argc, char**argv)
{
	XVisualInfo *visinfo;
	GLXContext ctx;
	int i;

	for(i = 1; i < argc; ++i) {
		if (!strcmp(argv[i], "-auto"))
			piglit_automatic = 1;
		else
			fprintf(stderr, "Unknown option: %s\n", argv[i]);
	}

	dpy = XOpenDisplay(NULL);
	if (dpy == NULL) {
		fprintf(stderr, "couldn't open display\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	visinfo = piglit_get_glx_visual(dpy);
	ctx = piglit_get_glx_context(dpy, visinfo);
	win = piglit_get_glx_window(dpy, visinfo);
	XFree(visinfo);

	glXMakeCurrent(dpy, win, ctx);

	glewInit();

	if (piglit_automatic)
		piglit_glx_set_no_input();

	XMapWindow(dpy, win);

	piglit_require_glx_extension(dpy, "GLX_EXT_texture_from_pixmap");
	if (!piglit_is_extension_supported("GL_ARB_texture_env_combine")) {
		fprintf(stderr, "Test requires GL_ARB_texture_env_combine\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	pglXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)
		glXGetProcAddress((GLubyte *)"glXBindTexImageEXT");
	pglXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)
		glXGetProcAddress((GLubyte *)"glXReleaseTexImageEXT");
	if (pglXBindTexImageEXT == NULL || pglXReleaseTexImageEXT == NULL) {
		fprintf(stderr, "Couldn't get TFP functions\n");
		piglit_report_result(PIGLIT_FAIL);
		exit(1);
	}

	init();

	if (!piglit_automatic) {
		printf("Left rectangle (RGB) should be green on the top and\n"
		       "red on the bottom.  The right rectangle (RGBA) should\n"
		       "be the same, but darker on the right half.\n");
		printf("Press Escape to quit\n");
	}

	piglit_glx_event_loop(dpy, draw);

	return 0;
}
예제 #18
0
int
main(int argc, char **argv)
{
    Pixmap p;
    GLXPixmap g;
    static const float green_alpha_zero[4] = {0.0, 1.0, 0.0, 0.0};
    static const float green_alpha_one[4] = {0.0, 1.0, 0.0, 1.0};
    GLXContext ctx;
    bool pass;
    GLint alpha_bits;

    dpy = XOpenDisplay(NULL);
    if (dpy == NULL) {
        fprintf(stderr, "couldn't open display\n");
        piglit_report_result(PIGLIT_FAIL);
    }

    piglit_glx_get_error(dpy, NULL);
    piglit_require_glx_version(dpy, 1, 3);

    visinfo = piglit_get_glx_visual(dpy);
    p = XCreatePixmap(dpy, DefaultRootWindow(dpy), piglit_width,
                      piglit_height, visinfo->depth);

    g = glXCreateGLXPixmap(dpy, visinfo, p);

    ctx = piglit_get_glx_context(dpy, visinfo);
    glXMakeCurrent(dpy, g, ctx);
    piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

    /* Clear to green */
    glClearColor(0.0, 1.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);

    /* Noop */
    glXSwapBuffers(dpy, g);

    /* We want to actually catch any X error that leaks through as
     * a result of glXSwapBuffers() before we go saying "pass" or
     * "fail".
     */
    XSync(dpy, False);

    /* If the visual has no alpha, then the GL spec requires that 1.0 be
     * read back.  Otherwise, we should read back the 0.0 that we wrote.
     */
    glGetIntegerv(GL_ALPHA_BITS, &alpha_bits);
    if (alpha_bits == 0) {
        pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
                                      green_alpha_one);
    } else {
        pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
                                      green_alpha_zero);
    }

    glXDestroyPixmap(dpy, g);

    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);

    return 0;
}
예제 #19
0
enum piglit_result
draw(Display *dpy)
{
	GLXContext ctx;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	GLboolean pass = GL_TRUE;
	GLXWindow glxwin_one, glxwin_two;
	GLXFBConfig *configs;
	int nconfigs;
	static const int attributes[] = {
	  GLX_DRAWABLE_TYPE,    GLX_WINDOW_BIT,
	  GLX_DOUBLEBUFFER,     GL_TRUE,
	  GLX_RED_SIZE,         1,
	  GLX_GREEN_SIZE,       1,
	  GLX_BLUE_SIZE,        1,
	  GLX_ALPHA_SIZE,       1,
	  None
	};

	configs = glXChooseFBConfig(dpy, DefaultScreen(dpy), attributes,
				    &nconfigs);

	if (nconfigs == 0 || !configs) {
		fprintf(stderr,
			"Couldn't get an RGBA, double-buffered FBConfig\n");
		piglit_report_result(PIGLIT_FAIL);
		return PIGLIT_FAIL;
	}

	glxwin_one = glXCreateWindow(dpy, configs[0], win_one, NULL);
	glxwin_two = glXCreateWindow(dpy, configs[0], win_two, NULL);

	ctx = piglit_get_glx_context(dpy, visinfo);

	glXMakeCurrent(dpy, glxwin_one, ctx);
	glewInit();

	glClearColor(0.0, 1.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	glXMakeCurrent(dpy, glxwin_two, ctx);

	glClear(GL_COLOR_BUFFER_BIT);


	glXMakeCurrent(dpy, glxwin_one, ctx);
	pass &= piglit_probe_pixel_rgb(1, 1, green);

	glXMakeCurrent(dpy, glxwin_two, ctx);
	pass &= piglit_probe_pixel_rgb(1, 1, green);

	/* Free our resources when we're done. */
	glXDestroyWindow(dpy, glxwin_one);
	glXDestroyWindow(dpy, glxwin_two);

	free(configs);

	glXMakeCurrent(dpy, None, NULL);
	glXDestroyContext(dpy, ctx);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}