web-dev-qa-db-fra.com

Pilote Nvidia pour MacBook Pro 9,1

Je suis actuel en utilisant le pilote Nouveau par défaut sur mon MacBook Pro 9,1. J'ai essayé d'installer Nvidia-courant, puis Ubuntu vient de partir en blanc après le redémarrage.

Y a-t-il un moyen sûr d'installer le pilote exclusif NVIDIA?

1
Krypton

J'ai pu installer le pilote Nvidia à partir de la page Nvidia. Il suffit de saisir le pilote dans le fichier .run et de l'installer.

La commande est comme ceci:

Sudo stop service lightdm
chmod +x NVIDIA-Linux-x86_64-331.49.run
Sudo ./NVIDIA-Linux-x86_64-331.49.run

Cependant, j'ai trouvé que je pouvais éteindre la nvidia et exécuter la carte Intel à la place. La carte Intel est bien meilleure que Nvidia considérant que j'utilise mon MBP principalement pour travailler et étudier, mais pas de jeu. Voici comment j'ai fait cela:

Sudo vi /etc/grub.d/10_linux

+ Add following:
   echo "    outb 0x728 1" | sed "s/^/$submenu_indentation/"
   echo "    outb 0x710 2" | sed "s/^/$submenu_indentation/"
   echo "    outb 0x740 2" | sed "s/^/$submenu_indentation/"
   echo "    outb 0x750 0" | sed "s/^/$submenu_indentation/"
after these lines:
   if [ x$type != xrecovery ] ; then
        echo "    gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/"
   fi

   echo "    insmod gzio" | sed "s/^/$submenu_indentation/"

+ Rebuild grub:
grub-mkconfig > /boot/grub/grub.cfg

+ Open Grub Customizer, add following options:
i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0

+ Reboot and enjoy low power and low heat

+ To confirm Nvidia is off:
Sudo cat /sys/kernel/debug/vgaswitcheroo/switch

+ Download mbp_power.c and compile it:
Sudo gcc -O2 -o /usr/local/bin/mbp_power mbp_power.c

+ Make it run right after resuming from sleep
vim /etc/pm/sleep.d/10_disable_nvidia.sh

case "${1}" in
    hibernate|suspend)
        # this is called when going to hibernate or to sleep
            ;;
    resume|thaw)
        # this is called when waking up
        /usr/local/bin/mbp_power
            ;;
esac

+ Make sure every thing is executable
chmod +x /usr/local/bin/mbp_power
chmod +x /etc/pm/sleep.d/10_disable_nvidia.sh

mbp_power.c:

// compile:
// Sudo gcc -O2 -o /usr/local/bin/mbp_power mbp_power.c


#include <stdio.h> 
#include <sys/io.h>

#define PORT_SWITCH_DISPLAY 0x710
#define PORT_SWITCH_SELECT 0x728
#define PORT_SWITCH_DDC 0x740
#define PORT_DISCRETE_POWER 0x750

static int gmux_switch_to_igd()
{
    outb(1, PORT_SWITCH_SELECT);
    outb(2, PORT_SWITCH_DISPLAY);
    outb(2, PORT_SWITCH_DDC);
    return 0;
}

static void mbp_gpu_power(int state)
{
    outb(state, PORT_DISCRETE_POWER);
}

static void mb_gpu_print()
{
    printf("SELECT:  %hhu\n", inb(PORT_SWITCH_SELECT));
    printf("DISPLAY: %hhu\n", inb(PORT_SWITCH_DISPLAY));
    printf("DDC:     %hhu\n", inb(PORT_SWITCH_DDC));
    printf("POWER:   %hhu\n", inb(PORT_DISCRETE_POWER));
}

int main(int argc, char **argv)
{
    if (iopl(3) < 0) {
        perror ("No IO permissions");
        return 1;
    }
    int state=0;
    if (argc > 1) state = atoi(argv[1]);
    printf("Before:\n");
    mb_gpu_print();
    mbp_gpu_power(state);
    gmux_switch_to_igd();
    printf("After:\n");
    mb_gpu_print();
    return 0;
}

Preuve dans la photo suivante: enter image description here

1
Krypton