mirror of
https://gitdl.cn/https://github.com/chakralinux/lib32.git
synced 2025-02-03 03:07:16 +08:00
lib32-primus: update accordingly
This commit is contained in:
parent
636808c546
commit
27cd171b3b
@ -3,7 +3,7 @@
|
||||
|
||||
_pkgbasename=primus
|
||||
pkgname=lib32-$_pkgbasename
|
||||
pkgver=20141228
|
||||
pkgver=20151110
|
||||
pkgrel=1
|
||||
pkgdesc="Faster OpenGL offloading for Bumblebee (32-bit library, git sources)"
|
||||
arch=('x86_64')
|
||||
@ -11,8 +11,15 @@ url="https://github.com/amonakov/primus"
|
||||
license=('custom:ISC')
|
||||
depends=($_pkgbasename=$pkgver 'bumblebee' 'lib32-mesa-libgl')
|
||||
makedepends=('git' 'gcc-multilib')
|
||||
source=("git://github.com/amonakov/primus.git#commit=7e21554eb2")
|
||||
md5sums=('SKIP')
|
||||
source=("git://github.com/amonakov/primus.git#commit=d1afbf6"
|
||||
'register_cleanup.patch')
|
||||
md5sums=('SKIP'
|
||||
'266f8b163c5189d594a3d34a6bcab54a')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${_pkgbasename}"
|
||||
patch -Np1 < "$srcdir/register_cleanup.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${_pkgbasename}"
|
||||
|
48
lib32-primus/register_cleanup.patch
Normal file
48
lib32-primus/register_cleanup.patch
Normal file
@ -0,0 +1,48 @@
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user