mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-13 00:20:23 +01:00
Fix recent merge problems and add enter/leave wrapper
from Jose's code.
This commit is contained in:
parent
69f5760aec
commit
b45d236590
12 changed files with 58 additions and 34 deletions
|
|
@ -130,12 +130,10 @@ glucoseCreateWindow(WindowPtr pWin)
|
|||
{
|
||||
glitz_drawable_t *drawable;
|
||||
glitz_drawable_format_t *format;
|
||||
__GLcontextModes *modes = pScreenPriv->screen->modes;
|
||||
__GLcontextModes *fbconfigs = pScreenPriv->screen->fbconfigs;
|
||||
PixmapPtr pPixmap = pScreen->GetScreenPixmap(pScreen);
|
||||
xglScreenPtr xglScreenPriv = XGL_GET_SCREEN_PRIV (pScreen);
|
||||
|
||||
__pGlxClient = serverClient;
|
||||
|
||||
/* track root pixmap */
|
||||
if (pPixmap)
|
||||
{
|
||||
|
|
@ -144,17 +142,21 @@ glucoseCreateWindow(WindowPtr pWin)
|
|||
AddResource(pPixmap->drawable.id, RT_PIXMAP, (pointer)pPixmap);
|
||||
}
|
||||
|
||||
pScreenPriv->rootDrawable = pScreenPriv->screen->createDrawable(pScreenPriv->screen, (DrawablePtr)pPixmap, GLX_DRAWABLE_PIXMAP, pPixmap->drawable.id, modes);
|
||||
xglLeaveServer();
|
||||
|
||||
pScreenPriv->rootDrawable = pScreenPriv->screen->createDrawable(pScreenPriv->screen, (DrawablePtr)pPixmap, GLX_DRAWABLE_PIXMAP, pPixmap->drawable.id, fbconfigs);
|
||||
|
||||
if (!pScreenPriv->rootDrawable) {
|
||||
xglEnterServer();
|
||||
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
||||
"GLucose - creating root drawable failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pScreenPriv->rootContext = pScreenPriv->screen->createContext(pScreenPriv->screen, modes, NULL);
|
||||
pScreenPriv->rootContext = pScreenPriv->screen->createContext(pScreenPriv->screen, fbconfigs, NULL);
|
||||
|
||||
if (!pScreenPriv->rootContext) {
|
||||
xglEnterServer();
|
||||
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
||||
"GLucose - creating root context failed\n");
|
||||
pScreenPriv->rootDrawable->destroy(pScreenPriv->rootDrawable);
|
||||
|
|
@ -165,10 +167,9 @@ glucoseCreateWindow(WindowPtr pWin)
|
|||
pScreenPriv->rootContext->drawPriv =
|
||||
pScreenPriv->rootContext->readPriv = pScreenPriv->rootDrawable;
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
err = pScreenPriv->rootContext->makeCurrent(pScreenPriv->rootContext);
|
||||
if (!err) {
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
||||
"GLucose makeCurrent failed, err is %d\n",err);
|
||||
pScreenPriv->rootContext->destroy(pScreenPriv->rootContext);
|
||||
|
|
@ -186,7 +187,7 @@ glucoseCreateWindow(WindowPtr pWin)
|
|||
pScreen->height);
|
||||
|
||||
if (!drawable) {
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
xf86DrvMsg(pScreen->myNum, X_ERROR,
|
||||
"GLucose could not create glitz drawable, not initializing.\n");
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ glucoseCreateWindow(WindowPtr pWin)
|
|||
"GLucose reports GLitz features as 0x%lx\n",xglScreenPriv->features);
|
||||
|
||||
if (!glucoseFinishScreenInit(pScreen)) {
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
xf86DrvMsg(pScreen->myNum, X_ERROR,
|
||||
"GLucose could not initialize.\n");
|
||||
pScreenPriv->rootContext->destroy(pScreenPriv->rootContext);
|
||||
|
|
@ -215,7 +216,7 @@ glucoseCreateWindow(WindowPtr pWin)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
/* now fixup root pixmap */
|
||||
pPixmap = pScreen->GetScreenPixmap(pScreen);
|
||||
|
|
@ -733,6 +734,8 @@ glucoseCloseScreen (int index,
|
|||
|
||||
xglFiniPixmap (pScreenPriv->pScreenPixmap);
|
||||
|
||||
xglLeaveServer();
|
||||
|
||||
#ifdef RENDER
|
||||
int i;
|
||||
|
||||
|
|
@ -781,3 +784,19 @@ glucoseCloseScreen (int index,
|
|||
|
||||
return (*pScreen->CloseScreen) (index, pScreen);
|
||||
}
|
||||
|
||||
static ClientPtr pOldGlxClient = NULL;
|
||||
|
||||
void xglLeaveServer(void) {
|
||||
assert(pOldGlxClient == NULL);
|
||||
__glXleaveServer(TRUE);
|
||||
pOldGlxClient = __pGlxClient;
|
||||
__pGlxClient = serverClient;
|
||||
}
|
||||
|
||||
void xglEnterServer(void) {
|
||||
assert(__pGlxClient == serverClient);
|
||||
__pGlxClient = pOldGlxClient;
|
||||
pOldGlxClient = NULL;
|
||||
__glXenterServer(TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ _glitz_glucose_context_create (glitz_glucose_screen_info_t *screen_info,
|
|||
__GLXscreen *screen = screen_info->display_info->display;
|
||||
__GLcontextModes *mode;
|
||||
|
||||
mode = _gl_context_modes_find_visual(screen->modes, visualid);
|
||||
mode = _gl_context_modes_find_visual(screen->fbconfigs, visualid);
|
||||
|
||||
context->context = screen->createContext (screen, mode, share_list);
|
||||
context->id = visualid;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ _glitz_glucose_query_formats (glitz_glucose_screen_info_t *screen_info)
|
|||
format.d.id = 0;
|
||||
format.d.color.fourcc = GLITZ_FOURCC_RGB;
|
||||
|
||||
mode = screen->modes;
|
||||
mode = screen->fbconfigs;
|
||||
|
||||
for (i = 0; i < screen->numVisuals; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -204,12 +204,12 @@ xglUnloadGLXModules (void)
|
|||
}
|
||||
|
||||
void
|
||||
__glXenterServer(GLboolean rendering)
|
||||
xglEnterServer(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
__glXleaveServer(GLboolean rendering)
|
||||
xglLeaveServer(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1506,4 +1506,9 @@ unsigned int
|
|||
xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
|
||||
unsigned int numKeys);
|
||||
|
||||
|
||||
void xglLeaveServer(void);
|
||||
|
||||
void xglEnterServer(void);
|
||||
|
||||
#endif /* _XGL_H_ */
|
||||
|
|
|
|||
|
|
@ -262,14 +262,14 @@ xglCompositeGeneral (CARD8 op,
|
|||
else
|
||||
GEOMETRY_DISABLE (dst);
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_composite (XGL_OPERATOR (op),
|
||||
src, mask, dst,
|
||||
xSrc, ySrc,
|
||||
xMask, yMask,
|
||||
xDst + dstXoff, yDst + dstYoff,
|
||||
width, height);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ xglCopy (DrawablePtr pSrc,
|
|||
dstXoff, dstYoff,
|
||||
(glitz_box_t *) pBox, nBox);
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_copy_area (src,
|
||||
dst,
|
||||
srcXoff + dx,
|
||||
|
|
@ -73,7 +73,7 @@ xglCopy (DrawablePtr pSrc,
|
|||
pPixmap->drawable.height - dstYoff,
|
||||
dstXoff,
|
||||
dstYoff);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ xglGetImage (DrawablePtr pDrawable,
|
|||
if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
|
||||
FatalError (XGL_SW_FAILURE_STRING);
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_surface_flush (pScreenPriv->surface);
|
||||
glitz_drawable_finish (pScreenPriv->drawable);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
}
|
||||
|
||||
XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
|
||||
|
|
|
|||
|
|
@ -300,9 +300,9 @@ xglFiniPixmap (PixmapPtr pPixmap)
|
|||
|
||||
if (pPixmapPriv->surface) {
|
||||
/* leaving because texture destruction can occur and flush primitives */
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_surface_destroy (pPixmapPriv->surface);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -568,14 +568,14 @@ xglCreatePixmapSurface (PixmapPtr pPixmap)
|
|||
if (!pPixmapPriv->pVisual || !pPixmapPriv->pVisual->format.surface)
|
||||
return FALSE;
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
pPixmapPriv->surface =
|
||||
glitz_surface_create (pScreenPriv->drawable,
|
||||
pPixmapPriv->pVisual->format.surface,
|
||||
pPixmap->drawable.width,
|
||||
pPixmap->drawable.height,
|
||||
0, NULL);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
if (!pPixmapPriv->surface)
|
||||
{
|
||||
pPixmapPriv->pVisual = NULL;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ xglSolid (DrawablePtr pDrawable,
|
|||
if (!GEOMETRY_ENABLE (pGeometry, surface))
|
||||
return FALSE;
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_composite (op,
|
||||
solid, NULL, surface,
|
||||
0, 0,
|
||||
|
|
@ -75,7 +75,7 @@ xglSolid (DrawablePtr pDrawable,
|
|||
x + xOff,
|
||||
y + yOff,
|
||||
width, height);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ xglSyncBits (DrawablePtr pDrawable,
|
|||
glitz_surface_set_clip_region (pPixmapPriv->surface,
|
||||
0, 0, (glitz_box_t *) pBox, nBox);
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_get_pixels (pPixmapPriv->surface,
|
||||
pExt->x1,
|
||||
pExt->y1,
|
||||
|
|
@ -162,7 +162,7 @@ xglSyncBits (DrawablePtr pDrawable,
|
|||
pExt->y2 - pExt->y1,
|
||||
&format,
|
||||
pPixmapPriv->buffer);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ xglSyncSurface (DrawablePtr pDrawable)
|
|||
glitz_surface_set_clip_region (pPixmapPriv->surface,
|
||||
0, 0, (glitz_box_t *) pBox, nBox);
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_set_pixels (pPixmapPriv->surface,
|
||||
pExt->x1,
|
||||
pExt->y1,
|
||||
|
|
@ -285,7 +285,7 @@ xglSyncSurface (DrawablePtr pDrawable)
|
|||
pExt->y2 - pExt->y1,
|
||||
&format,
|
||||
pPixmapPriv->buffer);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ xglTile (DrawablePtr pDrawable,
|
|||
pTilePriv->pictureMask |= xglPCFillMask;
|
||||
glitz_surface_set_fill (pTilePriv->surface, GLITZ_FILL_REPEAT);
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_composite (op,
|
||||
pTilePriv->surface, NULL, surface,
|
||||
x + tileX,
|
||||
|
|
@ -231,7 +231,7 @@ xglTile (DrawablePtr pDrawable,
|
|||
x + xOff,
|
||||
y + yOff,
|
||||
width, height);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ xglTile (DrawablePtr pDrawable,
|
|||
if (!GEOMETRY_ENABLE (pGeometry, surface))
|
||||
return FALSE;
|
||||
|
||||
__glXleaveServer(FALSE);
|
||||
xglLeaveServer();
|
||||
glitz_composite (op,
|
||||
pTilePriv->surface, NULL, surface,
|
||||
0, 0,
|
||||
|
|
@ -264,7 +264,7 @@ xglTile (DrawablePtr pDrawable,
|
|||
x + xOff,
|
||||
y + yOff,
|
||||
width, height);
|
||||
__glXenterServer(FALSE);
|
||||
xglEnterServer();
|
||||
|
||||
if (glitz_surface_get_status (surface))
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue