summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-06-16 15:44:48 -0400
committerAdam Jackson <ajax@redhat.com>2017-06-20 16:39:23 -0400
commitc33541e59e338cd53f89d94a6898555d350e84aa (patch)
tree4e7ff0f11bf33faa39889484dc322c28da35d20f
parentd6db66811643d3762716f6b144a7358572216a4f (diff)
glx: Remove __glXReply
Static data bad, hulk smash. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--glx/glxext.c5
-rw-r--r--glx/indirect_program.c3
-rw-r--r--glx/indirect_texture_compression.c6
-rw-r--r--glx/indirect_util.c32
-rw-r--r--glx/single2.c2
-rw-r--r--glx/single2swap.c1
-rw-r--r--glx/singlepix.c26
-rw-r--r--glx/singlepixswap.c26
-rw-r--r--glx/unpack.h42
9 files changed, 69 insertions, 74 deletions
diff --git a/glx/glxext.c b/glx/glxext.c
index 091dd75c1..e88bbd107 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -53,11 +53,6 @@
RESTYPE __glXContextRes;
RESTYPE __glXDrawableRes;
-/*
-** Reply for most singles.
-*/
-xGLXSingleReply __glXReply;
-
static DevPrivateKeyRec glxClientPrivateKeyRec;
#define glxClientPrivateKey (&glxClientPrivateKeyRec)
diff --git a/glx/indirect_program.c b/glx/indirect_program.c
index 5caee7b2a..69a050820 100644
--- a/glx/indirect_program.c
+++ b/glx/indirect_program.c
@@ -64,6 +64,7 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
GLenum pname;
GLint compsize = 0;
char *answer = NULL, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
if (do_swap) {
target = (GLenum) bswap_32(*(int *) (pc + 0));
@@ -92,7 +93,7 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
+ ((xGLXGetTexImageReply *) &reply)->width = compsize;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/glx/indirect_texture_compression.c b/glx/indirect_texture_compression.c
index 1ebf7f3a2..6d25bcd04 100644
--- a/glx/indirect_texture_compression.c
+++ b/glx/indirect_texture_compression.c
@@ -51,6 +51,7 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
const GLint level = *(GLint *) (pc + 4);
GLint compsize = 0;
char *answer = NULL, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
&compsize);
@@ -69,7 +70,7 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
+ ((xGLXGetTexImageReply *) &reply)->width = compsize;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -97,6 +98,7 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
const GLint level = (GLint) bswap_32(*(int *) (pc + 4));
GLint compsize = 0;
char *answer = NULL, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
&compsize);
@@ -115,7 +117,7 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
+ ((xGLXGetTexImageReply *) &reply)->width = compsize;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/glx/indirect_util.c b/glx/indirect_util.c
index 9ba28157c..dccffa393 100644
--- a/glx/indirect_util.c
+++ b/glx/indirect_util.c
@@ -45,8 +45,6 @@
#define __GLX_PAD(a) (((a)+3)&~3)
-extern xGLXSingleReply __glXReply;
-
GLint
__glGetBooleanv_variable_size(GLenum e)
{
@@ -117,6 +115,7 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
size_t element_size, GLboolean always_array, CARD32 retval)
{
size_t reply_ints = 0;
+ xGLXSingleReply reply = { 0, };
if (__glXErrorOccured()) {
elements = 0;
@@ -125,11 +124,11 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
reply_ints = bytes_to_int32(elements * element_size);
}
- __glXReply.length = reply_ints;
- __glXReply.type = X_Reply;
- __glXReply.sequenceNumber = client->sequence;
- __glXReply.size = elements;
- __glXReply.retval = retval;
+ reply.length = reply_ints;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.size = elements;
+ reply.retval = retval;
/* It is faster on almost always every architecture to just copy the 8
* bytes, even when not necessary, than check to see of the value of
@@ -137,8 +136,8 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
* harm.
*/
- (void) memcpy(&__glXReply.pad3, data, 8);
- WriteToClient(client, sz_xGLXSingleReply, &__glXReply);
+ (void) memcpy(&reply.pad3, data, 8);
+ WriteToClient(client, sz_xGLXSingleReply, &reply);
if (reply_ints != 0) {
WriteToClient(client, reply_ints * 4, data);
@@ -163,6 +162,7 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
size_t element_size, GLboolean always_array, CARD32 retval)
{
size_t reply_ints = 0;
+ xGLXSingleReply reply = { 0, };
if (__glXErrorOccured()) {
elements = 0;
@@ -171,11 +171,11 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
reply_ints = bytes_to_int32(elements * element_size);
}
- __glXReply.length = bswap_32(reply_ints);
- __glXReply.type = X_Reply;
- __glXReply.sequenceNumber = bswap_16(client->sequence);
- __glXReply.size = bswap_32(elements);
- __glXReply.retval = bswap_32(retval);
+ reply.length = bswap_32(reply_ints);
+ reply.type = X_Reply;
+ reply.sequenceNumber = bswap_16(client->sequence);
+ reply.size = bswap_32(elements);
+ reply.retval = bswap_32(retval);
/* It is faster on almost always every architecture to just copy the 8
* bytes, even when not necessary, than check to see of the value of
@@ -183,8 +183,8 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
* harm.
*/
- (void) memcpy(&__glXReply.pad3, data, 8);
- WriteToClient(client, sz_xGLXSingleReply, &__glXReply);
+ (void) memcpy(&reply.pad3, data, 8);
+ WriteToClient(client, sz_xGLXSingleReply, &reply);
if (reply_ints != 0) {
WriteToClient(client, reply_ints * 4, data);
diff --git a/glx/single2.c b/glx/single2.c
index 62dcd79ef..e7488194b 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -232,6 +232,7 @@ __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
__GLXcontext *cx;
int error;
+ xGLXSingleReply reply = { 0, };
REQUEST_SIZE_MATCH(xGLXSingleReq);
@@ -328,6 +329,7 @@ DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap)
__GLXcontext *cx;
GLenum name;
const char *string;
+ xGLXSingleReply reply = { 0, };
__GLX_DECLARE_SWAP_VARIABLES;
int error;
diff --git a/glx/single2swap.c b/glx/single2swap.c
index c1df248e8..b140946ba 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -252,6 +252,7 @@ __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
__GLXcontext *cx;
int error;
+ xGLXSingleReply reply = { 0, };
__GLX_DECLARE_SWAP_VARIABLES;
diff --git a/glx/singlepix.c b/glx/singlepix.c
index b253a59be..e1bed19aa 100644
--- a/glx/singlepix.c
+++ b/glx/singlepix.c
@@ -50,6 +50,7 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
int error;
char *answer, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
REQUEST_FIXED_SIZE(xGLXSingleReq, 28);
@@ -100,6 +101,7 @@ __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
int error;
char *answer, answerBuffer[200];
GLint width = 0, height = 0, depth = 1;
+ xGLXSingleReply reply = { 0, };
REQUEST_FIXED_SIZE(xGLXSingleReq, 20);
@@ -141,9 +143,9 @@ __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *) &__glXReply)->width = width;
- ((xGLXGetTexImageReply *) &__glXReply)->height = height;
- ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
+ ((xGLXGetTexImageReply *) &reply)->width = width;
+ ((xGLXGetTexImageReply *) &reply)->height = height;
+ ((xGLXGetTexImageReply *) &reply)->depth = depth;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -159,6 +161,7 @@ __glXDisp_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
int error;
GLubyte answerBuffer[200];
char *answer;
+ xGLXSingleReply reply = { 0, };
REQUEST_FIXED_SIZE(xGLXSingleReq, 4);
@@ -199,6 +202,7 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
int error;
char *answer, answerBuffer[200];
GLint width = 0, height = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -239,8 +243,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize + compsize2);
- ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
- ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
+ ((xGLXGetSeparableFilterReply *) &reply)->width = width;
+ ((xGLXGetSeparableFilterReply *) &reply)->height = height;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize + compsize2);
}
@@ -277,6 +281,7 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
int error;
char *answer, answerBuffer[200];
GLint width = 0, height = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -315,8 +320,8 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
- ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
+ ((xGLXGetConvolutionFilterReply *) &reply)->width = width;
+ ((xGLXGetConvolutionFilterReply *) &reply)->height = height;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -353,6 +358,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
int error;
char *answer, answerBuffer[200];
GLint width = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -385,7 +391,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetHistogramReply *) &__glXReply)->width = width;
+ ((xGLXGetHistogramReply *) &reply)->width = width;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -421,6 +427,7 @@ GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
ClientPtr client = cl->client;
int error;
char *answer, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -484,6 +491,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
int error;
char *answer, answerBuffer[200];
GLint width = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -516,7 +524,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
}
else {
__GLX_BEGIN_REPLY(compsize);
- ((xGLXGetColorTableReply *) &__glXReply)->width = width;
+ ((xGLXGetColorTableReply *) &reply)->width = width;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/glx/singlepixswap.c b/glx/singlepixswap.c
index 684f4e834..8e4d9bddf 100644
--- a/glx/singlepixswap.c
+++ b/glx/singlepixswap.c
@@ -52,6 +52,7 @@ __glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
int error;
char *answer, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
REQUEST_FIXED_SIZE(xGLXSingleReq, 28);
@@ -114,6 +115,7 @@ __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
int error;
char *answer, answerBuffer[200];
GLint width = 0, height = 0, depth = 1;
+ xGLXSingleReply reply = { 0, };
REQUEST_FIXED_SIZE(xGLXSingleReq, 20);
@@ -166,9 +168,9 @@ __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_INT(&width);
__GLX_SWAP_INT(&height);
__GLX_SWAP_INT(&depth);
- ((xGLXGetTexImageReply *) &__glXReply)->width = width;
- ((xGLXGetTexImageReply *) &__glXReply)->height = height;
- ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
+ ((xGLXGetTexImageReply *) &reply)->width = width;
+ ((xGLXGetTexImageReply *) &reply)->height = height;
+ ((xGLXGetTexImageReply *) &reply)->depth = depth;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -184,6 +186,7 @@ __glXDispSwap_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
int error;
GLubyte answerBuffer[200];
char *answer;
+ xGLXSingleReply reply = { 0, };
__GLX_DECLARE_SWAP_VARIABLES;
@@ -229,6 +232,7 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200];
GLint width = 0, height = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -276,8 +280,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
__GLX_SWAP_INT(&height);
- ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
- ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
+ ((xGLXGetSeparableFilterReply *) &reply)->width = width;
+ ((xGLXGetSeparableFilterReply *) &reply)->height = height;
__GLX_SEND_VOID_ARRAY(compsize + compsize2);
}
@@ -317,6 +321,7 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200];
GLint width = 0, height = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -362,8 +367,8 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
__GLX_SWAP_INT(&height);
- ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
- ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
+ ((xGLXGetConvolutionFilterReply *) &reply)->width = width;
+ ((xGLXGetConvolutionFilterReply *) &reply)->height = height;
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -403,6 +408,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200];
GLint width = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -441,7 +447,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_BEGIN_REPLY(compsize);
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
- ((xGLXGetHistogramReply *) &__glXReply)->width = width;
+ ((xGLXGetHistogramReply *) &reply)->width = width;
__GLX_SEND_VOID_ARRAY(compsize);
}
@@ -480,6 +486,7 @@ GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200];
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -551,6 +558,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200];
GLint width = 0;
+ xGLXSingleReply reply = { 0, };
cx = __glXForceCurrent(cl, tag, &error);
if (!cx) {
@@ -589,7 +597,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
__GLX_BEGIN_REPLY(compsize);
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
- ((xGLXGetColorTableReply *) &__glXReply)->width = width;
+ ((xGLXGetColorTableReply *) &reply)->width = width;
__GLX_SEND_VOID_ARRAY(compsize);
}
diff --git a/glx/unpack.h b/glx/unpack.h
index 2b1ebcf02..9676e64c4 100644
--- a/glx/unpack.h
+++ b/glx/unpack.h
@@ -53,26 +53,19 @@
#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
#endif
-extern void __glXMemInit(void);
-
-extern xGLXSingleReply __glXReply;
-
#define __GLX_BEGIN_REPLY(size) \
- __glXReply.length = __GLX_PAD(size) >> 2; \
- __glXReply.type = X_Reply; \
- __glXReply.sequenceNumber = client->sequence;
+ reply.length = __GLX_PAD(size) >> 2; \
+ reply.type = X_Reply; \
+ reply.sequenceNumber = client->sequence;
#define __GLX_SEND_HEADER() \
- WriteToClient (client, sz_xGLXSingleReply, &__glXReply);
+ WriteToClient (client, sz_xGLXSingleReply, &reply);
#define __GLX_PUT_RETVAL(a) \
- __glXReply.retval = (a);
+ reply.retval = (a);
#define __GLX_PUT_SIZE(a) \
- __glXReply.size = (a);
-
-#define __GLX_PUT_RENDERMODE(m) \
- __glXReply.pad3 = (m)
+ reply.size = (a);
/*
** Get a buffer to hold returned data, with the given alignment. If we have
@@ -101,21 +94,6 @@ extern xGLXSingleReply __glXReply;
res = (char *)answerBuffer; \
}
-#define __GLX_PUT_BYTE() \
- *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer
-
-#define __GLX_PUT_SHORT() \
- *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer
-
-#define __GLX_PUT_INT() \
- *(GLint *)&__glXReply.pad3 = *(GLint *)answer
-
-#define __GLX_PUT_FLOAT() \
- *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer
-
-#define __GLX_PUT_DOUBLE() \
- *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
-
#define __GLX_SEND_BYTE_ARRAY(len) \
WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer)
@@ -216,13 +194,13 @@ extern xGLXSingleReply __glXReply;
}
#define __GLX_SWAP_REPLY_HEADER() \
- __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \
- __GLX_SWAP_INT(&__glXReply.length);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber); \
+ __GLX_SWAP_INT(&reply.length);
#define __GLX_SWAP_REPLY_RETVAL() \
- __GLX_SWAP_INT(&__glXReply.retval)
+ __GLX_SWAP_INT(&reply.retval)
#define __GLX_SWAP_REPLY_SIZE() \
- __GLX_SWAP_INT(&__glXReply.size)
+ __GLX_SWAP_INT(&reply.size)
#endif /* !__GLX_unpack_h__ */