primus icon indicating copy to clipboard operation
primus copied to clipboard

Official SecondLife linux client crashes under primus

Open Thulinma opened this issue 11 years ago • 3 comments

The official SL linux client works using either mesa or optirun - but not using primus. It boots up just fine, but then crashes when the first 3D visuals are about to be displayed.

As discussed over IRC - here's a link to the apitrace: http://www.mediafire.com/?jrcozgu0kc0pvfp

Thulinma avatar Apr 06 '13 20:04 Thulinma

The problem here is that the game wishes to track buffer objects itself, which is a rather unusual mode of operation. The readback thread in primus is sharing GL objects with the game (it needs to share a GL sync object to avoid reading back incomplete frames), but uses glGen-ned "names" for its own buffer objects. Eventually the game modifies storage of those buffer objects, leading to a crash.

The following patch should fix SL for you, but may break everything else

diff --git a/libglfork.cpp b/libglfork.cpp
index d3fb593..c65e444 100644
--- a/libglfork.cpp
+++ b/libglfork.cpp
@@ -384,7 +384,7 @@ static void* readback_work(void *vd)
   die_if(!primus.afns.glXIsDirect(primus.adpy, context),
         "failed to acquire direct rendering context for readback thread\n");
   primus.afns.glXMakeCurrent(primus.adpy, di.pbuffer, context);
-  primus.afns.glGenBuffers(2, &pbos[0]);
+  pbos[0] = 65534; pbos[1] = 65535; // should be enough for everybody
   primus.afns.glReadBuffer(GL_BACK);
   for (;;)
   {

amonakov avatar Apr 06 '13 21:04 amonakov

Indeed - it runs just fine with that patch. What would be the proper way to handle this? Besides yelling at the SL devs for doing bad things, of course.

Thulinma avatar Apr 06 '13 22:04 Thulinma

What would be the proper way to handle this?

Add an environment variable to tune primus behavior, I suppose.

amonakov avatar Apr 06 '13 22:04 amonakov