2 * Copyright 2011 VMware, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * Jose Fonseca <jfonseca@vmware.com>
29 /** @file glx-closedisplay.c
31 * Test that calling XCloseDisplay after using GLX context works correctly.
34 #include "piglit-util-gl.h"
35 #include "piglit-glx-util.h"
38 * Straightforward function to check whether GLX direct rendering is supported
42 isDirectRendering(void)
49 GLX_DRAWABLE_TYPE
, GLX_USE_GL
,
50 GLX_RENDER_TYPE
, GLX_USE_GL
,
51 GLX_DOUBLEBUFFER
, True
,
57 dpy
= XOpenDisplay(NULL
);
59 fprintf(stderr
, "couldn't open display\n");
60 piglit_report_result(PIGLIT_FAIL
);
63 configs
= glXChooseFBConfig(dpy
, 0, attribList
, &nitems
);
64 if (configs
== NULL
) {
65 fprintf(stderr
, "couldn't find a matching framebuffer configuration\n");
66 piglit_report_result(PIGLIT_FAIL
);
70 ctx
= glXCreateNewContext(dpy
, config
, GLX_RGBA_TYPE
, NULL
, True
);
71 result
= glXIsDirect(dpy
, ctx
);
72 glXDestroyContext(dpy
, ctx
);
76 /* This call will cause *_dri.so to be dlclosed and unloaded. */
83 main(int argc
, char **argv
)
87 /* Run a second to exercise reloading the *_dri.so driver. */
90 piglit_report_result(PIGLIT_PASS
);