From b2f3e10a35fe213e04f1fe88b64cc1069b376365 Mon Sep 17 00:00:00 2001 From: Corey O'Connor Date: Sat, 3 May 2014 07:28:21 -0700 Subject: Add primus and extend bumblebee to support 32bit/64bit multilib architectures. Using primusrun will work as expected in a multilib environment. Even if the initial program executes a antoehr program of the another architecture. Assuming the program does not modify LD_LIBRARY_PATH inappropriately. This does not update virtualgl for seemless multilib. I was unable to get a mixed 64/32 bit environment to work with VirtualGL. The mechanism VirtualGL uses to inject the fake GL library would fail if both 32bit and 64 bit libraries were in the environment. Instead the bumblebee package creates a optirun32 executable that can be used to run a 32bit executable with optimus on a 64 bit host. This is not created if the host is 32bit. For my usage, gaming under wine, the primusrun executable works as expected regardless of 32bit/64bit. --- pkgs/tools/X11/primus/default.nix | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 pkgs/tools/X11/primus/default.nix (limited to 'pkgs/tools/X11/primus/default.nix') diff --git a/pkgs/tools/X11/primus/default.nix b/pkgs/tools/X11/primus/default.nix new file mode 100644 index 000000000000..f457d25fe1b9 --- /dev/null +++ b/pkgs/tools/X11/primus/default.nix @@ -0,0 +1,40 @@ +# For a 64bit + 32bit system the LD_LIBRARY_PATH must contain both the 32bit and 64bit primus +# libraries. Providing a different primusrun for each architecture will not work as expected. EG: +# Using steam under wine can involve both 32bit and 64bit process. All of which inherit the +# same LD_LIBRARY_PATH. +# Other distributions do the same. +{ stdenv +, primusLib +, writeScript +, primusLib_i686 ? null +}: +with stdenv.lib; +let + version = "1.0.0748176"; + ldPath = makeLibraryPath ([primusLib] ++ optional (primusLib_i686 != null) primusLib_i686); + primusrun = writeScript "primusrun" +'' + export LD_LIBRARY_PATH=${ldPath}:\$LD_LIBRARY_PATH + # see: https://github.com/amonakov/primus/issues/138 + # On my system, as of 3.16.6, the intel driver dies when the pixel buffers try to read from the + # source memory directly. Setting PRIMUS_UPLOAD causes an indirection through textures which + # avoids this issue. + export PRIMUS_UPLOAD=1 + exec "$@" +''; +in +stdenv.mkDerivation { + name = "primus-${version}"; + builder = writeScript "builder" + '' + source $stdenv/setup + mkdir -p $out/bin + cp ${primusrun} $out/bin/primusrun + ''; + + meta = { + homepage = https://github.com/amonakov/primus; + description = "Faster OpenGL offloading for Bumblebee"; + maintainer = maintainers.coconnor; + }; +} -- cgit 1.4.1