Mesa/Mesa-22.2.4-revert-glx-fix-drawable-refounting-for-naked-windows.patch

82 lines
3.5 KiB
Diff

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index eb49ac5ea1bcf557d912b7fc9ce373b25e121ccb..1ce47832c627f9266f7fdf529a00ac6eb49ea88f 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -121,7 +121,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
pread = (struct dri2_drawable *) driFetchDrawable(context, read);
- driReleaseDrawables(old);
+ driReleaseDrawables(context);
if (pdraw)
dri_draw = pdraw->driDrawable;
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index abec1ce6baf368193757a4be71b385bfc16e0351..e8996dd5e2775268101e2b44fbc9175e51190295 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -192,7 +192,7 @@ dri3_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct dri3_drawable *) driFetchDrawable(context, draw);
pread = (struct dri3_drawable *) driFetchDrawable(context, read);
- driReleaseDrawables(old);
+ driReleaseDrawables(context);
if (pdraw)
dri_draw = pdraw->loader_drawable.dri_drawable;
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index d806d8cab41bd5e2431a66262798156ecc037f82..94e264cc07feb295741646ba6a83467819718379 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -416,14 +416,7 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
(*pdraw->destroyDrawable) (pdraw);
return NULL;
}
- /* This sure does look suspicious, doesn't it? We're on this path because
- * this is a naked Window. GLX 1.3 drawables have an explicit creation
- * step (setting refcount to 1), and those we would have found in the
- * hash lookup above, bumped their refcount for the bind_context we're
- * being called for, and then returned. But since we just created the
- * internal naked-Window state, we need to account for both here.
- */
- pdraw->refcount = 2;
+ pdraw->refcount = 1;
return pdraw;
}
@@ -497,7 +490,7 @@ releaseDrawable(const struct glx_display *priv, GLXDrawable drawable)
_X_HIDDEN void
driReleaseDrawables(struct glx_context *gc)
{
- const struct glx_display *priv = (gc && gc->psc) ? gc->psc->display : NULL;
+ const struct glx_display *priv = gc->psc->display;
if (priv == NULL)
return;
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index a459ec863e7fe2397a86f933d79296c9466d5cc0..e90f4efbab4081f346073e2b66ece5850ab43214 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -440,7 +440,7 @@ drisw_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct drisw_drawable *) driFetchDrawable(context, draw);
pread = (struct drisw_drawable *) driFetchDrawable(context, read);
- driReleaseDrawables(old);
+ driReleaseDrawables(context);
if (!psc->core->bindContext(context->driContext,
pdraw ? pdraw->driDrawable : NULL,
diff --git a/src/glx/driwindows_glx.c b/src/glx/driwindows_glx.c
index 8c21c5ee58a8dc0bb97973e5fb2f10d82beef792..3eb961dae3d27a3ffd3f743be1ef27dd762f54cc 100644
--- a/src/glx/driwindows_glx.c
+++ b/src/glx/driwindows_glx.c
@@ -88,7 +88,7 @@ driwindows_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct driwindows_drawable *) driFetchDrawable(context, draw);
pread = (struct driwindows_drawable *) driFetchDrawable(context, read);
- driReleaseDrawables(old);
+ driReleaseDrawables(&pcp->base);
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;