[arch-commits] Commit in lib32-primus/trunk (PKGBUILD register_cleanup.patch)

Sven-Hendrik Haase svenstaro at archlinux.org
Fri Jan 22 04:36:32 UTC 2016


    Date: Friday, January 22, 2016 @ 05:36:32
  Author: svenstaro
Revision: 158488

upgpkg: lib32-primus 20151110-2

Fix FS#47851

Added:
  lib32-primus/trunk/register_cleanup.patch
Modified:
  lib32-primus/trunk/PKGBUILD

------------------------+
 PKGBUILD               |   12 ++++++++++--
 register_cleanup.patch |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2016-01-22 04:33:46 UTC (rev 158487)
+++ PKGBUILD	2016-01-22 04:36:32 UTC (rev 158488)
@@ -10,9 +10,17 @@
 license=('custom:ISC')
 depends=('bumblebee' 'lib32-mesa-libgl')
 makedepends=('git' 'gcc-multilib')
-source=("git://github.com/amonakov/primus.git#commit=d1afbf6")
-sha1sums=('SKIP')
+source=("git://github.com/amonakov/primus.git#commit=d1afbf6"
+        "register_cleanup.patch")
+sha1sums=('SKIP'
+          'fd48f89c55c1ad854d7a985781faed2c52c0135f')
 
+prepare() {
+  cd primus
+
+  patch -Np1 < "$srcdir/register_cleanup.patch"
+}
+
 build() {
   cd primus
 

Added: register_cleanup.patch
===================================================================
--- register_cleanup.patch	                        (rev 0)
+++ register_cleanup.patch	2016-01-22 04:36:32 UTC (rev 158488)
@@ -0,0 +1,47 @@
+diff --git a/libglfork.cpp b/libglfork.cpp
+index 03f514f..bb42f0d 100644
+--- a/libglfork.cpp
++++ b/libglfork.cpp
+@@ -259,6 +259,22 @@ static struct PrimusInfo {
+   }
+ } primus;
+
++static void cleanup()
++{
++  primus.drawables.clear();
++}
++
++static void register_cleanup_1()
++{
++  atexit(cleanup);
++}
++
++static void register_cleanup()
++{
++  static pthread_once_t once = PTHREAD_ONCE_INIT;
++  pthread_once(&once, register_cleanup_1);
++}
++
+ // Thread-specific data
+ static __thread struct {
+   Display *dpy;
+@@ -622,11 +638,6 @@ GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXConte
+ void glXDestroyContext(Display *dpy, GLXContext ctx)
+ {
+   primus.contexts.erase(ctx);
+-  // kludge: reap background tasks when deleting the last context
+-  // otherwise something will deadlock during unloading the library
+-  if (primus.contexts.empty())
+-    for (DrawablesInfo::iterator i = primus.drawables.begin(); i != primus.drawables.end(); i++)
+-      i->second.reap_workers();
+   primus.afns.glXDestroyContext(primus.adpy, ctx);
+ }
+
+@@ -720,6 +731,7 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
+     di.actx = ctx;
+     di.d.spawn_worker(drawable, display_work);
+     di.r.spawn_worker(drawable, readback_work);
++    register_cleanup();
+   }
+   // Readback thread needs a sync object to avoid reading an incomplete frame
+   di.sync = primus.afns.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);



More information about the arch-commits mailing list