diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2014-02-05 11:43:58 -0800 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2014-02-06 14:23:42 -0800 |
commit | f658150639c36eda351590e757247c56507f494f (patch) | |
tree | c4c4d95321401b55d99c320197b984f05c8b015f /src/glx | |
parent | db54fca9b86aa124447d11d2bdbe359a2742cfd5 (diff) | |
download | external_mesa3d-f658150639c36eda351590e757247c56507f494f.zip external_mesa3d-f658150639c36eda351590e757247c56507f494f.tar.gz external_mesa3d-f658150639c36eda351590e757247c56507f494f.tar.bz2 |
glx: Pass NULL DRI drawables into the DRI driver for None GLX drawables
GLX_ARB_create_context allows making a GLX context current with None
drawable and readables, but this was never implemented correctly in GLX.
We would create a __DRIdrawable for the None GLX drawable and pass that
to the DRI driver and that would somehow work. Now it's somehow broken.
The way this should have worked is that we pass a NULL DRI drawable
to the DRI driver when the GLX user calls glXMakeContextCurrent()
with None for drawable and readables.
https://bugs.freedesktop.org/show_bug.cgi?id=74143
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/dri2_glx.c | 17 | ||||
-rw-r--r-- | src/glx/dri_common.c | 3 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 0a0dac9..67fe9c1 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -141,6 +141,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old, struct dri2_context *pcp = (struct dri2_context *) context; struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc; struct dri2_drawable *pdraw, *pread; + __DRIdrawable *dri_draw = NULL, *dri_read = NULL; struct dri2_display *pdp; pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw); @@ -148,20 +149,26 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old, driReleaseDrawables(&pcp->base); - if (pdraw == NULL || pread == NULL) + if (pdraw) + dri_draw = pdraw->driDrawable; + else if (draw != None) return GLXBadDrawable; - if (!(*psc->core->bindContext) (pcp->driContext, - pdraw->driDrawable, pread->driDrawable)) + if (pread) + dri_read = pread->driDrawable; + else if (read != None) + return GLXBadDrawable; + + if (!(*psc->core->bindContext) (pcp->driContext, dri_draw, dri_read)) return GLXBadContext; /* If the server doesn't send invalidate events, we may miss a * resize before the rendering starts. Invalidate the buffers now * so the driver will recheck before rendering starts. */ pdp = (struct dri2_display *) psc->base.display; - if (!pdp->invalidateAvailable) { + if (!pdp->invalidateAvailable && pdraw) { dri2InvalidateBuffers(psc->base.dpy, pdraw->base.xDrawable); - if (pread != pdraw) + if (pread != pdraw && pread) dri2InvalidateBuffers(psc->base.dpy, pread->base.xDrawable); } diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 0dd8982..012c8f4 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -392,6 +392,9 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) if (priv == NULL) return NULL; + if (glxDrawable == None) + return NULL; + psc = priv->screens[gc->screen]; if (priv->drawHash == NULL) return NULL; |