devPrivates rework: update new GL/glxext code.

Need to merge so this type of thing stops happening.
This commit is contained in:
Eamon Walsh 2007-10-17 16:09:40 -04:00 committed by Eamon Walsh
parent c3f7b86255
commit 50b27e1ad2
2 changed files with 9 additions and 20 deletions

View File

@ -27,6 +27,7 @@
#include "glxserver.h"
#include <windowstr.h>
#include <propertyst.h>
#include "privates.h"
#include <os.h>
#include "g_disptab.h"
#include "unpack.h"
@ -53,7 +54,7 @@ RESTYPE __glXSwapBarrierRes;
*/
xGLXSingleReply __glXReply;
static int glxClientPrivateIndex;
static DevPrivateKey glxClientPrivateKey = &glxClientPrivateKey;
/*
** Client that called into GLX dispatch.
@ -218,7 +219,7 @@ int __glXError(int error)
__GLXclientState *
glxGetClient(ClientPtr pClient)
{
return (__GLXclientState *) pClient->devPrivates[glxClientPrivateIndex].ptr;
return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey);
}
static void
@ -288,9 +289,7 @@ void GlxExtensionInit(void)
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
__glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
glxClientPrivateIndex = AllocateClientPrivateIndex ();
if (!AllocateClientPrivate (glxClientPrivateIndex,
sizeof (__GLXclientState)))
if (!dixRequestPrivate(glxClientPrivateKey, sizeof (__GLXclientState)))
return;
if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
return;

View File

@ -41,11 +41,12 @@
#include <windowstr.h>
#include <os.h>
#include "privates.h"
#include "glxserver.h"
#include "glxutil.h"
#include "glxext.h"
static int glxScreenPrivateIndex;
static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey;
const char GLServerVersion[] = "1.4";
static const char GLServerExtensions[] =
@ -278,22 +279,11 @@ glxCloseScreen (int index, ScreenPtr pScreen)
__GLXscreen *
glxGetScreen(ScreenPtr pScreen)
{
return (__GLXscreen *) pScreen->devPrivates[glxScreenPrivateIndex].ptr;
return dixLookupPrivate(&pScreen->devPrivates, glxScreenPrivateKey);
}
void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen)
{
static int glxGeneration;
if (glxGeneration != serverGeneration)
{
glxScreenPrivateIndex = AllocateScreenPrivateIndex ();
if (glxScreenPrivateIndex == -1)
return;
glxGeneration = serverGeneration;
}
glxScreen->pScreen = pScreen;
glxScreen->GLextensions = xstrdup(GLServerExtensions);
glxScreen->GLXvendor = xstrdup(GLXServerVendorName);
@ -308,9 +298,9 @@ void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen)
__glXScreenInitVisuals(glxScreen);
pScreen->devPrivates[glxScreenPrivateIndex].ptr = (pointer) glxScreen;
dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, glxScreen);
}
void __glXScreenDestroy(__GLXscreen *screen)
{
xfree(screen->GLXvendor);