It's been required for building glx since
b518dfb513
in january.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
tags/gles3-fmt-v1
@@ -31,13 +31,10 @@ | |||
#include "glxclient.h" | |||
#if defined(USE_XCB) | |||
# include <X11/Xlib-xcb.h> | |||
# include <xcb/xcb.h> | |||
# include <xcb/glx.h> | |||
#endif | |||
#ifdef USE_XCB | |||
/** | |||
* Exchange a protocol request for glXQueryServerString. | |||
@@ -87,91 +84,3 @@ __glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name) | |||
return buf; | |||
} | |||
#else | |||
/** | |||
* GLX protocol structure for the ficticious "GXLGenericGetString" request. | |||
* | |||
* This is a non-existant protocol packet. It just so happens that all of | |||
* the real protocol packets used to request a string from the server have | |||
* an identical binary layout. The only difference between them is the | |||
* meaning of the \c for_whom field and the value of the \c glxCode. | |||
*/ | |||
typedef struct GLXGenericGetString | |||
{ | |||
CARD8 reqType; | |||
CARD8 glxCode; | |||
CARD16 length B16; | |||
CARD32 for_whom B32; | |||
CARD32 name B32; | |||
} xGLXGenericGetStringReq; | |||
/* These defines are only needed to make the GetReq macro happy. | |||
*/ | |||
#define sz_xGLXGenericGetStringReq 12 | |||
#define X_GLXGenericGetString 0 | |||
/** | |||
* Query the Server GLX string. | |||
* This routine will allocate the necessay space for the string. | |||
*/ | |||
static char * | |||
__glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode, | |||
CARD32 for_whom, CARD32 name) | |||
{ | |||
xGLXGenericGetStringReq *req; | |||
xGLXSingleReply reply; | |||
int length; | |||
int numbytes; | |||
char *buf; | |||
LockDisplay(dpy); | |||
/* All of the GLX protocol requests for getting a string from the server | |||
* look the same. The exact meaning of the for_whom field is usually | |||
* either the screen number (for glXQueryServerString) or the context tag | |||
* (for GLXSingle). | |||
*/ | |||
GetReq(GLXGenericGetString, req); | |||
req->reqType = opcode; | |||
req->glxCode = glxCode; | |||
req->for_whom = for_whom; | |||
req->name = name; | |||
_XReply(dpy, (xReply *) & reply, 0, False); | |||
length = reply.length * 4; | |||
numbytes = reply.size; | |||
buf = malloc(numbytes); | |||
if (buf != NULL) { | |||
_XRead(dpy, buf, numbytes); | |||
length -= numbytes; | |||
} | |||
_XEatData(dpy, length); | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
return buf; | |||
} | |||
char * | |||
__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name) | |||
{ | |||
return __glXGetStringFromServer(dpy, opcode, | |||
X_GLXQueryServerString, screen, name); | |||
} | |||
char * | |||
__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name) | |||
{ | |||
return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString, | |||
contextTag, name); | |||
} | |||
#endif /* USE_XCB */ |
@@ -53,11 +53,9 @@ | |||
#else | |||
#endif | |||
#if defined(USE_XCB) | |||
#include <X11/Xlib-xcb.h> | |||
#include <xcb/xcb.h> | |||
#include <xcb/glx.h> | |||
#endif | |||
static const char __glXGLXClientVendorName[] = "Mesa Project and SGI"; | |||
static const char __glXGLXClientVersion[] = "1.4"; | |||
@@ -576,10 +574,6 @@ glXCopyContext(Display * dpy, GLXContext source_user, | |||
static Bool | |||
__glXIsDirect(Display * dpy, GLXContextID contextID) | |||
{ | |||
#if !defined(USE_XCB) | |||
xGLXIsDirectReq *req; | |||
xGLXIsDirectReply reply; | |||
#endif | |||
CARD8 opcode; | |||
opcode = __glXSetupForCommand(dpy); | |||
@@ -587,7 +581,6 @@ __glXIsDirect(Display * dpy, GLXContextID contextID) | |||
return GL_FALSE; | |||
} | |||
#ifdef USE_XCB | |||
xcb_connection_t *c = XGetXCBConnection(dpy); | |||
xcb_generic_error_t *err; | |||
xcb_glx_is_direct_reply_t *reply = xcb_glx_is_direct_reply(c, | |||
@@ -605,19 +598,6 @@ __glXIsDirect(Display * dpy, GLXContextID contextID) | |||
free(reply); | |||
return is_direct; | |||
#else | |||
/* Send the glXIsDirect request */ | |||
LockDisplay(dpy); | |||
GetReq(GLXIsDirect, req); | |||
req->reqType = opcode; | |||
req->glxCode = X_GLXIsDirect; | |||
req->context = contextID; | |||
_XReply(dpy, (xReply *) & reply, 0, False); | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
return reply.isDirect; | |||
#endif /* USE_XCB */ | |||
} | |||
/** | |||
@@ -792,11 +772,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) | |||
struct glx_context *gc; | |||
GLXContextTag tag; | |||
CARD8 opcode; | |||
#ifdef USE_XCB | |||
xcb_connection_t *c; | |||
#else | |||
xGLXSwapBuffersReq *req; | |||
#endif | |||
gc = __glXGetCurrentContext(); | |||
@@ -833,22 +809,9 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) | |||
tag = 0; | |||
} | |||
#ifdef USE_XCB | |||
c = XGetXCBConnection(dpy); | |||
xcb_glx_swap_buffers(c, tag, drawable); | |||
xcb_flush(c); | |||
#else | |||
/* Send the glXSwapBuffers request */ | |||
LockDisplay(dpy); | |||
GetReq(GLXSwapBuffers, req); | |||
req->reqType = opcode; | |||
req->glxCode = X_GLXSwapBuffers; | |||
req->drawable = drawable; | |||
req->contextTag = tag; | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
XFlush(dpy); | |||
#endif /* USE_XCB */ | |||
#endif /* GLX_USE_APPLEGL */ | |||
} | |||
@@ -1369,28 +1332,9 @@ __glXClientInfo(Display * dpy, int opcode) | |||
char *ext_str = __glXGetClientGLExtensionString(); | |||
int size = strlen(ext_str) + 1; | |||
#ifdef USE_XCB | |||
xcb_connection_t *c = XGetXCBConnection(dpy); | |||
xcb_glx_client_info(c, | |||
GLX_MAJOR_VERSION, GLX_MINOR_VERSION, size, ext_str); | |||
#else | |||
xGLXClientInfoReq *req; | |||
/* Send the glXClientInfo request */ | |||
LockDisplay(dpy); | |||
GetReq(GLXClientInfo, req); | |||
req->reqType = opcode; | |||
req->glxCode = X_GLXClientInfo; | |||
req->major = GLX_MAJOR_VERSION; | |||
req->minor = GLX_MINOR_VERSION; | |||
req->length += (size + 3) >> 2; | |||
req->numbytes = size; | |||
Data(dpy, ext_str, size); | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
#endif /* USE_XCB */ | |||
free(ext_str); | |||
} |
@@ -47,11 +47,9 @@ | |||
#endif | |||
#include "glxextensions.h" | |||
#ifdef USE_XCB | |||
#include <X11/Xlib-xcb.h> | |||
#include <xcb/xcb.h> | |||
#include <xcb/glx.h> | |||
#endif | |||
#ifdef DEBUG | |||
@@ -282,7 +280,6 @@ __glXCloseDisplay(Display * dpy, XExtCodes * codes) | |||
static Bool | |||
QueryVersion(Display * dpy, int opcode, int *major, int *minor) | |||
{ | |||
#ifdef USE_XCB | |||
xcb_connection_t *c = XGetXCBConnection(dpy); | |||
xcb_glx_query_version_reply_t *reply = xcb_glx_query_version_reply(c, | |||
xcb_glx_query_version | |||
@@ -302,32 +299,6 @@ QueryVersion(Display * dpy, int opcode, int *major, int *minor) | |||
*minor = min(reply->minor_version, GLX_MINOR_VERSION); | |||
free(reply); | |||
return GL_TRUE; | |||
#else | |||
xGLXQueryVersionReq *req; | |||
xGLXQueryVersionReply reply; | |||
/* Send the glXQueryVersion request */ | |||
LockDisplay(dpy); | |||
GetReq(GLXQueryVersion, req); | |||
req->reqType = opcode; | |||
req->glxCode = X_GLXQueryVersion; | |||
req->majorVersion = GLX_MAJOR_VERSION; | |||
req->minorVersion = GLX_MINOR_VERSION; | |||
_XReply(dpy, (xReply *) & reply, 0, False); | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
if (reply.majorVersion != GLX_MAJOR_VERSION) { | |||
/* | |||
** The server does not support the same major release as this | |||
** client. | |||
*/ | |||
return GL_FALSE; | |||
} | |||
*major = reply.majorVersion; | |||
*minor = min(reply.minorVersion, GLX_MINOR_VERSION); | |||
return GL_TRUE; | |||
#endif /* USE_XCB */ | |||
} | |||
/* | |||
@@ -887,11 +858,7 @@ __glXInitialize(Display * dpy) | |||
return NULL; | |||
} | |||
#ifdef USE_XCB | |||
__glX_send_client_info(dpyPriv); | |||
#else | |||
__glXClientInfo(dpy, dpyPriv->majorOpcode); | |||
#endif | |||
/* Grab the lock again and add the dispay private, unless somebody | |||
* beat us to initializing on this display in the meantime. */ | |||
@@ -963,29 +930,12 @@ _X_HIDDEN GLubyte * | |||
__glXFlushRenderBuffer(struct glx_context * ctx, GLubyte * pc) | |||
{ | |||
Display *const dpy = ctx->currentDpy; | |||
#ifdef USE_XCB | |||
xcb_connection_t *c = XGetXCBConnection(dpy); | |||
#else | |||
xGLXRenderReq *req; | |||
#endif /* USE_XCB */ | |||
const GLint size = pc - ctx->buf; | |||
if ((dpy != NULL) && (size > 0)) { | |||
#ifdef USE_XCB | |||
xcb_glx_render(c, ctx->currentContextTag, size, | |||
(const uint8_t *) ctx->buf); | |||
#else | |||
/* Send the entire buffer as an X request */ | |||
LockDisplay(dpy); | |||
GetReq(GLXRender, req); | |||
req->reqType = ctx->majorOpcode; | |||
req->glxCode = X_GLXRender; | |||
req->contextTag = ctx->currentContextTag; | |||
req->length += (size + 3) >> 2; | |||
_XSend(dpy, (char *) ctx->buf, size); | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
#endif | |||
} | |||
/* Reset pointer and return it */ | |||
@@ -1015,32 +965,9 @@ __glXSendLargeChunk(struct glx_context * gc, GLint requestNumber, | |||
GLint totalRequests, const GLvoid * data, GLint dataLen) | |||
{ | |||
Display *dpy = gc->currentDpy; | |||
#ifdef USE_XCB | |||
xcb_connection_t *c = XGetXCBConnection(dpy); | |||
xcb_glx_render_large(c, gc->currentContextTag, requestNumber, | |||
totalRequests, dataLen, data); | |||
#else | |||
xGLXRenderLargeReq *req; | |||
if (requestNumber == 1) { | |||
LockDisplay(dpy); | |||
} | |||
GetReq(GLXRenderLarge, req); | |||
req->reqType = gc->majorOpcode; | |||
req->glxCode = X_GLXRenderLarge; | |||
req->contextTag = gc->currentContextTag; | |||
req->length += (dataLen + 3) >> 2; | |||
req->requestNumber = requestNumber; | |||
req->requestTotal = totalRequests; | |||
req->dataBytes = dataLen; | |||
Data(dpy, data, dataLen); | |||
if (requestNumber == totalRequests) { | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
} | |||
#endif /* USE_XCB */ | |||
} | |||
@@ -36,11 +36,9 @@ | |||
#include "indirect.h" | |||
#include "indirect_vertex_array.h" | |||
#include "glapi.h" | |||
#ifdef USE_XCB | |||
#include <xcb/xcb.h> | |||
#include <xcb/glx.h> | |||
#include <X11/Xlib-xcb.h> | |||
#endif /* USE_XCB */ | |||
#if !defined(__GNUC__) | |||
# define __builtin_expect(x, y) x | |||
@@ -887,7 +885,6 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, | |||
Display *const dpy = gc->currentDpy; | |||
GLboolean retval = (GLboolean) 0; | |||
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { | |||
#ifdef USE_XCB | |||
xcb_connection_t *c = XGetXCBConnection(dpy); | |||
(void) __glXFlushRenderBuffer(gc, gc->pc); | |||
xcb_glx_are_textures_resident_reply_t *reply = | |||
@@ -900,31 +897,6 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, | |||
sizeof(GLboolean)); | |||
retval = reply->ret_val; | |||
free(reply); | |||
#else | |||
const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); | |||
GLubyte const *pc = | |||
__glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen); | |||
(void) memcpy((void *) (pc + 0), (void *) (&n), 4); | |||
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4)); | |||
if (n & 3) { | |||
/* n is not a multiple of four. | |||
* When reply_is_always_array is TRUE, __glXReadReply() will | |||
* put a multiple of four bytes into the dest buffer. If the | |||
* caller's buffer is not a multiple of four in size, we'll write | |||
* out of bounds. So use a temporary buffer that's a few bytes | |||
* larger. | |||
*/ | |||
GLboolean *res4 = malloc((n + 3) & ~3); | |||
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE); | |||
memcpy(residences, res4, n); | |||
free(res4); | |||
} | |||
else { | |||
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE); | |||
} | |||
UnlockDisplay(dpy); | |||
SyncHandle(); | |||
#endif /* USE_XCB */ | |||
} | |||
return retval; | |||
} |