Mesa (master): st/mesa: purge framebuffers with current context after unbinding winsys buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 20 20:10:44 UTC 2019


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

Author: Charmaine Lee <charmainel at vmware.com>
Date:   Sat May 18 18:32:13 2019 -0700

st/mesa: purge framebuffers with current context after unbinding winsys buffers

With commit c89e8470e58, framebuffers are purged after unbinding context,
but this change also introduces a heap corruption when running Rhino application
on VMware svga device. Instead of purging the framebuffers after the context
is unbound, this patch first ubinds the winsys buffers, then purges the framebuffers
with the current context, and then finally unbinds the context.

This fixes heap corruption.

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/state_tracker/st_manager.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index bee1f6b1366..35d41f0a2c1 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -1105,10 +1105,17 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
    else {
       GET_CURRENT_CONTEXT(ctx);
 
-      ret = _mesa_make_current(NULL, NULL, NULL);
-
-      if (ctx)
+      if (ctx) {
+         /* Before releasing the context, release its associated
+          * winsys buffers first. Then purge the context's winsys buffers list
+          * to free the resources of any winsys buffers that no longer have
+          * an existing drawable.
+          */
+         ret = _mesa_make_current(ctx, NULL, NULL);
          st_framebuffers_purge(ctx->st);
+      }
+
+      ret = _mesa_make_current(NULL, NULL, NULL);
    }
 
    return ret;




More information about the mesa-commit mailing list