diff options
Diffstat (limited to 'xorg-server/glx/glxcmds.c')
-rw-r--r-- | xorg-server/glx/glxcmds.c | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c index d57dff5e0..dfe345c7f 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>
@@ -132,7 +136,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config, static int
validGlxContext(ClientPtr client, XID id, int access_mode,
- __GLXcontext **context, int *err)
+ struct glx_context **context, int *err)
{
*err = dixLookupResourceByType((pointer *) context, id,
__glXContextRes, client, access_mode);
@@ -187,24 +191,24 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode, }
void
-__glXContextDestroy(__GLXcontext *context)
+__glXContextDestroy(struct glx_context *context)
{
__glXFlushContextCache();
}
-static void __glXdirectContextDestroy(__GLXcontext *context)
+static void __glXdirectContextDestroy(struct glx_context *context)
{
__glXContextDestroy(context);
free(context);
}
-static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
+static struct glx_context *__glXdirectContextCreate(__GLXscreen *screen,
__GLXconfig *modes,
- __GLXcontext *shareContext)
+ struct glx_context *shareContext)
{
- __GLXcontext *context;
+ struct glx_context *context;
- context = calloc(1, sizeof (__GLXcontext));
+ context = calloc(1, sizeof (struct glx_context));
if (context == NULL)
return NULL;
@@ -213,6 +217,12 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, return context;
}
+void FlushContext(struct glx_context *cx)
+{
+ CALL_Flush( GET_DISPATCH(), () );
+ __GLX_NOTE_FLUSHED_CMDS(cx);
+}
+
/**
* Create a GL context with the given properties. This routine is used
* to implement \c glXCreateContext, \c glXCreateNewContext, and
@@ -227,7 +237,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, __GLXscreen *pGlxScreen, GLboolean isDirect)
{
ClientPtr client = cl->client;
- __GLXcontext *glxc, *shareglxc;
+ struct glx_context *glxc, *shareglxc;
int err;
LEGAL_NEW_RESOURCE(gcId, client);
@@ -373,7 +383,7 @@ int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc) {
ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
- __GLXcontext *glxc;
+ struct glx_context *glxc;
int err;
REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
@@ -397,11 +407,11 @@ int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc) /*
** Add a current context, and return the tag that will be used to refer to it.
*/
-static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
+static int AddCurrentContext(__GLXclientState *cl, struct glx_context *glxc)
{
int i;
int num = cl->numCurrentContexts;
- __GLXcontext **table = cl->currentContexts;
+ struct glx_context **table = cl->currentContexts;
if (!glxc) return -1;
@@ -418,10 +428,10 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) ** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
- table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
+ table = (struct glx_context **) malloc(sizeof(struct glx_context *));
} else {
- table = (__GLXcontext **) realloc(table,
- (num+1)*sizeof(__GLXcontext *));
+ table = (struct glx_context **) realloc(table,
+ (num+1)*sizeof(struct glx_context *));
}
table[num] = glxc;
cl->currentContexts = table;
@@ -432,10 +442,10 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) /*
** Given a tag, change the current context for the corresponding entry.
*/
-static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
+static void ChangeCurrentContext(__GLXclientState *cl, struct glx_context *glxc,
GLXContextTag tag)
{
- __GLXcontext **table = cl->currentContexts;
+ struct glx_context **table = cl->currentContexts;
table[tag-1] = glxc;
}
@@ -444,7 +454,7 @@ static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, ** context's entry in the table as the context tag. A tag must be greater
** than 0.
*/
-__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+struct glx_context *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
@@ -457,7 +467,7 @@ __GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag) /*****************************************************************************/
-static void StopUsingContext(__GLXcontext *glxc)
+static void StopUsingContext(struct glx_context *glxc)
{
if (glxc) {
if (glxc == __glXLastContext) {
@@ -471,7 +481,7 @@ static void StopUsingContext(__GLXcontext *glxc) }
}
-static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+static void StartUsingContext(__GLXclientState *cl, struct glx_context *glxc)
{
glxc->isCurrent = GL_TRUE;
__glXLastContext = glxc;
@@ -484,7 +494,7 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc) * sure it's an X window and create a GLX drawable one the fly.
*/
static __GLXdrawable *
-__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
+__glXGetDrawable(struct glx_context *glxc, GLXDrawable drawId, ClientPtr client,
int *error)
{
DrawablePtr pDraw;
@@ -521,7 +531,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;
@@ -557,7 +567,7 @@ DoMakeCurrent(__GLXclientState *cl, {
ClientPtr client = cl->client;
xGLXMakeCurrentReply reply;
- __GLXcontext *glxc, *prevglxc;
+ struct glx_context *glxc, *prevglxc;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
int error;
@@ -733,7 +743,7 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
xGLXIsDirectReply reply;
- __GLXcontext *glxc;
+ struct glx_context *glxc;
int err;
REQUEST_SIZE_MATCH(xGLXIsDirectReq);
@@ -793,7 +803,7 @@ int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client;
xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
GLXContextTag tag;
- __GLXcontext *glxc = NULL;
+ struct glx_context *glxc = NULL;
int error;
REQUEST_SIZE_MATCH(xGLXWaitGLReq);
@@ -821,7 +831,7 @@ int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client;
xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
GLXContextTag tag;
- __GLXcontext *glxc = NULL;
+ struct glx_context *glxc = NULL;
int error;
REQUEST_SIZE_MATCH(xGLXWaitXReq);
@@ -850,7 +860,7 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) GLXContextID dest;
GLXContextTag tag;
unsigned long mask;
- __GLXcontext *src, *dst;
+ struct glx_context *src, *dst;
int error;
REQUEST_SIZE_MATCH(xGLXCopyContextReq);
@@ -883,7 +893,7 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) }
if (tag) {
- __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+ struct glx_context *tagcx = __glXLookupContextByTag(cl, tag);
if (!tagcx) {
return __glXError(GLXBadContextTag);
@@ -1592,7 +1602,7 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc) xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
GLXContextTag tag;
XID drawId;
- __GLXcontext *glxc = NULL;
+ struct glx_context *glxc = NULL;
__GLXdrawable *pGlxDraw;
int error;
@@ -1638,7 +1648,7 @@ static int DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
- __GLXcontext *ctx;
+ struct glx_context *ctx;
xGLXQueryContextInfoEXTReply reply;
int nProps;
int *sendBuf, *pSendBuf;
@@ -1702,7 +1712,7 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) {
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
- __GLXcontext *context;
+ struct glx_context *context;
__GLXdrawable *pGlxDraw;
GLXDrawable drawId;
int buffer;
@@ -1747,7 +1757,7 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
__GLXdrawable *pGlxDraw;
- __GLXcontext *context;
+ struct glx_context *context;
GLXDrawable drawId;
int buffer;
int error;
@@ -1779,7 +1789,7 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) {
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLXContextTag tag = req->contextTag;
- __GLXcontext *glxc = NULL;
+ struct glx_context *glxc = NULL;
__GLXdrawable *pGlxDraw;
ClientPtr client = cl->client;
GLXDrawable drawId;
@@ -1917,7 +1927,7 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc) int commandsDone;
CARD16 opcode;
__GLXrenderHeader *hdr;
- __GLXcontext *glxc;
+ struct glx_context *glxc;
__GLX_DECLARE_SWAP_VARIABLES;
REQUEST_AT_LEAST_SIZE(xGLXRenderReq);
@@ -2016,7 +2026,7 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc) ClientPtr client= cl->client;
size_t dataBytes;
__GLXrenderLargeHeader *hdr;
- __GLXcontext *glxc;
+ struct glx_context *glxc;
int error;
CARD16 opcode;
__GLX_DECLARE_SWAP_VARIABLES;
|