mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-23 07:18:09 +02:00
Don't explicitly create and destroy the __DRIdrawable, since the DRI driver
doesn't want us to. Move some __GLXcontext updating code to here.
This commit is contained in:
parent
9d209d4adf
commit
e0cbd33e85
7 changed files with 51 additions and 29 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2006-01-26 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxutil.c (__glXCreateDrawablePrivate)
|
||||
(__glXDestroyDrawablePrivate): Don't explicitly create and destroy
|
||||
the __DRIdrawable, since the DRI driver doesn't want us to.
|
||||
|
||||
* GL/glx/glxutil.c (__glXAssociateContext): Move some __GLXcontext
|
||||
updating code to here.
|
||||
|
||||
2006-01-18 Kristian Høgsberg <krh@redhat.com>
|
||||
|
||||
* GL/glx/glxext.c (ClientGone): Also lift DRI lock when destroying
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ __GLXcontext *__glXLastContext;
|
|||
/*
|
||||
** X resources.
|
||||
*/
|
||||
RESTYPE __glXDrawableRes;
|
||||
RESTYPE __glXContextRes;
|
||||
RESTYPE __glXClientRes;
|
||||
RESTYPE __glXPixmapRes;
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
client->errorValue = gcId;
|
||||
return BadAlloc;
|
||||
}
|
||||
glxc->driContext.mode = modes;
|
||||
} else {
|
||||
/*
|
||||
** Don't need local GL context for a direct context.
|
||||
|
|
@ -629,24 +630,16 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
|
||||
if ((glxc != 0) && !glxc->isDirect) {
|
||||
|
||||
glxc->drawPriv = drawPriv;
|
||||
glxc->readPriv = readPriv;
|
||||
|
||||
/* make the context current */
|
||||
if (!(*glxc->driContext.bindContext)(NULL, pDraw->pScreen->myNum,
|
||||
drawId, readId,
|
||||
&glxc->driContext)) {
|
||||
glxc->drawPriv = NULL;
|
||||
glxc->readPriv = NULL;
|
||||
return __glXBadContext;
|
||||
}
|
||||
|
||||
glxc->isCurrent = GL_TRUE;
|
||||
/* FIXME: Is this assignment ok? Why wasn't it here already? */
|
||||
__glXLastContext = glxc;
|
||||
__glXAssociateContext(glxc);
|
||||
assert(drawPriv->drawGlxc == glxc);
|
||||
assert(readPriv->readGlxc == glxc);
|
||||
__glXAssociateContext(glxc, drawPriv, readPriv);
|
||||
}
|
||||
|
||||
if (prevglxc) {
|
||||
|
|
@ -1335,8 +1328,16 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
}
|
||||
|
||||
CALL_Finish( GET_DISPATCH(), () );
|
||||
(*glxPriv->driDrawable.swapBuffers)(NULL, glxPriv->driDrawable.private);
|
||||
{
|
||||
__DRIscreen *driScreen;
|
||||
__DRIdrawable *driDraw;
|
||||
|
||||
driScreen = &__glXgetActiveScreen(pDraw->pScreen->myNum)->driScreen;
|
||||
driDraw = (driScreen->getDrawable)(NULL, drawId, driScreen->private);
|
||||
|
||||
CALL_Finish( GET_DISPATCH(), () );
|
||||
(*driDraw->swapBuffers)(NULL, driDraw->private);
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ static int ContextGone(__GLXcontext* cx, XID id)
|
|||
* __glXDispatch, so we'll have to lift the DRM lock manually
|
||||
* to avoid deadlocks for cards that grab the lock during
|
||||
* context destruction. */
|
||||
DRIUnlockedCallback(__glXFreeContext, cx, 0);
|
||||
DRIUnlockedCallback((void(*)(void*)) __glXFreeContext, cx, 0);
|
||||
}
|
||||
|
||||
return True;
|
||||
|
|
@ -129,7 +129,7 @@ static int ClientGone(int clientIndex, XID id)
|
|||
__glXDeassociateContext(cx);
|
||||
cx->isCurrent = GL_FALSE;
|
||||
if (!cx->idExists) {
|
||||
DRIUnlockedCallback(__glXFreeContext, cx, 0);
|
||||
DRIUnlockedCallback((void(*)(void*)) __glXFreeContext, cx, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,6 +164,17 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
|
|||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy routine that gets called when a drawable is freed. A drawable
|
||||
** contains the ancillary buffers needed for rendering.
|
||||
*/
|
||||
static Bool DrawableGone(__GLXdrawablePrivate *glxPriv, XID xid)
|
||||
{
|
||||
__glXUnrefDrawablePrivate(glxPriv);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
** Free a context.
|
||||
*/
|
||||
|
|
@ -243,6 +254,7 @@ void GlxExtensionInit(void)
|
|||
ExtensionEntry *extEntry;
|
||||
int i;
|
||||
|
||||
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
|
||||
__glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
|
||||
__glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
|
||||
__glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
|
||||
|
|
|
|||
|
|
@ -153,22 +153,10 @@ __GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs = NULL;
|
|||
static int __glXNumHyperpipeFuncs = 0;
|
||||
|
||||
|
||||
RESTYPE __glXDrawableRes;
|
||||
|
||||
__GLXscreenInfo *__glXgetActiveScreen(int num) {
|
||||
return &__glXActiveScreens[num];
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy routine that gets called when a drawable is freed. A drawable
|
||||
** contains the ancillary buffers needed for rendering.
|
||||
*/
|
||||
static Bool DrawableGone(__GLXdrawablePrivate *glxPriv, XID xid)
|
||||
{
|
||||
__glXUnrefDrawablePrivate(glxPriv);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
* If your DDX driver wants to register support for swap barriers or hyperpipe
|
||||
|
|
@ -230,8 +218,6 @@ void __glXScreenInit(GLint numscreens)
|
|||
__glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion);
|
||||
__glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions);
|
||||
|
||||
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
|
||||
|
||||
__glXLoaderInitScreen(i);
|
||||
}
|
||||
__glXNumActiveScreens = numscreens;
|
||||
|
|
|
|||
|
|
@ -137,8 +137,14 @@ __glXFree(void *addr)
|
|||
** associate a context with a drawable
|
||||
*/
|
||||
void
|
||||
__glXAssociateContext(__GLXcontext *glxc)
|
||||
__glXAssociateContext(__GLXcontext *glxc,
|
||||
__GLXdrawablePrivate *drawPriv,
|
||||
__GLXdrawablePrivate *readPriv)
|
||||
{
|
||||
glxc->drawPriv = drawPriv;
|
||||
glxc->readPriv = readPriv;
|
||||
glxc->isCurrent = GL_TRUE;
|
||||
|
||||
glxc->nextDrawPriv = glxc->drawPriv->drawGlxc;
|
||||
glxc->drawPriv->drawGlxc = glxc;
|
||||
|
||||
|
|
@ -242,12 +248,14 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
|
|||
/* The last argument is 'attrs', which is used with pbuffers which
|
||||
* we currently don't support. */
|
||||
|
||||
#if 0
|
||||
glxPriv->driDrawable.private =
|
||||
(pGlxScreen->driScreen.createNewDrawable)(NULL, modes,
|
||||
drawId,
|
||||
&glxPriv->driDrawable,
|
||||
0,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
return glxPriv;
|
||||
}
|
||||
|
|
@ -258,8 +266,10 @@ __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv)
|
|||
/* remove the drawable from the drawable list */
|
||||
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
|
||||
|
||||
#if 0
|
||||
(*glxPriv->driDrawable.destroyDrawable)(NULL,
|
||||
glxPriv->driDrawable.private);
|
||||
#endif
|
||||
|
||||
/* Free the drawable Private */
|
||||
__glXFree(glxPriv);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,10 @@ extern void *__glXRealloc(void *addr, size_t newSize);
|
|||
extern void __glXFree(void *ptr);
|
||||
|
||||
/* relate contexts with drawables */
|
||||
extern void __glXAssociateContext(__GLXcontext *glxc);
|
||||
void
|
||||
__glXAssociateContext(__GLXcontext *glxc,
|
||||
__GLXdrawablePrivate *drawPriv,
|
||||
__GLXdrawablePrivate *readPriv);
|
||||
extern void __glXDeassociateContext(__GLXcontext *glxc);
|
||||
|
||||
/* drawable operation */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue