2 * (C) Copyright IBM Corporation 2004
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
27 * Generic utility functions to query internal data from the server.
29 * \author Ian Romanick <idr@us.ibm.com>
32 #include "glxclient.h"
34 # include <X11/Xlib-xcb.h>
40 * Exchange a protocol request for glXQueryServerString.
43 __glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
45 xcb_connection_t *c = XGetXCBConnection(dpy);
46 xcb_glx_query_server_string_reply_t *reply =
47 xcb_glx_query_server_string_reply(c,
48 xcb_glx_query_server_string(c,
53 /* The spec doesn't mention this, but the Xorg server replies with
54 * a string already terminated with '\0'. */
55 uint32_t len = xcb_glx_query_server_string_string_length(reply);
56 char *buf = malloc(len);
57 memcpy(buf, xcb_glx_query_server_string_string(reply), len);
64 * Exchange a protocol request for glGetString.
67 __glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
69 xcb_connection_t *c = XGetXCBConnection(dpy);
70 xcb_glx_get_string_reply_t *reply = xcb_glx_get_string_reply(c,
77 /* The spec doesn't mention this, but the Xorg server replies with
78 * a string already terminated with '\0'. */
79 uint32_t len = xcb_glx_get_string_string_length(reply);
80 char *buf = malloc(len);
81 memcpy(buf, xcb_glx_get_string_string(reply), len);