mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
glx: implement __glXGetString, hide __glXGetStringFromServer
This commit is contained in:
parent
fd52001c5c
commit
24b8a8cfe8
2 changed files with 73 additions and 22 deletions
|
|
@ -37,6 +37,62 @@
|
||||||
# include <xcb/glx.h>
|
# include <xcb/glx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_XCB
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange a protocol request for glXQueryServerString.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
__glXQueryServerString(Display* dpy,
|
||||||
|
CARD32 screen,
|
||||||
|
CARD32 name)
|
||||||
|
{
|
||||||
|
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||||
|
xcb_glx_query_server_string_reply_t* reply =
|
||||||
|
xcb_glx_query_server_string_reply(c,
|
||||||
|
xcb_glx_query_server_string(c,
|
||||||
|
screen,
|
||||||
|
name),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* The spec doesn't mention this, but the Xorg server replies with
|
||||||
|
* a string already terminated with '\0'. */
|
||||||
|
uint32_t len = xcb_glx_query_server_string_string_length(reply);
|
||||||
|
char* buf = Xmalloc(len);
|
||||||
|
memcpy(buf, xcb_glx_query_server_string_string(reply), len);
|
||||||
|
free(reply);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange a protocol request for glGetString.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
__glXGetString(Display* dpy,
|
||||||
|
CARD32 contextTag,
|
||||||
|
CARD32 name)
|
||||||
|
{
|
||||||
|
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||||
|
xcb_glx_get_string_reply_t* reply =
|
||||||
|
xcb_glx_get_string_reply(c,
|
||||||
|
xcb_glx_get_string(c,
|
||||||
|
contextTag,
|
||||||
|
name),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* The spec doesn't mention this, but the Xorg server replies with
|
||||||
|
* a string already terminated with '\0'. */
|
||||||
|
uint32_t len = xcb_glx_get_string_string_length(reply);
|
||||||
|
char* buf = Xmalloc(len);
|
||||||
|
memcpy(buf, xcb_glx_get_string_string(reply), len);
|
||||||
|
free(reply);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GLX protocol structure for the ficticious "GXLGenericGetString" request.
|
* GLX protocol structure for the ficticious "GXLGenericGetString" request.
|
||||||
*
|
*
|
||||||
|
|
@ -108,27 +164,26 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_XCB
|
|
||||||
char *
|
char *
|
||||||
__glXQueryServerString(Display* dpy,
|
__glXQueryServerString(Display* dpy,
|
||||||
CARD32 screen,
|
CARD32 screen,
|
||||||
CARD32 name)
|
CARD32 name)
|
||||||
{
|
{
|
||||||
xcb_connection_t *c = XGetXCBConnection(dpy);
|
GLXContext gc = __glXGetCurrentContext();
|
||||||
xcb_glx_query_server_string_reply_t* reply =
|
return __glXGetStringFromServer(dpy, gc->majorOpcode,
|
||||||
xcb_glx_query_server_string_reply(c,
|
X_GLXQueryServerString,
|
||||||
xcb_glx_query_server_string(c,
|
screen, name);
|
||||||
screen,
|
|
||||||
name),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* The spec doesn't mention this, but the Xorg server replies with
|
|
||||||
* a string already terminated with '\0'. */
|
|
||||||
uint32_t len = xcb_glx_query_server_string_string_length(reply);
|
|
||||||
char* buf = Xmalloc(len);
|
|
||||||
memcpy(buf, xcb_glx_query_server_string_string(reply), len);
|
|
||||||
free(reply);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
__glXGetString(Display* dpy,
|
||||||
|
CARD32 contextTag,
|
||||||
|
CARD32 name)
|
||||||
|
{
|
||||||
|
GLXContext gc = __glXGetCurrentContext();
|
||||||
|
return __glXGetStringFromServer(dpy, gc->majorOpcode, X_GLsop_GetString,
|
||||||
|
contextTag, name);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* USE_XCB */
|
#endif /* USE_XCB */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -739,12 +739,8 @@ extern void _XSend(Display*, const void*, long);
|
||||||
extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
|
extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
|
||||||
int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );
|
int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );
|
||||||
|
|
||||||
extern char * __glXGetStringFromServer( Display * dpy, int opcode,
|
|
||||||
CARD32 glxCode, CARD32 for_whom, CARD32 name );
|
|
||||||
|
|
||||||
#ifdef USE_XCB
|
|
||||||
extern char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name);
|
extern char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name);
|
||||||
#endif
|
extern char * __glXGetString(Display* dpy, CARD32 screen, CARD32 name);
|
||||||
|
|
||||||
extern char *__glXstrdup(const char *str);
|
extern char *__glXstrdup(const char *str);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue