Mesa (master): glthread: sync in glFlush for multiple contexts

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 9 05:31:03 UTC 2020


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Jun  8 08:46:10 2020 -0400

glthread: sync in glFlush for multiple contexts

See the code comment.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5382>

---

 src/mapi/glapi/gen/gl_API.xml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index b3511665280..0e164b495d9 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -2390,8 +2390,14 @@
         <glx sop="108" handcode="true"/>
     </function>
 
+    <!-- Shared contexts have to wait for glthread to finish execution after glFlush,
+         so that other contexts can see the effect of previous GL calls when glFlush returns.
+         This is harmless if the contexts run on different threads, because we only stall
+         1 thread that's asynchronous anyway. It's worse when the contexts run on the same
+         thread, but that's not a good use of multiple contexts.
+    -->
     <function name="Flush" es1="1.0" es2="2.0"
-              marshal_call_after="_mesa_glthread_flush_batch(ctx);">
+              marshal_call_after="_mesa_glthread_flush_batch(ctx); if (ctx->Shared->RefCount > 1) _mesa_glthread_finish(ctx);">
         <glx sop="142" handcode="true"/>
     </function>
 



More information about the mesa-commit mailing list