loader: fallback to kernel name, if PCI fails
[mesa.git] / src / loader / pci_id_driver_map.c
index 3c4657fd014ea503d73db339f82db0d78734e8de..d599abf78a521603a2f163ee928c7773bc32057a 100644 (file)
  * SOFTWARE.
  */
 
-int is_nouveau_vieux(int fd);
+#include <stdbool.h>
+
+bool is_nouveau_vieux(int fd);
 
 #ifdef HAVE_LIBDRM
 
+#include <stdlib.h>
 #include <xf86drm.h>
 #include <nouveau_drm.h>
 
@@ -41,15 +44,16 @@ nouveau_chipset(int fd)
    return gp.value;
 }
 
-int
+bool
 is_nouveau_vieux(int fd)
 {
    int chipset = nouveau_chipset(fd);
-   return chipset > 0 && chipset < 0x30;
+   return (chipset > 0 && chipset < 0x30) ||
+      (chipset < 0x40 && getenv("NOUVEAU_VIEUX") != NULL);
 }
 
 #else
 
-int is_nouveau_vieux(int fd) { return 0; }
+bool is_nouveau_vieux(int fd) { return false; }
 
 #endif