diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index e3eb25262e2..d51b63b9cd7 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -309,7 +309,8 @@ dri2DestroyDrawable(__GLXDRIdrawable *base) static __GLXDRIdrawable * dri2CreateDrawable(struct glx_screen *base, XID xDrawable, - GLXDrawable drawable, struct glx_config *config_base) + GLXDrawable drawable, int type, + struct glx_config *config_base) { struct dri2_drawable *pdraw; struct dri2_screen *psc = (struct dri2_screen *) base; diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 290dc9b65da..1c8a3b2a2e3 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -344,7 +344,8 @@ dri3_destroy_drawable(__GLXDRIdrawable *base) static __GLXDRIdrawable * dri3_create_drawable(struct glx_screen *base, XID xDrawable, - GLXDrawable drawable, struct glx_config *config_base) + GLXDrawable drawable, int type, + struct glx_config *config_base) { struct dri3_drawable *pdraw; struct dri3_screen *psc = (struct dri3_screen *) base; diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 0208aa38ea7..0be684dda95 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -405,7 +405,7 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) } pdraw = psc->driScreen->createDrawable(psc, glxDrawable, glxDrawable, - config); + type, config); if (pdraw == NULL) { ErrorMessageF("failed to create drawable\n"); diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index b1e9a1f4760..ff481a990e4 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -605,7 +605,8 @@ driswDestroyDrawable(__GLXDRIdrawable * pdraw) static __GLXDRIdrawable * driswCreateDrawable(struct glx_screen *base, XID xDrawable, - GLXDrawable drawable, struct glx_config *modes) + GLXDrawable drawable, int type, + struct glx_config *modes) { struct drisw_drawable *pdp; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; diff --git a/src/glx/driwindows_glx.c b/src/glx/driwindows_glx.c index 496de0c7342..3eb961dae3d 100644 --- a/src/glx/driwindows_glx.c +++ b/src/glx/driwindows_glx.c @@ -258,7 +258,8 @@ driwindowsDestroyDrawable(__GLXDRIdrawable * pdraw) static __GLXDRIdrawable * driwindowsCreateDrawable(struct glx_screen *base, XID xDrawable, - GLXDrawable drawable, struct glx_config *modes) + GLXDrawable drawable, int type, + struct glx_config *modes) { struct driwindows_drawable *pdp; struct driwindows_screen *psc = (struct driwindows_screen *) base; diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 29f11ae2004..7500651529e 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -168,7 +168,7 @@ determineTextureFormat(const int *attribs, int numAttribs) static GLboolean CreateDRIDrawable(Display *dpy, struct glx_config *config, - XID drawable, XID glxdrawable, + XID drawable, XID glxdrawable, int type, const int *attrib_list, size_t num_attribs) { #ifdef GLX_DIRECT_RENDERING @@ -185,8 +185,8 @@ CreateDRIDrawable(Display *dpy, struct glx_config *config, if (psc->driScreen == NULL) return GL_TRUE; - pdraw = psc->driScreen->createDrawable(psc, drawable, - glxdrawable, config); + pdraw = psc->driScreen->createDrawable(psc, drawable, glxdrawable, + type, config); if (pdraw == NULL) { fprintf(stderr, "failed to create drawable\n"); return GL_FALSE; @@ -435,7 +435,7 @@ protocolDestroyDrawable(Display *dpy, GLXDrawable drawable, CARD32 glxCode) */ static GLXDrawable CreateDrawable(Display *dpy, struct glx_config *config, - Drawable drawable, const int *attrib_list, CARD8 glxCode) + Drawable drawable, int type, const int *attrib_list) { xGLXCreateWindowReq *req; struct glx_drawable *glxDraw; @@ -466,13 +466,17 @@ CreateDrawable(Display *dpy, struct glx_config *config, data = (CARD32 *) (req + 1); req->reqType = opcode; - req->glxCode = glxCode; req->screen = config->screen; req->fbconfig = config->fbconfigID; req->window = drawable; req->glxwindow = xid = XAllocID(dpy); req->numAttribs = i; + if (type == GLX_WINDOW_BIT) + req->glxCode = X_GLXCreateWindow; + else + req->glxCode = X_GLXCreatePixmap; + if (attrib_list) memcpy(data, attrib_list, 8 * i); @@ -484,8 +488,9 @@ CreateDrawable(Display *dpy, struct glx_config *config, return None; } - if (!CreateDRIDrawable(dpy, config, drawable, xid, attrib_list, i)) { - if (glxCode == X_GLXCreatePixmap) + if (!CreateDRIDrawable(dpy, config, drawable, xid, type, attrib_list, i)) { + CARD8 glxCode; + if (type == GLX_PIXMAP_BIT) glxCode = X_GLXDestroyPixmap; else glxCode = X_GLXDestroyWindow; @@ -602,7 +607,7 @@ CreatePbuffer(Display * dpy, struct glx_config *config, SyncHandle(); /* xserver created a pixmap with the same id as pbuffer */ - if (!CreateDRIDrawable(dpy, config, id, id, attrib_list, i)) { + if (!CreateDRIDrawable(dpy, config, id, id, GLX_PBUFFER_BIT, attrib_list, i)) { CARD32 o = glx_1_3 ? X_GLXDestroyPbuffer : X_GLXvop_DestroyGLXPbufferSGIX; protocolDestroyDrawable(dpy, id, o); id = None; @@ -916,7 +921,7 @@ glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, return pixmap; #else return CreateDrawable(dpy, (struct glx_config *) config, - (Drawable) pixmap, attrib_list, X_GLXCreatePixmap); + (Drawable) pixmap, GLX_PIXMAP_BIT, attrib_list); #endif } @@ -950,7 +955,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, return win; #else return CreateDrawable(dpy, (struct glx_config *) config, - (Drawable) win, attrib_list, X_GLXCreateWindow); + (Drawable) win, GLX_WINDOW_BIT, attrib_list); #endif } diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 0bd486b8631..4ea091f986b 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -117,6 +117,7 @@ struct __GLXDRIscreenRec { __GLXDRIdrawable *(*createDrawable)(struct glx_screen *psc, XID drawable, GLXDrawable glxDrawable, + int type, struct glx_config *config); int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc, diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 901de99f942..83d46755f18 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -762,7 +762,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) return xid; config = glx_config_find_visual(psc->visuals, vis->visualid); - pdraw = psc->driScreen->createDrawable(psc, pixmap, xid, config); + pdraw = psc->driScreen->createDrawable(psc, pixmap, xid, GLX_PIXMAP_BIT, config); if (pdraw == NULL) { fprintf(stderr, "failed to create pixmap\n"); xid = None;