mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 18:00:10 +01:00
glx: Harmonize glXCreateGLXPixmap with glXCreatePixmap
This was open-coding some things, and not perfectly. Likewise for the destroy path. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20549>
This commit is contained in:
parent
2cc3763d04
commit
7d8b90a470
1 changed files with 7 additions and 59 deletions
|
|
@ -974,39 +974,16 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
|||
/* FIXME: Maybe delay __DRIdrawable creation until the drawable
|
||||
* is actually bound to a context... */
|
||||
|
||||
__GLXDRIdrawable *pdraw;
|
||||
struct glx_screen *psc;
|
||||
struct glx_config *config;
|
||||
struct glx_screen *psc = GetGLXScreenConfigs(dpy, vis->screen);
|
||||
struct glx_config *config = glx_config_find_visual(psc->visuals,
|
||||
vis->visualid);
|
||||
|
||||
psc = priv->screens[vis->screen];
|
||||
if (psc->driScreen == NULL)
|
||||
return xid;
|
||||
|
||||
config = glx_config_find_visual(psc->visuals, vis->visualid);
|
||||
pdraw = psc->driScreen->createDrawable(psc, pixmap, xid, GLX_PIXMAP_BIT, config);
|
||||
if (pdraw == NULL) {
|
||||
fprintf(stderr, "failed to create pixmap\n");
|
||||
if (!CreateDRIDrawable(dpy, config, pixmap, xid, GLX_PIXMAP_BIT,
|
||||
NULL, 0)) {
|
||||
protocolDestroyDrawable(dpy, xid, X_GLXDestroyGLXPixmap);
|
||||
xid = None;
|
||||
break;
|
||||
}
|
||||
|
||||
if (__glxHashInsert(priv->drawHash, xid, pdraw)) {
|
||||
pdraw->destroyDrawable(pdraw);
|
||||
xid = None;
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
if (xid == None) {
|
||||
xGLXDestroyGLXPixmapReq *dreq;
|
||||
LockDisplay(dpy);
|
||||
GetReq(GLXDestroyGLXPixmap, dreq);
|
||||
dreq->reqType = opcode;
|
||||
dreq->glxCode = X_GLXDestroyGLXPixmap;
|
||||
dreq->glxpixmap = xid;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
#endif
|
||||
|
||||
return xid;
|
||||
|
|
@ -1023,36 +1000,7 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
|
|||
if(apple_glx_pixmap_destroy(dpy, glxpixmap))
|
||||
__glXSendError(dpy, GLXBadPixmap, glxpixmap, X_GLXDestroyPixmap, false);
|
||||
#else
|
||||
xGLXDestroyGLXPixmapReq *req;
|
||||
CARD8 opcode;
|
||||
|
||||
opcode = __glXSetupForCommand(dpy);
|
||||
if (!opcode) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send the glXDestroyGLXPixmap request */
|
||||
LockDisplay(dpy);
|
||||
GetReq(GLXDestroyGLXPixmap, req);
|
||||
req->reqType = opcode;
|
||||
req->glxCode = X_GLXDestroyGLXPixmap;
|
||||
req->glxpixmap = glxpixmap;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
DestroyGLXDrawable(dpy, glxpixmap);
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
{
|
||||
struct glx_display *const priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);
|
||||
|
||||
if (priv != NULL && pdraw != NULL) {
|
||||
pdraw->destroyDrawable(pdraw);
|
||||
__glxHashDelete(priv->drawHash, glxpixmap);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
DestroyDrawable(dpy, glxpixmap, X_GLXDestroyGLXPixmap);
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue