Bumblebee-Project / Bumblebee

Bumblebee daemon and client rewritten in C
http://www.bumblebee-project.org/
GNU General Public License v3.0
1.29k stars 142 forks source link

Optimus AMD + NVidia #1083

Open RossComputerGuy opened 2 years ago

RossComputerGuy commented 2 years ago

I've got an Alienware M15 R5 Ryzen Edition which has an RTX 3070, unfortunately I get an error when Bumblee's daemon starts: [ 487.307327] [ERROR]No integrated video card found, quitting.. The problem is that it seems Bumblebee only checks for an Intel integrated GPU. I don't see any issues open or close about this so I'm opening this one.

FlorianFranzen commented 2 years ago

I currently use this patch to run bumblebee with AMD CPUs:

--- a/src/bumblebeed.c
+++ b/src/bumblebeed.c
@@ -462,7 +462,7 @@ int main(int argc, char* argv[]) {
   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);
+  struct pci_bus_id *pci_id_igd = pci_find_gfx_by_vendor(PCI_VENDOR_ID_ATI, 0);
   if (!pci_id_igd) {
     /* This is no Optimus configuration. But maybe it's a
        dual-nvidia configuration. Let us test that.
--- a/src/pci.h
+++ b/src/pci.h
@@ -21,6 +21,7 @@
 #pragma once
 #include <sys/types.h> /* necessary for int32_t */

+#define PCI_VENDOR_ID_ATI     0x1002
 #define PCI_VENDOR_ID_NVIDIA  0x10de
 #define PCI_VENDOR_ID_INTEL   0x8086
 #define PCI_CLASS_DISPLAY_VGA 0x0300

You will also have to patch bbswitch to use it as a backend:

--- a/bbswitch.c
+++ b/bbswitch.c
@@ -36,7 +36,7 @@
 #include <linux/seq_file.h>
 #include <linux/pm_runtime.h>

-#define BBSWITCH_VERSION "0.8"
+#define BBSWITCH_VERSION "0.8-amd"

 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Toggle the discrete graphics card");
@@ -418,7 +418,7 @@ static int __init bbswitch_init(void) {

         acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);

-        if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
+        if (pdev->vendor == PCI_VENDOR_ID_ATI) {
             igd_handle = handle;
             pr_info("Found integrated VGA device %s: %s\n",
                 dev_name(&pdev->dev), (char *)buf.pointer);

Of course the proper way to do this would be to add a command line/kernel parameter to determine which id to use at runtime.

SyedAhkam commented 2 years ago

Is there any progress on this? Any plans to support this officially?