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
,
56 /* The spec doesn't mention this, but the Xorg server replies with
57 * a string already terminated with '\0'. */
58 uint32_t len
= xcb_glx_query_server_string_string_length(reply
);
59 char *buf
= malloc(len
);
60 memcpy(buf
, xcb_glx_query_server_string_string(reply
), len
);
67 * Exchange a protocol request for glGetString.
70 __glXGetString(Display
* dpy
, int opcode
, CARD32 contextTag
, CARD32 name
)
72 xcb_connection_t
*c
= XGetXCBConnection(dpy
);
73 xcb_glx_get_string_reply_t
*reply
= xcb_glx_get_string_reply(c
,
83 /* The spec doesn't mention this, but the Xorg server replies with
84 * a string already terminated with '\0'. */
85 uint32_t len
= xcb_glx_get_string_string_length(reply
);
86 char *buf
= malloc(len
);
87 memcpy(buf
, xcb_glx_get_string_string(reply
), len
);