aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxcmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx/glxcmds.c')
-rw-r--r--xorg-server/glx/glxcmds.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index c1f4e22f8..36be33404 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -30,6 +30,10 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
#endif
#include <string.h>
@@ -215,6 +219,12 @@ __glXdirectContextCreate(__GLXscreen * screen,
return context;
}
+void FlushContext(__GLXcontext *cx)
+{
+ CALL_Flush( GET_DISPATCH(), () );
+ cx->hasUnflushedCommands = GL_FALSE;
+}
+
/**
* Create a GL context with the given properties. This routine is used
* to implement \c glXCreateContext, \c glXCreateNewContext, and
@@ -500,7 +510,7 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
return NULL;
}
- if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
+ if (!glxc || pDraw->pScreen != glxc->pGlxScreen->pScreen) {
client->errorValue = pDraw->pScreen->myNum;
*error = BadMatch;
return NULL;
@@ -513,6 +523,12 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
pDraw, drawId,
GLX_DRAWABLE_WINDOW,
drawId, glxc->config);
+ if (!pGlxDraw)
+ {
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
+ }
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
@@ -651,17 +667,17 @@ DoMakeCurrent(__GLXclientState * cl,
StopUsingContext(prevglxc);
- reply = (xGLXMakeCurrentReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .contextTag = 0
- };
-
if (glxc) {
StartUsingContext(cl, glxc);
reply.contextTag = glxc->id;
}
+ else {
+ reply.contextTag = 0;
+ }
+
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapMakeCurrentReply(client, &reply);
@@ -722,12 +738,10 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err;
- reply = (xGLXIsDirectReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .isDirect = glxc->isDirect
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = 0;
+ reply.isDirect = glxc->isDirect;
if (client->swapped) {
__glXSwapIsDirectReply(client, &reply);
@@ -759,13 +773,11 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
** client if it wants to work with older clients; however, in this
** implementation the server just returns its version number.
*/
- reply = (xGLXQueryVersionReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .majorVersion = glxMajorVersion,
- .minorVersion = glxMinorVersion
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = 0;
+ reply.majorVersion = glxMajorVersion;
+ reply.minorVersion = glxMinorVersion;
if (client->swapped) {
__glXSwapQueryVersionReply(client, &reply);
@@ -939,14 +951,12 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
- reply = (xGLXGetVisualConfigsReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = (pGlxScreen->numVisuals *
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = (pGlxScreen->numVisuals *
__GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2,
- .numVisuals = pGlxScreen->numVisuals,
- .numProps = GLX_VIS_CONFIG_TOTAL
- };
+ reply.numVisuals = pGlxScreen->numVisuals;
+ reply.numProps = GLX_VIS_CONFIG_TOTAL;
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -1045,13 +1055,11 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
return err;
- reply = (xGLXGetFBConfigsReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = __GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs,
- .numFBConfigs = pGlxScreen->numFBConfigs,
- .numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs);
+ reply.numFBConfigs = pGlxScreen->numFBConfigs;
+ reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -1671,12 +1679,10 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
return err;
nProps = 3;
- reply = (xGLXQueryContextInfoEXTReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = nProps << 1,
- .n = nProps
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = nProps << 1;
+ reply.n = nProps;
nReplyBytes = reply.length << 2;
sendBuf = (int *) malloc((size_t) nReplyBytes);
@@ -1880,12 +1886,10 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
return error;
numAttribs = 3;
- reply = (xGLXGetDrawableAttributesReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = numAttribs << 1,
- .numAttribs = numAttribs
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = numAttribs << 1;
+ reply.numAttribs = numAttribs;
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
@@ -2321,12 +2325,10 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
- reply = (xGLXQueryExtensionsStringReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = length,
- .n = n
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = length;
+ reply.n = n;
/* Allocate buffer to make sure it's a multiple of 4 bytes big. */
buf = calloc(length, 4);
@@ -2384,12 +2386,10 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
- reply = (xGLXQueryServerStringReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = length,
- .n = n
- };
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = length;
+ reply.n = n;
buf = calloc(length, 4);
if (buf == NULL) {