[arch-commits] Commit in primus/repos (3 files)
Felix Yan
felixonmars at archlinux.org
Tue Jul 7 15:32:57 UTC 2020
Date: Tuesday, July 7, 2020 @ 15:32:57
Author: felixonmars
Revision: 658941
archrelease: copy trunk to community-staging-x86_64
Added:
primus/repos/community-staging-x86_64/
primus/repos/community-staging-x86_64/PKGBUILD
(from rev 658940, primus/trunk/PKGBUILD)
primus/repos/community-staging-x86_64/register_cleanup.patch
(from rev 658940, primus/trunk/register_cleanup.patch)
------------------------+
PKGBUILD | 42 ++++++++++++++++++++++++++++++++++++++++++
register_cleanup.patch | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+)
Copied: primus/repos/community-staging-x86_64/PKGBUILD (from rev 658940, primus/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD (rev 0)
+++ community-staging-x86_64/PKGBUILD 2020-07-07 15:32:57 UTC (rev 658941)
@@ -0,0 +1,42 @@
+# Maintainer: Sven-Hendrik Haase <sh at lutzhaase.com>
+# Contributor: Alexander Monakov <amonakov at gmail.com>
+
+pkgname=primus
+pkgver=20151110
+pkgrel=9
+pkgdesc="Faster OpenGL offloading for Bumblebee"
+arch=('x86_64')
+url="https://github.com/amonakov/primus"
+license=('custom:ISC')
+depends=('bumblebee')
+makedepends=('git')
+_commit=d1afbf6fce2778c0751eddf19db9882e04f18bfd # master
+source=("git+https://github.com/amonakov/primus#commit=$_commit"
+ "register_cleanup.patch")
+sha1sums=('SKIP'
+ 'fd48f89c55c1ad854d7a985781faed2c52c0135f')
+
+prepare() {
+ cd primus
+ patch -Np1 -i ../register_cleanup.patch
+}
+
+build() {
+ cd primus
+ make
+}
+
+package() {
+ cd primus
+
+ sed -e '/^PRIMUS_libGL=/cPRIMUS_libGL=/usr/\\$LIB/primus' \
+ -e '/^exec/iexport __GLVND_DISALLOW_PATCHING=1' \
+ primusrun | install -D /dev/stdin "$pkgdir/usr/bin/primusrun"
+
+ install -D lib/libGL.so.1 "$pkgdir/usr/lib/primus/libGL.so.1"
+ install -D primus.bash-completion "$pkgdir/usr/share/bash-completion/completions/primusrun"
+ install -D primusrun.1 "$pkgdir/usr/share/man/man1/primusrun.1"
+ install -D -m644 LICENSE.txt "$pkgdir/usr/share/licenses/primus/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:
Copied: primus/repos/community-staging-x86_64/register_cleanup.patch (from rev 658940, primus/trunk/register_cleanup.patch)
===================================================================
--- community-staging-x86_64/register_cleanup.patch (rev 0)
+++ community-staging-x86_64/register_cleanup.patch 2020-07-07 15:32:57 UTC (rev 658941)
@@ -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