Mesa (master): gallium/xlib: Fix xmesa drawable creation

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 15 18:01:20 UTC 2019


Module: Mesa
Branch: master
Commit: 3f840e5ccdaa14981974bfb475d2d1aa4da47e5e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f840e5ccdaa14981974bfb475d2d1aa4da47e5e

Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Oct 10 14:05:10 2019 -0400

gallium/xlib: Fix xmesa drawable creation

The first time you call glXMakeCurrent, current != ctx. As a result we
would never look up whether the drawable already had an XMesaDrawable,
and would instead always create one. Then XMesaBufferList would have two
different buffers for the same XID, and you'd be reading and drawing to
different places, and that's not what you want at all.

Instead just always look up the drawable.

Fixes: db8be355 (gallium/xlib: Remove drawable caching from the MakeCurrent path)
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1196
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

---

 src/gallium/state_trackers/glx/xlib/glx_api.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 029268b32e6..147f928f3c3 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -1198,9 +1198,7 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
 
       if (draw) {
          /* Find the XMesaBuffer which corresponds to 'draw' */
-         if (ctx == current) {
-            drawBuffer = XMesaFindBuffer( dpy, draw );
-         }
+         drawBuffer = XMesaFindBuffer( dpy, draw );
          if (!drawBuffer) {
             /* drawable must be a new window! */
             drawBuffer = XMesaCreateWindowBuffer( xmctx->xm_visual, draw );
@@ -1213,9 +1211,7 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
 
       if (read) {
          /* Find the XMesaBuffer which corresponds to 'read' */
-         if (ctx == current) {
-            readBuffer = XMesaFindBuffer( dpy, read );
-         }
+         readBuffer = XMesaFindBuffer( dpy, read );
          if (!readBuffer) {
             /* drawable must be a new window! */
             readBuffer = XMesaCreateWindowBuffer( xmctx->xm_visual, read );




More information about the mesa-commit mailing list