From e5956f49b217b0ee9c9f35b6a58f339a8d22b1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 13 Mar 2006 01:54:59 +0000 Subject: [PATCH] First batch of AIGLX fixes from David Reveman. Add getter for Mesa provider. Export this for Xgl. Move resource tracking out of drawable constructor to allow wrapping. Use corrent reply size #define. Add this function. (DoGetDrawableAttributes): Fix array length. --- ChangeLog | 18 ++++++++++++++++++ GL/glx/glxcmds.c | 24 +++++++++++++++--------- GL/glx/glxcmdsswap.c | 2 +- GL/glx/glxutil.c | 14 +++++++++----- GL/glx/glxvisuals.c | 12 ++++++------ GL/mesa/X/xf86glx.c | 6 ++++++ 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac2c718e1..1d73ae885 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-03-12 Kristian Høgsberg + + First batch of AIGLX fixes from David Reveman. + + * GL/mesa/X/xf86glx.c (GlxGetMesaProvider): Add getter for Mesa + provider. + + * GL/glx/glxvisuals.c (GlxInitVisuals): Export this for Xgl. + + * GL/glx/glxutil.c (__glXDrawableInit, __glXGetDrawable): Move + resource tracking out of drawable constructor to allow wrapping. + + * GL/glx/glxcmdsswap.c (__glXSwapGetDrawableAttributesReply): Use + corrent reply size #define. + + * GL/glx/glxcmds.c (GlxSetRenderTables): Add this function. + (DoGetDrawableAttributes): Fix array length. + 2006-03-12 Matthieu Herrb * hw/xfree86/dixmods/Makefile.am diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index 6426e294e..ddbf06388 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -58,8 +58,22 @@ #include "glthread.h" #include "dispatch.h" +#ifndef GLX_TEXTURE_TARGET_EXT +#define GLX_TEXTURE_TARGET_EXT 0x6001 +#define GLX_TEXTURE_2D_EXT 0x6002 +#define GLX_TEXTURE_RECTANGLE_EXT 0x6003 +#define GLX_NO_TEXTURE_EXT 0x6004 +#define GLX_Y_INVERTED_EXT 0x6006 +#endif + /************************************************************************/ +void +GlxSetRenderTables (struct _glapi_table *table) +{ + _glapi_set_dispatch (table); +} + static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); @@ -1517,14 +1531,6 @@ int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) pGlxPixmap); } -#ifndef GLX_TEXTURE_TARGET_EXT -#define GLX_TEXTURE_TARGET_EXT 0x6001 -#define GLX_TEXTURE_2D_EXT 0x6002 -#define GLX_TEXTURE_RECTANGLE_EXT 0x6003 -#define GLX_NO_TEXTURE_EXT 0x6004 -#define GLX_Y_INVERTED_EXT 0x6006 -#endif - /* ** Get drawable attributes */ @@ -1534,7 +1540,7 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId) ClientPtr client = cl->client; __GLXpixmap *glxPixmap; xGLXGetDrawableAttributesReply reply; - CARD32 attributes[2]; + CARD32 attributes[4]; int numAttribs; glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes); diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c index e14106913..a52026f88 100644 --- a/GL/glx/glxcmdsswap.c +++ b/GL/glx/glxcmdsswap.c @@ -531,7 +531,7 @@ void __glXSwapGetDrawableAttributesReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->numAttribs); - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply); + WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); WriteToClient(client, length << 2, (char *)buf); } diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c index 8937d12aa..36ffd27eb 100644 --- a/GL/glx/glxutil.c +++ b/GL/glx/glxutil.c @@ -225,11 +225,6 @@ __glXDrawableInit(__GLXdrawable *drawable, drawable->pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes); - /* since we are creating the drawablePrivate, drawId should be new */ - if (!AddResource(drawId, __glXDrawableRes, drawable)) { - return GL_FALSE; - } - return GL_TRUE; } @@ -251,7 +246,16 @@ __glXGetDrawable(__GLXcontext *ctx, DrawablePtr pDraw, XID drawId) glxPriv = __glXFindDrawable(drawId); if (glxPriv == NULL) + { glxPriv = ctx->createDrawable(ctx, pDraw, drawId); + /* since we are creating the drawablePrivate, drawId should be new */ + if (!AddResource(drawId, __glXDrawableRes, glxPriv)) + { + glxPriv->destroy (glxPriv); + return NULL; + } + } + return glxPriv; } diff --git a/GL/glx/glxvisuals.c b/GL/glx/glxvisuals.c index 9b5839ce9..f83bbb14e 100644 --- a/GL/glx/glxvisuals.c +++ b/GL/glx/glxvisuals.c @@ -432,11 +432,11 @@ void GlxSetVisualConfigs(int nconfigs, static miInitVisualsProcPtr saveInitVisualsProc; -static Bool __glXInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB, - int preferredVis) +Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB, + int preferredVis) { Bool ret; @@ -466,7 +466,7 @@ void GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) { saveInitVisualsProc = *initVisProc; - *initVisProc = __glXInitVisuals; + *initVisProc = GlxInitVisuals; } static void fixup_visuals(int screen) diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c index b185a958a..34b667088 100644 --- a/GL/mesa/X/xf86glx.c +++ b/GL/mesa/X/xf86glx.c @@ -431,3 +431,9 @@ __GLXprovider __glXMesaProvider = { "MESA", NULL }; + +__GLXprovider * +GlxGetMesaProvider (void) +{ + return &__glXMesaProvider; +}