diff options
-rw-r--r-- | .SRCINFO | 40 | ||||
-rw-r--r-- | 0001-libglvnd.patch | 26 | ||||
-rw-r--r-- | 0002-bumblebee-f23xorgnvidiafix.patch | 11 | ||||
-rw-r--r-- | 0003-config-igpu.patch | 115 | ||||
-rw-r--r-- | PKGBUILD | 86 | ||||
-rw-r--r-- | bumblebee.conf | 6 | ||||
-rw-r--r-- | bumblebee.install | 17 |
7 files changed, 301 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..c9966aadcfb7 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,40 @@ +pkgbase = bumblebee-picasso-git + pkgdesc = NVIDIA Optimus support for Linux through VirtualGL or primus, igpu amd picasso + pkgver = 3.2.1 + pkgrel = 1 + url = http://www.bumblebee-project.org + install = bumblebee.install + arch = i686 + arch = x86_64 + license = GPL3 + makedepends = git + makedepends = help2man + depends = glib2 + depends = mesa-libgl + optdepends = bbswitch: switch on/off discrete card + optdepends = xf86-video-nouveau: Nouveau driver + optdepends = nvidia: NVIDIA kernel driver + optdepends = nvidia-340xx: NVIDIA kernel driver for older devices + optdepends = nvidia-304xx: NVIDIA kernel driver for even older devices + optdepends = virtualgl: oldest back-end for optirun + optdepends = primus: faster back-end for optirun + optdepends = lib32-virtualgl: run 32bit applications with optirun + optdepends = lib32-primus: faster back-end for optirun + provides = bumblebee + conflicts = bumblebee + backup = etc/bumblebee/bumblebee.conf + backup = etc/bumblebee/xorg.conf.nouveau + backup = etc/bumblebee/xorg.conf.nvidia + source = bumblebee::git://github.com/Bumblebee-Project/Bumblebee.git#branch=master + source = 0001-libglvnd.patch + source = bumblebee.conf + source = 0002-bumblebee-f23xorgnvidiafix.patch + source = 0003-config-igpu.patch + sha256sums = SKIP + sha256sums = b260d64a53617807afe21560db0592d114d7775b182e13fb59349f0157c8dba4 + sha256sums = 1c3d4f5d40245a23a5f1cb1f2f6bd4274ff3c5b3749f76a09255191328ae3193 + sha256sums = 0a4885344a2e6ea08d87f163e133e5256a9c0badf6fe05f91dfcdc9e716135c7 + sha256sums = 84f684ee8da0a6e841df5021de7647d587f34117dfdc55b71c0548817506c1a3 + +pkgname = bumblebee-picasso-git + diff --git a/0001-libglvnd.patch b/0001-libglvnd.patch new file mode 100644 index 000000000000..23067f6aec62 --- /dev/null +++ b/0001-libglvnd.patch @@ -0,0 +1,26 @@ +From c3ccbb7f6dd00038b1cb328898a29583e3a6c9be Mon Sep 17 00:00:00 2001 +From: SolarAquarion <shlomochoina@gmail.com> +Date: Sun, 19 Feb 2017 16:53:09 -0500 +Subject: [PATCH] adding workaround for libglvnd + +--- + src/optirun.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/optirun.c b/src/optirun.c +index 65c83d4..ec72057 100644 +--- a/src/optirun.c ++++ b/src/optirun.c +@@ -203,7 +203,11 @@ static int run_primus(int argc, char **argv) { + + /* primus starts the X server when needed, fixes long-standing fork issue */ + setenv("BUMBLEBEE_SOCKET", bb_config.socket_path, 1); +- ++ ++/* primus needs this variable workaround for libglvnd enabled mesa */ ++ ++ setenv("__GLVND_DISALLOW_PATCHING", "1", 0); ++ + /* set LD_LIBRARY_PATH to primus_ld_path plus ld_path plus current LD_LIBRARY_PATH */ + setenv("PRIMUS_DISPLAY", bb_config.x_display, 0); + char *ldpath_cur = getenv("LD_LIBRARY_PATH"); diff --git a/0002-bumblebee-f23xorgnvidiafix.patch b/0002-bumblebee-f23xorgnvidiafix.patch new file mode 100644 index 000000000000..9de4ba72efa5 --- /dev/null +++ b/0002-bumblebee-f23xorgnvidiafix.patch @@ -0,0 +1,11 @@ +diff -up bumblebee-3.2.1/conf/xorg.conf.nvidia.f23fix bumblebee-3.2.1/conf/xorg.conf.nvidia +--- bumblebee-3.2.1/conf/xorg.conf.nvidia.f23fix 2013-04-26 11:49:03.010174177 -0400 ++++ bumblebee-3.2.1/conf/xorg.conf.nvidia 2015-10-14 17:56:43.920706607 -0400 +@@ -32,3 +32,7 @@ Section "Device" + Option "UseEDID" "false" + Option "UseDisplayDevice" "none" + EndSection ++ ++Section "ServerFlags" ++ Option "IgnoreABI" "1" ++EndSection diff --git a/0003-config-igpu.patch b/0003-config-igpu.patch new file mode 100644 index 000000000000..4cdf84f8b9a9 --- /dev/null +++ b/0003-config-igpu.patch @@ -0,0 +1,115 @@ +diff --git a/conf/bumblebee.conf.in b/conf/bumblebee.conf.in +index a4d071718ff4f4f7acd18639cce9e745203ab13b..d572dcfa35ca8ba7da5b2ed1bf0cd7c5f7fe21cb 100644 +--- a/conf/bumblebee.conf.in ++++ b/conf/bumblebee.conf.in +@@ -22,6 +22,8 @@ NoEcoModeOverride=false + Driver=@CONF_DRIVER@ + # Directory with a dummy config file to pass as a -configdir to secondary X + XorgConfDir=@XCONFDDIR@ ++# PCI Vendor ID of integrated card, empty defaults to INTEL (0x8086) ++IGCPCIVendorId=0x1002 + + ## Client options. Will take effect on the next optirun executed. + [optirun] +diff --git a/src/bbconfig.c b/src/bbconfig.c +index 1dff5e020fcbdc61a0143e69fc16ca6f63c50c34..81458d040864960b265dcbd7c8760c9c26debde2 100644 +--- a/src/bbconfig.c ++++ b/src/bbconfig.c +@@ -47,6 +47,14 @@ const char *bb_pm_method_string[PM_METHODS_COUNT] = { + struct bb_status_struct bb_status; + struct bb_config_struct bb_config; + ++/** ++* Returns a guint from value string ++*/ ++guint bb_uint_from_string(char* str) { ++ unsigned int ret; ++ sscanf(str, "%x", &ret); ++ return ret; ++} + /** + * Returns a gboolean from true/false strings + * @return TRUE if str="true", FALSE otherwise +@@ -425,6 +433,10 @@ GKeyFile *bbconfig_parse_conf(void) { + if (g_key_file_has_key(bbcfg, section, key, NULL)) { + free_and_set_value(&bb_config.x_conf_dir, g_key_file_get_string(bbcfg, section, key, NULL)); + } ++ key = "IGCPCIVendorId"; ++ if (g_key_file_has_key(bbcfg, section, key, NULL)) { ++ free_and_set_value(&bb_config.igc_pci_vendor_id, g_key_file_get_string(bbcfg, section, key, NULL)); ++ } + return bbcfg; + } + +@@ -520,6 +532,7 @@ void init_config(void) { + set_string_value(&bb_config.optirun_bridge, CONF_BRIDGE); + set_string_value(&bb_config.primus_ld_path, CONF_PRIMUS_LD_PATH); + set_string_value(&bb_config.vgl_compress, CONF_VGLCOMPRESS); ++ set_string_value(&bb_config.igc_pci_vendor_id, ""); + // default to auto-detect + set_string_value(&bb_config.driver, ""); + set_string_value(&bb_config.module_name, ""); +@@ -543,6 +556,8 @@ void config_dump(void) { + bb_log(LOG_DEBUG, " X display: %s\n", bb_config.x_display); + bb_log(LOG_DEBUG, " LD_LIBRARY_PATH: %s\n", bb_config.ld_path); + bb_log(LOG_DEBUG, " Socket path: %s\n", bb_config.socket_path); ++ bb_log(LOG_DEBUG, " Integrated Graphic Card PCI Vendor ID: %s\n", bb_config.igc_pci_vendor_id); ++ + if (bb_status.runmode == BB_RUN_SERVER || bb_status.runmode == BB_RUN_DAEMON) { + /* daemon options */ + #ifdef WITH_PIDFILE +diff --git a/src/bbconfig.h b/src/bbconfig.h +index 5596b64c872d738be6da7478228f0607c8fd99e7..62fd388d9d6829a0a2c4f3c59fa219f2b786f021 100644 +--- a/src/bbconfig.h ++++ b/src/bbconfig.h +@@ -143,6 +143,7 @@ struct bb_config_struct { + * If empty, driver will be used. This is + * for Ubuntu which uses nvidia-current */ + int card_shutdown_state; ++ char * igc_pci_vendor_id; + #ifdef WITH_PIDFILE + char *pid_file; /* pid file for storing the daemons PID */ + #endif +@@ -180,6 +181,7 @@ void bbconfig_parse_opts(int argc, char *argv[], int conf_round); + GKeyFile *bbconfig_parse_conf(void); + void bbconfig_parse_conf_driver(GKeyFile *bbcfg, char *driver); + ++guint bb_uint_from_string(char* str); + gboolean bb_bool_from_string(char* str); + + enum bb_pm_method bb_pm_method_from_string(char *value); +diff --git a/src/bumblebeed.c b/src/bumblebeed.c +index a911da9a474a5fe69e813b7f38d7ce7906f8d125..44d761e585603f1e08651c605b721442b7ecb2e0 100644 +--- a/src/bumblebeed.c ++++ b/src/bumblebeed.c +@@ -461,14 +461,19 @@ int main(int argc, char* argv[]) { + init_config(); + bbconfig_parse_opts(argc, argv, PARSE_STAGE_PRECONF); + +- /* First look for an intel card */ +- struct pci_bus_id *pci_id_igd = pci_find_gfx_by_vendor(PCI_VENDOR_ID_INTEL, 0); ++ GKeyFile *bbcfg = bbconfig_parse_conf(); ++ ++ /* look for an integrated card */ ++ unsigned int igc_pcivndid = bb_uint_from_string(bb_config.igc_pci_vendor_id); ++ igc_pcivndid = igc_pcivndid == 0 ? PCI_VENDOR_ID_INTEL : igc_pcivndid; ++ ++ struct pci_bus_id *pci_id_igd = pci_find_gfx_by_vendor(igc_pcivndid, 0); + if (!pci_id_igd) { + /* This is no Optimus configuration. But maybe it's a + dual-nvidia configuration. Let us test that. + */ + pci_id_igd = pci_find_gfx_by_vendor(PCI_VENDOR_ID_NVIDIA, 1); +- bb_log(LOG_INFO, "No Intel video card found, testing for dual-nvidia system.\n"); ++ bb_log(LOG_INFO, "No integrated video card found, testing for dual-nvidia system.\n"); + + if (!pci_id_igd) { + /* Ok, this is not a double gpu setup supported (there is at most +@@ -488,7 +493,6 @@ int main(int argc, char* argv[]) { + + free(pci_id_igd); + +- GKeyFile *bbcfg = bbconfig_parse_conf(); + bbconfig_parse_opts(argc, argv, PARSE_STAGE_DRIVER); + driver_detect(); + if (bbcfg) { diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5ff088d075bc --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,86 @@ +# Maintainer: gnox <gnox.at@gmail.com> +# Contributor: Lekensteyn <lekensteyn@gmail.com> +# Contributor: Samsagax <samsagax@gmail.com> + +pkgname=bumblebee-picasso-git +_gitname=bumblebee +pkgver=3.2.1 +pkgrel=1 +pkgdesc="NVIDIA Optimus support for Linux through VirtualGL or primus, igpu amd picasso" +arch=('i686' 'x86_64') +depends=('glib2' 'mesa-libgl') +makedepends=('git' 'help2man') +optdepends=('bbswitch: switch on/off discrete card' + 'xf86-video-nouveau: Nouveau driver' + 'nvidia: NVIDIA kernel driver' + 'nvidia-340xx: NVIDIA kernel driver for older devices' + 'nvidia-304xx: NVIDIA kernel driver for even older devices' + 'virtualgl: oldest back-end for optirun' + 'primus: faster back-end for optirun') +if [ "$CARCH" = "x86_64" ]; then + optdepends[${#optdepends[@]}]='lib32-virtualgl: run 32bit applications with optirun' + optdepends[${#optdepends[@]}]='lib32-primus: faster back-end for optirun' +fi +conflicts=('bumblebee') +provides=('bumblebee') +url="http://www.bumblebee-project.org" +license=("GPL3") +install='bumblebee.install' +backup=('etc/bumblebee/bumblebee.conf' + 'etc/bumblebee/xorg.conf.nouveau' + 'etc/bumblebee/xorg.conf.nvidia') +source=("$_gitname::git://github.com/Bumblebee-Project/Bumblebee.git#branch=master" + "0001-libglvnd.patch" + "bumblebee.conf" + "0002-bumblebee-f23xorgnvidiafix.patch" + "0003-config-igpu.patch") +sha256sums=('SKIP' + 'b260d64a53617807afe21560db0592d114d7775b182e13fb59349f0157c8dba4' + '1c3d4f5d40245a23a5f1cb1f2f6bd4274ff3c5b3749f76a09255191328ae3193' + '0a4885344a2e6ea08d87f163e133e5256a9c0badf6fe05f91dfcdc9e716135c7' + '84f684ee8da0a6e841df5021de7647d587f34117dfdc55b71c0548817506c1a3') + +pkgver() { + cd "$_gitname" + + git describe --always | sed 's|^v||;s|\([^-]*-\)g|r\1|;s|-|.|g' +} + +prepare(){ + cd "$_gitname" + for p in ${srcdir}/*.patch; do + patch -Np1 -i "$p" + done + +} +build() { + cd "$_gitname" + + autoreconf -fi + ./configure \ + CONF_DRIVER_MODULE_NVIDIA=nvidia \ + CONF_LDPATH_NVIDIA=/usr/lib/nvidia:/usr/lib32/nvidia:/usr/lib:/usr/lib32 \ + CONF_MODPATH_NVIDIA=/usr/lib/nvidia/xorg/,/usr/lib/xorg/modules \ + --prefix=/usr \ + --sbindir=/usr/bin \ + --with-udev-rules=/usr/lib/udev/rules.d/ \ + --sysconfdir=/etc \ + --without-pidfile + make +} + +package() { + cd "$_gitname" + + make install DESTDIR="$pkgdir" \ + completiondir=/usr/share/bash-completion/completions + + + #Blacklist nvidia and nouveau modules + # Reference: https://github.com/Bumblebee-Project/Bumblebee/issues/719 + install -Dm644 "${srcdir}/bumblebee.conf" "${pkgdir}/usr/lib/modprobe.d/bumblebee.conf" + + # Install systemd unit + install -Dm644 "scripts/systemd/bumblebeed.service" "${pkgdir}/usr/lib/systemd/system/bumblebeed.service" + sed -i "s/sbin/bin/" "${pkgdir}/usr/lib/systemd/system/bumblebeed.service" + } diff --git a/bumblebee.conf b/bumblebee.conf new file mode 100644 index 000000000000..2ec832a5dbae --- /dev/null +++ b/bumblebee.conf @@ -0,0 +1,6 @@ +blacklist nvidia +blacklist nvidia-drm +blacklist nvidia-modeset +blacklist nvidia-uvm +blacklist nouveau + diff --git a/bumblebee.install b/bumblebee.install new file mode 100644 index 000000000000..1bc3a647ebbc --- /dev/null +++ b/bumblebee.install @@ -0,0 +1,17 @@ +_notice() { + echo "For optirun to work, you need to install at least virtualgl or primus" + echo "Don't forget to add yourself to the 'bumblebee' group to use Bumblebee" +} + +post_upgrade() { + getent group "bumblebee" &>/dev/null || groupadd -r bumblebee +} + +post_remove() { + getent group "bumblebee" &>/dev/null && groupdel bumblebee 1>/dev/null +} + +post_install() { + post_upgrade + _notice +} |