glx: no need to create extra pixmap for pbuffer
XServer already created a pixmap with same id as pbuffer, so that other client can use the pbuffer id to do glXMakeCurrent(). But with a hidden pixmap, we can't do this. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13750>
This commit is contained in:
parent
51f71e0483
commit
bc8a51a79a
|
@ -205,19 +205,15 @@ CreateDRIDrawable(Display *dpy, struct glx_config *config,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
|
DestroyDRIDrawable(Display *dpy, GLXDrawable drawable)
|
||||||
{
|
{
|
||||||
#ifdef GLX_DIRECT_RENDERING
|
#ifdef GLX_DIRECT_RENDERING
|
||||||
struct glx_display *const priv = __glXInitialize(dpy);
|
struct glx_display *const priv = __glXInitialize(dpy);
|
||||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||||
XID xid;
|
|
||||||
|
|
||||||
if (priv != NULL && pdraw != NULL) {
|
if (priv != NULL && pdraw != NULL) {
|
||||||
xid = pdraw->xDrawable;
|
|
||||||
(*pdraw->destroyDrawable) (pdraw);
|
(*pdraw->destroyDrawable) (pdraw);
|
||||||
__glxHashDelete(priv->drawHash, drawable);
|
__glxHashDelete(priv->drawHash, drawable);
|
||||||
if (destroy_xdrawable)
|
|
||||||
XFreePixmap(priv->dpy, xid);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -514,7 +510,7 @@ DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode)
|
||||||
protocolDestroyDrawable(dpy, drawable, glxCode);
|
protocolDestroyDrawable(dpy, drawable, glxCode);
|
||||||
|
|
||||||
DestroyGLXDrawable(dpy, drawable);
|
DestroyGLXDrawable(dpy, drawable);
|
||||||
DestroyDRIDrawable(dpy, drawable, GL_FALSE);
|
DestroyDRIDrawable(dpy, drawable);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -540,9 +536,7 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
|
||||||
CARD32 *data;
|
CARD32 *data;
|
||||||
CARD8 opcode;
|
CARD8 opcode;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Pixmap pixmap;
|
|
||||||
GLboolean glx_1_3 = GL_FALSE;
|
GLboolean glx_1_3 = GL_FALSE;
|
||||||
int depth = config->rgbBits;
|
|
||||||
|
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
return None;
|
return None;
|
||||||
|
@ -607,15 +601,9 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
|
||||||
UnlockDisplay(dpy);
|
UnlockDisplay(dpy);
|
||||||
SyncHandle();
|
SyncHandle();
|
||||||
|
|
||||||
if (depth == 30)
|
/* xserver created a pixmap with the same id as pbuffer */
|
||||||
depth = 32;
|
if (!CreateDRIDrawable(dpy, config, id, id, attrib_list, i)) {
|
||||||
|
|
||||||
pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen),
|
|
||||||
width, height, depth);
|
|
||||||
|
|
||||||
if (!CreateDRIDrawable(dpy, config, pixmap, id, attrib_list, i)) {
|
|
||||||
CARD32 o = glx_1_3 ? X_GLXDestroyPbuffer : X_GLXvop_DestroyGLXPbufferSGIX;
|
CARD32 o = glx_1_3 ? X_GLXDestroyPbuffer : X_GLXvop_DestroyGLXPbufferSGIX;
|
||||||
XFreePixmap(dpy, pixmap);
|
|
||||||
protocolDestroyDrawable(dpy, id, o);
|
protocolDestroyDrawable(dpy, id, o);
|
||||||
id = None;
|
id = None;
|
||||||
}
|
}
|
||||||
|
@ -674,7 +662,7 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable)
|
||||||
UnlockDisplay(dpy);
|
UnlockDisplay(dpy);
|
||||||
SyncHandle();
|
SyncHandle();
|
||||||
|
|
||||||
DestroyDRIDrawable(dpy, drawable, GL_TRUE);
|
DestroyDRIDrawable(dpy, drawable);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue