Xephyr: Build fix: Port across XF86dri.c changes from Mesa.
This commit is contained in:
parent
a955c3b587
commit
aa231f28d5
@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
|
|||||||
context, hHWContext );
|
context, hHWContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
|
GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
|
||||||
{
|
{
|
||||||
Display * const dpy = (Display *) ndpy;
|
|
||||||
XExtDisplayInfo *info = find_display (dpy);
|
XExtDisplayInfo *info = find_display (dpy);
|
||||||
xXF86DRIDestroyContextReq *req;
|
xXF86DRIDestroyContextReq *req;
|
||||||
|
|
||||||
@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
XF86DRICreateDrawable (Display *dpy, int screen,
|
||||||
__DRIid drawable, drm_drawable_t * hHWDrawable)
|
XID drawable, drm_drawable_t * hHWDrawable)
|
||||||
{
|
{
|
||||||
Display * const dpy = (Display *) ndpy;
|
|
||||||
XExtDisplayInfo *info = find_display (dpy);
|
XExtDisplayInfo *info = find_display (dpy);
|
||||||
xXF86DRICreateDrawableReply rep;
|
xXF86DRICreateDrawableReply rep;
|
||||||
xXF86DRICreateDrawableReq *req;
|
xXF86DRICreateDrawableReq *req;
|
||||||
@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
|
||||||
__DRIid drawable )
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
|
||||||
|
XID drawable )
|
||||||
{
|
{
|
||||||
Display * const dpy = (Display *) ndpy;
|
|
||||||
XExtDisplayInfo *info = find_display (dpy);
|
XExtDisplayInfo *info = find_display (dpy);
|
||||||
xXF86DRIDestroyDrawableReq *req;
|
xXF86DRIDestroyDrawableReq *req;
|
||||||
|
int (*oldXErrorHandler)(Display *, XErrorEvent *);
|
||||||
|
|
||||||
TRACE("DestroyDrawable...");
|
TRACE("DestroyDrawable...");
|
||||||
XF86DRICheckExtension (dpy, info, False);
|
XF86DRICheckExtension (dpy, info, False);
|
||||||
|
|
||||||
|
/* This is called from the DRI driver, which used call it like this
|
||||||
|
*
|
||||||
|
* if (windowExists(drawable))
|
||||||
|
* destroyDrawable(drawable);
|
||||||
|
*
|
||||||
|
* which is a textbook race condition - the window may disappear
|
||||||
|
* from the server between checking for its existance and
|
||||||
|
* destroying it. Instead we change the semantics of
|
||||||
|
* __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
|
||||||
|
* the windows is gone, by wrapping the destroy call in an error
|
||||||
|
* handler. */
|
||||||
|
|
||||||
|
XSync(dpy, GL_FALSE);
|
||||||
|
oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
|
||||||
|
|
||||||
LockDisplay(dpy);
|
LockDisplay(dpy);
|
||||||
GetReq(XF86DRIDestroyDrawable, req);
|
GetReq(XF86DRIDestroyDrawable, req);
|
||||||
req->reqType = info->codes->major_opcode;
|
req->reqType = info->codes->major_opcode;
|
||||||
@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
|||||||
req->drawable = drawable;
|
req->drawable = drawable;
|
||||||
UnlockDisplay(dpy);
|
UnlockDisplay(dpy);
|
||||||
SyncHandle();
|
SyncHandle();
|
||||||
|
|
||||||
|
XSetErrorHandler(oldXErrorHandler);
|
||||||
|
|
||||||
TRACE("DestroyDrawable... return True");
|
TRACE("DestroyDrawable... return True");
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user