[Nvidia & Xorg/PRIME] Impossible de démarrer sur la carte Intel et utiliser GPU Nvidia

Reconnaissance et configuration du matériel / kernel linux
BlondVador
Chu Ko Nu
Messages : 302
Inscription : ven. 29 janv. 2010, 21:41

[Nvidia & Xorg/PRIME] Impossible de démarrer sur la carte Intel et utiliser GPU Nvidia

Message par BlondVador »

Bonjour,

Je suis passé, il y a quelques semaines de ça, de Bumblebee à Nvidia avec le support d'Optimus (mais pas du switch GPU) qui est apparut depuis. Gros plus : j'ai constaté un gain de performance allant jusqu'à x3 dans certain jeux !

Seulement, je tourne directement sur la carte Nvidia et j'aimerai l'utiliser uniquement quand je lui demande.

J'ai essayé avec bbswitch en standalone, sans résultat. Je suis finalement tombé sur PRIME :
https://wiki.archlinux.org/index.php/PRIME

J'ai essayé diverses manipulations, j'arrive à démarrer sur la carte Intel mais il m'est impossible d'utiliser le GPU Nvidia.

Auriez-vous une idée s'il vous plaît ?

Je vous transmets ici les informations nécessaires :

Je vois les 2 providers si je démarre sur le GPU Nvidia.

Code : Tout sélectionner

[perru@perru ~]$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x2b2 cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 1 name:modesetting
Je n'en vois qu'un seul si je démarre sur le GPU intel (le module n'est pas blacklisté) :

Code : Tout sélectionner

[perru@perru ~]$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 0 name:modesetting
Mon xorg.conf en démarrant sur la carte Intel :

Code : Tout sélectionner

/etc/X11/xorg.conf
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Inactive "nvidia"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    Option "Coolbits" "31"
    Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefault=0x1; PowerMizerDefaultAC=0x1"
    Option "DPI" "96 x 96"
    # e.g. BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "Yes"
EndSection

Section "Device"
    Identifier  "intel"
    Driver    "modesetting"
    BusID       "PCI:0:2:0"
    Option      "AccelMethod"  "sna"
    #Option      "TearFree" "True"
    #Option      "Tiling" "True"
    #Option      "SwapbuffersWait" "True"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Code : Tout sélectionner

[perru@perru ~]$ DRI_PRIME=0 glxinfo | grep "OpenGL vendor string"
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Error: couldn't find RGB GLX visual or fbconfig
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".

Code : Tout sélectionner

[perru@perru ~]$ DRI_PRIME=1 glxinfo | grep "OpenGL vendor string"
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Error: couldn't find RGB GLX visual or fbconfig
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Et enfin mon Xorg.0.log, dans lequel on trouve notamment :
[ 3.298] (EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)

Code : Tout sélectionner

[     3.157] 
X.Org X Server 1.17.1
Release Date: 2015-02-10
[     3.157] X Protocol Version 11, Revision 0
[     3.157] Build Operating System: Linux 3.19.2-1-ARCH x86_64 
[     3.157] Current Operating System: Linux perru 4.0.4-3-ck #1 SMP PREEMPT Fri May 22 07:30:42 EDT 2015 x86_64
[     3.157] Kernel command line: BOOT_IMAGE=../vmlinuz-linux-ck root=UUID=e53960a1-d3fa-4c69-9d8e-dcd930eba744 rw rcutree.rcu_idle_gp_delay=1 nvidia.NVreg_EnablePCIeGen3=1 initrd=../intel-ucode.img,../initramfs-linux-ck.img elevator=bfq 
[     3.157] Build Date: 14 April 2015  10:34:18AM
[     3.157]  
[     3.157] Current version of pixman: 0.32.6
[     3.157]    Before reporting problems, check http://wiki.x.org
   to make sure that you have the latest version.
[     3.157] Markers: (--) probed, (**) from config file, (==) default setting,
   (++) from command line, (!!) notice, (II) informational,
   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[     3.157] (==) Log file: "/var/log/Xorg.0.log", Time: Mon Jun  1 02:18:44 2015
[     3.159] (==) Using config file: "/etc/X11/xorg.conf"
[     3.159] (==) Using config directory: "/etc/X11/xorg.conf.d"
[     3.159] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[     3.160] (==) ServerLayout "layout"
[     3.160] (**) |-->Screen "intel" (0)
[     3.160] (**) |   |-->Monitor "<default monitor>"
[     3.160] (**) |   |-->Device "intel"
[     3.160] (==) No monitor specified for screen "intel".
   Using a default monitor configuration.
[     3.160] (**) |-->Inactive Device "nvidia"
[     3.160] (==) Automatically adding devices
[     3.160] (==) Automatically enabling devices
[     3.160] (==) Automatically adding GPU devices
[     3.163] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/100dpi/".
[     3.163]    Entry deleted from font path.
[     3.163]    (Run 'mkfontdir' on "/usr/share/fonts/100dpi/").
[     3.163] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/75dpi/".
[     3.163]    Entry deleted from font path.
[     3.163]    (Run 'mkfontdir' on "/usr/share/fonts/75dpi/").
[     3.163] (==) FontPath set to:
   /usr/share/fonts/misc/,
   /usr/share/fonts/TTF/,
   /usr/share/fonts/OTF/,
   /usr/share/fonts/Type1/
[     3.163] (==) ModulePath set to "/usr/lib/xorg/modules"
[     3.163] (II) The server relies on udev to provide the list of input devices.
   If no devices become available, reconfigure udev or disable AutoAddDevices.
[     3.163] (II) Loader magic: 0x815d80
[     3.163] (II) Module ABI versions:
[     3.163]    X.Org ANSI C Emulation: 0.4
[     3.163]    X.Org Video Driver: 19.0
[     3.163]    X.Org XInput driver : 21.0
[     3.163]    X.Org Server Extension : 9.0
[     3.164] (II) systemd-logind: took control of session /org/freedesktop/login1/session/c1
[     3.165] (II) xfree86: Adding drm device (/dev/dri/card1)
[     3.165] (II) systemd-logind: got fd for /dev/dri/card1 226:1 fd 8 paused 0
[     3.165] (II) xfree86: Adding drm device (/dev/dri/card0)
[     3.165] (II) systemd-logind: got fd for /dev/dri/card0 226:0 fd 9 paused 0
[     3.166] (--) PCI:*(0:0:2:0) 8086:0166:1462:10d8 rev 9, Mem @ 0xf6400000/4194304, 0xd0000000/268435456, I/O @ 0x0000f000/64
[     3.166] (--) PCI: (0:1:0:0) 10de:0fd4:1462:10d8 rev 161, Mem @ 0xf5000000/16777216, 0xe0000000/268435456, 0xf0000000/33554432, I/O @ 0x0000e000/128, BIOS @ 0x????????/524288
[     3.166] (II) Open ACPI successful (/var/run/acpid.socket)
[     3.166] (II) LoadModule: "glx"
[     3.170] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[     3.256] (II) Module glx: vendor="NVIDIA Corporation"
[     3.256]    compiled for 4.0.2, module version = 1.0.0
[     3.256]    Module class: X.Org Server Extension
[     3.256] (II) NVIDIA GLX Module  352.09  Tue May 12 14:17:34 PDT 2015
[     3.257] (II) LoadModule: "modesetting"
[     3.257] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[     3.258] (II) Module modesetting: vendor="X.Org Foundation"
[     3.258]    compiled for 1.17.1, module version = 1.17.1
[     3.258]    Module class: X.Org Video Driver
[     3.258]    ABI class: X.Org Video Driver, version 19.0
[     3.258] (II) LoadModule: "nvidia"
[     3.258] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[     3.263] (II) Module nvidia: vendor="NVIDIA Corporation"
[     3.263]    compiled for 4.0.2, module version = 1.0.0
[     3.263]    Module class: X.Org Video Driver
[     3.264] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[     3.264] (II) NVIDIA dlloader X Driver  352.09  Tue May 12 13:54:27 PDT 2015
[     3.264] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[     3.264] (++) using VT number 1

[     3.264] (--) controlling tty is VT number 1, auto-enabling KeepTty
[     3.264] (II) modeset(0): using drv /dev/dri/card0
[     3.265] (II) Loading sub module "fb"
[     3.265] (II) LoadModule: "fb"
[     3.265] (II) Loading /usr/lib/xorg/modules/libfb.so
[     3.266] (II) Module fb: vendor="X.Org Foundation"
[     3.266]    compiled for 1.17.1, module version = 1.0.0
[     3.266]    ABI class: X.Org ANSI C Emulation, version 0.4
[     3.266] (II) Loading sub module "wfb"
[     3.266] (II) LoadModule: "wfb"
[     3.266] (II) Loading /usr/lib/xorg/modules/libwfb.so
[     3.267] (II) Module wfb: vendor="X.Org Foundation"
[     3.267]    compiled for 1.17.1, module version = 1.0.0
[     3.267]    ABI class: X.Org ANSI C Emulation, version 0.4
[     3.267] (II) Loading sub module "ramdac"
[     3.267] (II) LoadModule: "ramdac"
[     3.267] (II) Module "ramdac" already built-in
[     3.269] (II) modeset(0): Creating default Display subsection in Screen section
   "intel" for depth/fbbpp 24/32
[     3.269] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[     3.269] (**) modeset(0): Option "AccelMethod" "sna"
[     3.269] (==) modeset(0): RGB weight 888
[     3.269] (==) modeset(0): Default visual is TrueColor
[     3.269] (**) modeset(0): glamor disabled
[     3.269] (II) modeset(0): ShadowFB: preferred YES, enabled YES
[     3.269] (II) modeset(0): Output LVDS-0 has no monitor section
[     3.270] (II) modeset(0): Output VGA-0 has no monitor section
[     3.270] (II) modeset(0): Output HDMI-0 has no monitor section
[     3.270] (II) modeset(0): Output DisplayPort-0 has no monitor section
[     3.270] (II) modeset(0): EDID for output LVDS-0
[     3.270] (II) modeset(0): Manufacturer: LGD  Model: 303  Serial#: 0
[     3.270] (II) modeset(0): Year: 2010  Week: 0
[     3.270] (II) modeset(0): EDID Version: 1.4
[     3.270] (II) modeset(0): Digital Display Input
[     3.270] (II) modeset(0): 6 bits per channel
[     3.270] (II) modeset(0): Digital interface is undefined
[     3.270] (II) modeset(0): Max Image Size [cm]: horiz.: 38  vert.: 21
[     3.270] (II) modeset(0): Gamma: 2.20
[     3.270] (II) modeset(0): No DPMS capabilities specified
[     3.270] (II) modeset(0): Supported color encodings: RGB 4:4:4 
[     3.270] (II) modeset(0): First detailed timing is preferred mode
[     3.270] (II) modeset(0): Preferred mode is native pixel format and refresh rate
[     3.270] (II) modeset(0): redX: 0.615 redY: 0.371   greenX: 0.342 greenY: 0.609
[     3.270] (II) modeset(0): blueX: 0.150 blueY: 0.111   whiteX: 0.313 whiteY: 0.329
[     3.270] (II) modeset(0): Manufacturer's mask: 0
[     3.270] (II) modeset(0): Supported detailed timing:
[     3.270] (II) modeset(0): clock: 97.8 MHz   Image Size:  382 x 215 mm
[     3.270] (II) modeset(0): h_active: 1600  h_sync: 1648  h_sync_end 1696 h_blank_end 1784 h_border: 0
[     3.270] (II) modeset(0): v_active: 900  v_sync: 902  v_sync_end 905 v_blanking: 912 v_border: 0
[     3.270] (II) modeset(0): Supported detailed timing:
[     3.270] (II) modeset(0): clock: 65.2 MHz   Image Size:  382 x 215 mm
[     3.270] (II) modeset(0): h_active: 1600  h_sync: 1648  h_sync_end 1696 h_blank_end 1784 h_border: 0
[     3.270] (II) modeset(0): v_active: 900  v_sync: 902  v_sync_end 905 v_blanking: 912 v_border: 0
[     3.270] (II) modeset(0):  CVW69€173WD1
[     3.270] (II) modeset(0): Unknown vendor-specific block 0
[     3.270] (II) modeset(0): EDID (in hex):
[     3.270] (II) modeset(0):    00ffffffffffff0030e4030300000000
[     3.270] (II) modeset(0):    00140104902615780288a59d5f579c26
[     3.270] (II) modeset(0):    1c505400000001010101010101010101
[     3.270] (II) modeset(0):    0101010101012f2640b860840c303030
[     3.270] (II) modeset(0):    23007ed710000019751940b860840c30
[     3.270] (II) modeset(0):    303023007ed710000019000000fe0043
[     3.270] (II) modeset(0):    56573639803137335744310a00000000
[     3.270] (II) modeset(0):    00004131960000000002010a202000c4
[     3.270] (II) modeset(0): Printing probed modes for output LVDS-0
[     3.270] (II) modeset(0): Modeline "1600x900"x60.1   97.75  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (54.8 kHz eP)
[     3.270] (II) modeset(0): Modeline "1600x900"x40.1   65.17  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (36.5 kHz e)
[     3.270] (II) modeset(0): Modeline "1024x768"x120.1  133.47  1024 1100 1212 1400  768 768 770 794 doublescan -hsync +vsync (95.3 kHz d)
[     3.270] (II) modeset(0): Modeline "1024x768"x60.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz d)
[     3.270] (II) modeset(0): Modeline "960x720"x120.0  117.00  960 1024 1128 1300  720 720 722 750 doublescan -hsync +vsync (90.0 kHz d)
[     3.270] (II) modeset(0): Modeline "928x696"x120.1  109.15  928 976 1088 1264  696 696 698 719 doublescan -hsync +vsync (86.4 kHz d)
[     3.270] (II) modeset(0): Modeline "896x672"x120.0  102.40  896 960 1060 1224  672 672 674 697 doublescan -hsync +vsync (83.7 kHz d)
[     3.270] (II) modeset(0): Modeline "800x600"x120.0   81.00  800 832 928 1080  600 600 602 625 doublescan +hsync +vsync (75.0 kHz d)
[     3.271] (II) modeset(0): Modeline "800x600"x60.3   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz d)
[     3.271] (II) modeset(0): Modeline "800x600"x56.2   36.00  800 824 896 1024  600 601 603 625 +hsync +vsync (35.2 kHz d)
[     3.271] (II) modeset(0): Modeline "700x525"x120.0   61.00  700 744 820 940  525 526 532 541 doublescan +hsync +vsync (64.9 kHz d)
[     3.271] (II) modeset(0): Modeline "640x512"x120.0   54.00  640 664 720 844  512 512 514 533 doublescan +hsync +vsync (64.0 kHz d)
[     3.271] (II) modeset(0): Modeline "640x480"x120.0   54.00  640 688 744 900  480 480 482 500 doublescan +hsync +vsync (60.0 kHz d)
[     3.271] (II) modeset(0): Modeline "640x480"x59.9   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz d)
[     3.271] (II) modeset(0): Modeline "512x384"x120.0   32.50  512 524 592 672  384 385 388 403 doublescan -hsync -vsync (48.4 kHz d)
[     3.271] (II) modeset(0): Modeline "400x300"x120.6   20.00  400 420 484 528  300 300 302 314 doublescan +hsync +vsync (37.9 kHz d)
[     3.271] (II) modeset(0): Modeline "400x300"x112.7   18.00  400 412 448 512  300 300 301 312 doublescan +hsync +vsync (35.2 kHz d)
[     3.271] (II) modeset(0): Modeline "320x240"x120.1   12.59  320 328 376 400  240 245 246 262 doublescan -hsync -vsync (31.5 kHz d)
[     3.271] (II) modeset(0): EDID for output VGA-0
[     3.271] (II) modeset(0): EDID for output HDMI-0
[     3.271] (II) modeset(0): EDID for output DisplayPort-0
[     3.271] (II) modeset(0): Output LVDS-0 connected
[     3.271] (II) modeset(0): Output VGA-0 disconnected
[     3.271] (II) modeset(0): Output HDMI-0 disconnected
[     3.271] (II) modeset(0): Output DisplayPort-0 disconnected
[     3.271] (II) modeset(0): Using exact sizes for initial modes
[     3.271] (II) modeset(0): Output LVDS-0 using initial mode 1600x900
[     3.271] (II) modeset(0): Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.
[     3.271] (==) modeset(0): DPI set to (96, 96)
[     3.271] (II) Loading sub module "fb"
[     3.271] (II) LoadModule: "fb"
[     3.272] (II) Loading /usr/lib/xorg/modules/libfb.so
[     3.272] (II) Module fb: vendor="X.Org Foundation"
[     3.272]    compiled for 1.17.1, module version = 1.0.0
[     3.272]    ABI class: X.Org ANSI C Emulation, version 0.4
[     3.272] (II) Loading sub module "shadow"
[     3.272] (II) LoadModule: "shadow"
[     3.272] (II) Loading /usr/lib/xorg/modules/libshadow.so
[     3.272] (II) Module shadow: vendor="X.Org Foundation"
[     3.272]    compiled for 1.17.1, module version = 1.1.0
[     3.272]    ABI class: X.Org ANSI C Emulation, version 0.4
[     3.272] (==) Depth 24 pixmap format is 32 bpp
[     3.274] (==) modeset(0): Backing store enabled
[     3.274] (==) modeset(0): Silken mouse enabled
[     3.274] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[     3.274] (==) modeset(0): DPMS enabled
[     3.292] (--) RandR disabled
[     3.298] (EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)
[     3.299] (II) modeset(0): Setting screen physical size to 423 x 238
[     3.357] (II) config/udev: Adding input device Power Button (/dev/input/event2)
[     3.357] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[     3.357] (**) Power Button: Applying InputClass "keyboard-layout"
[     3.357] (II) LoadModule: "evdev"
[     3.357] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[     3.359] (II) Module evdev: vendor="X.Org Foundation"
[     3.359]    compiled for 1.17.1, module version = 2.9.2
[     3.359]    Module class: X.Org XInput Driver
[     3.359]    ABI class: X.Org XInput driver, version 21.0
[     3.360] (II) systemd-logind: got fd for /dev/input/event2 13:66 fd 16 paused 0
[     3.360] (II) Using input driver 'evdev' for 'Power Button'
[     3.360] (**) Power Button: always reports core events
[     3.360] (**) evdev: Power Button: Device: "/dev/input/event2"
[     3.360] (--) evdev: Power Button: Vendor 0 Product 0x1
[     3.360] (--) evdev: Power Button: Found keys
[     3.360] (II) evdev: Power Button: Configuring as keyboard
[     3.360] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2/event2"
[     3.360] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
[     3.360] (**) Option "xkb_rules" "evdev"
[     3.360] (**) Option "xkb_model" "pc104"
[     3.360] (**) Option "xkb_layout" "fr"
[     3.386] (II) config/udev: Adding input device Video Bus (/dev/input/event4)
[     3.386] (**) Video Bus: Applying InputClass "evdev keyboard catchall"
[     3.386] (**) Video Bus: Applying InputClass "keyboard-layout"
[     3.387] (II) systemd-logind: got fd for /dev/input/event4 13:68 fd 17 paused 0
[     3.387] (II) Using input driver 'evdev' for 'Video Bus'
[     3.387] (**) Video Bus: always reports core events
[     3.387] (**) evdev: Video Bus: Device: "/dev/input/event4"
[     3.387] (--) evdev: Video Bus: Vendor 0 Product 0x6
[     3.387] (--) evdev: Video Bus: Found keys
[     3.387] (II) evdev: Video Bus: Configuring as keyboard
[     3.387] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:01/input/input4/event4"
[     3.387] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 7)
[     3.387] (**) Option "xkb_rules" "evdev"
[     3.387] (**) Option "xkb_model" "pc104"
[     3.387] (**) Option "xkb_layout" "fr"
[     3.388] (II) config/udev: Adding input device Lid Switch (/dev/input/event0)
[     3.388] (II) No input driver specified, ignoring this device.
[     3.388] (II) This device may have been added with another device file.
[     3.388] (II) config/udev: Adding input device Video Bus (/dev/input/event3)
[     3.388] (**) Video Bus: Applying InputClass "evdev keyboard catchall"
[     3.388] (**) Video Bus: Applying InputClass "keyboard-layout"
[     3.388] (II) systemd-logind: got fd for /dev/input/event3 13:67 fd 18 paused 0
[     3.388] (II) Using input driver 'evdev' for 'Video Bus'
[     3.388] (**) Video Bus: always reports core events
[     3.388] (**) evdev: Video Bus: Device: "/dev/input/event3"
[     3.388] (--) evdev: Video Bus: Vendor 0 Product 0x6
[     3.388] (--) evdev: Video Bus: Found keys
[     3.388] (II) evdev: Video Bus: Configuring as keyboard
[     3.388] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:11/LNXVIDEO:00/input/input3/event3"
[     3.388] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 8)
[     3.388] (**) Option "xkb_rules" "evdev"
[     3.388] (**) Option "xkb_model" "pc104"
[     3.388] (**) Option "xkb_layout" "fr"
[     3.389] (II) config/udev: Adding input device Power Button (/dev/input/event1)
[     3.389] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[     3.389] (**) Power Button: Applying InputClass "keyboard-layout"
[     3.389] (II) systemd-logind: got fd for /dev/input/event1 13:65 fd 19 paused 0
[     3.389] (II) Using input driver 'evdev' for 'Power Button'
[     3.389] (**) Power Button: always reports core events
[     3.389] (**) evdev: Power Button: Device: "/dev/input/event1"
[     3.389] (--) evdev: Power Button: Vendor 0 Product 0x1
[     3.389] (--) evdev: Power Button: Found keys
[     3.389] (II) evdev: Power Button: Configuring as keyboard
[     3.389] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1/event1"
[     3.389] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 9)
[     3.389] (**) Option "xkb_rules" "evdev"
[     3.389] (**) Option "xkb_model" "pc104"
[     3.389] (**) Option "xkb_layout" "fr"
[     3.390] (II) config/udev: Adding input device HDA Digital PCBeep (/dev/input/event7)
[     3.390] (II) No input driver specified, ignoring this device.
[     3.390] (II) This device may have been added with another device file.
[     3.390] (II) config/udev: Adding input device HDA Intel PCH Mic (/dev/input/event8)
[     3.390] (II) No input driver specified, ignoring this device.
[     3.390] (II) This device may have been added with another device file.
[     3.391] (II) config/udev: Adding input device HDA Intel PCH Headphone (/dev/input/event9)
[     3.391] (II) No input driver specified, ignoring this device.
[     3.391] (II) This device may have been added with another device file.
[     3.391] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=3 (/dev/input/event10)
[     3.391] (II) No input driver specified, ignoring this device.
[     3.391] (II) This device may have been added with another device file.
[     3.391] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event5)
[     3.391] (**) AT Translated Set 2 keyboard: Applying InputClass "evdev keyboard catchall"
[     3.391] (**) AT Translated Set 2 keyboard: Applying InputClass "keyboard-layout"
[     3.392] (II) systemd-logind: got fd for /dev/input/event5 13:69 fd 20 paused 0
[     3.392] (II) Using input driver 'evdev' for 'AT Translated Set 2 keyboard'
[     3.392] (**) AT Translated Set 2 keyboard: always reports core events
[     3.392] (**) evdev: AT Translated Set 2 keyboard: Device: "/dev/input/event5"
[     3.392] (--) evdev: AT Translated Set 2 keyboard: Vendor 0x1 Product 0x1
[     3.392] (--) evdev: AT Translated Set 2 keyboard: Found keys
[     3.392] (II) evdev: AT Translated Set 2 keyboard: Configuring as keyboard
[     3.392] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio0/input/input5/event5"
[     3.392] (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD, id 10)
[     3.392] (**) Option "xkb_rules" "evdev"
[     3.392] (**) Option "xkb_model" "pc104"
[     3.392] (**) Option "xkb_layout" "fr"
[     3.393] (II) config/udev: Adding input device MSI WMI hotkeys (/dev/input/event6)
[     3.393] (**) MSI WMI hotkeys: Applying InputClass "evdev keyboard catchall"
[     3.393] (**) MSI WMI hotkeys: Applying InputClass "keyboard-layout"
[     3.393] (II) systemd-logind: got fd for /dev/input/event6 13:70 fd 21 paused 0
[     3.393] (II) Using input driver 'evdev' for 'MSI WMI hotkeys'
[     3.393] (**) MSI WMI hotkeys: always reports core events
[     3.393] (**) evdev: MSI WMI hotkeys: Device: "/dev/input/event6"
[     3.394] (--) evdev: MSI WMI hotkeys: Vendor 0 Product 0
[     3.394] (--) evdev: MSI WMI hotkeys: Found keys
[     3.394] (II) evdev: MSI WMI hotkeys: Configuring as keyboard
[     3.394] (**) Option "config_info" "udev:/sys/devices/virtual/input/input9/event6"
[     3.394] (II) XINPUT: Adding extended input device "MSI WMI hotkeys" (type: KEYBOARD, id 11)
[     3.394] (**) Option "xkb_rules" "evdev"
[     3.394] (**) Option "xkb_model" "pc104"
[     3.394] (**) Option "xkb_layout" "fr"
[     3.410] (II) modeset(0): EDID vendor "LGD", prod id 771
[     3.410] (II) modeset(0): Printing DDC gathered Modelines:
[     3.410] (II) modeset(0): Modeline "1600x900"x0.0   97.75  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (54.8 kHz eP)
[     3.410] (II) modeset(0): Modeline "1600x900"x0.0   65.17  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (36.5 kHz e)
[     3.413] (II) modeset(0): EDID vendor "LGD", prod id 771
[     3.413] (II) modeset(0): Printing DDC gathered Modelines:
[     3.413] (II) modeset(0): Modeline "1600x900"x0.0   97.75  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (54.8 kHz eP)
[     3.413] (II) modeset(0): Modeline "1600x900"x0.0   65.17  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (36.5 kHz e)
[     3.544] (II) config/udev: Adding input device ETPS/2 Elantech Touchpad (/dev/input/mouse0)
[     3.544] (**) ETPS/2 Elantech Touchpad: Ignoring device from InputClass "touchpad ignore duplicates"
[     3.561] (II) config/udev: Adding input device ETPS/2 Elantech Touchpad (/dev/input/event11)
[     3.561] (**) ETPS/2 Elantech Touchpad: Applying InputClass "evdev touchpad catchall"
[     3.561] (**) ETPS/2 Elantech Touchpad: Applying InputClass "touchpad catchall"
[     3.561] (**) ETPS/2 Elantech Touchpad: Applying InputClass "Default clickpad buttons"
[     3.561] (**) ETPS/2 Elantech Touchpad: Applying InputClass "Synaptics touchpads"
[     3.561] (II) LoadModule: "synaptics"
[     3.562] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so
[     3.562] (II) Module synaptics: vendor="X.Org Foundation"
[     3.562]    compiled for 1.16.0, module version = 1.8.1
[     3.562]    Module class: X.Org XInput Driver
[     3.562]    ABI class: X.Org XInput driver, version 21.0
[     3.566] (II) systemd-logind: got fd for /dev/input/event11 13:75 fd 24 paused 0
[     3.566] (II) Using input driver 'synaptics' for 'ETPS/2 Elantech Touchpad'
[     3.566] (**) ETPS/2 Elantech Touchpad: always reports core events
[     3.566] (**) Option "Device" "/dev/input/event11"
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: x-axis range 0 - 2356 (res 0)
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: y-axis range 0 - 1240 (res 0)
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: finger width range 0 - 15
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: buttons: left right double triple
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: Vendor 0x2 Product 0xe
[     3.578] (**) Option "EmulateTwoFingerMinZ" "40"
[     3.578] (**) Option "EmulateTwoFingerMinW" "8"
[     3.578] (**) Option "VertEdgeScroll" "on"
[     3.578] (**) Option "HorizEdgeScroll" "on"
[     3.578] (**) Option "VertTwoFingerScroll" "on"
[     3.578] (**) Option "HorizTwoFingerScroll" "on"
[     3.578] (**) Option "TapButton1" "1"
[     3.578] (**) Option "TapButton2" "2"
[     3.578] (**) Option "TapButton3" "3"
[     3.578] (**) Option "CircularScrolling" "on"
[     3.578] (**) Option "CircScrollTrigger" "2"
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
[     3.578] (**) ETPS/2 Elantech Touchpad: always reports core events
[     3.578] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio1/input/input7/event11"
[     3.578] (II) XINPUT: Adding extended input device "ETPS/2 Elantech Touchpad" (type: TOUCHPAD, id 12)
[     3.578] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MinSpeed is now constant deceleration 2.5
[     3.578] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MaxSpeed is now 1.75
[     3.578] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) AccelFactor is now 0.075
[     3.578] (**) ETPS/2 Elantech Touchpad: (accel) keeping acceleration scheme 1
[     3.578] (**) ETPS/2 Elantech Touchpad: (accel) acceleration profile 1
[     3.578] (**) ETPS/2 Elantech Touchpad: (accel) acceleration factor: 2.000
[     3.578] (**) ETPS/2 Elantech Touchpad: (accel) acceleration threshold: 4
[     3.578] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
[    10.442] (II) modeset(0): EDID vendor "LGD", prod id 771
[    10.442] (II) modeset(0): Printing DDC gathered Modelines:
[    10.442] (II) modeset(0): Modeline "1600x900"x0.0   97.75  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (54.8 kHz eP)
[    10.442] (II) modeset(0): Modeline "1600x900"x0.0   65.17  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (36.5 kHz e)
[    10.443] (II) modeset(0): EDID vendor "LGD", prod id 771
[    10.443] (II) modeset(0): Printing DDC gathered Modelines:
[    10.443] (II) modeset(0): Modeline "1600x900"x0.0   97.75  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (54.8 kHz eP)
[    10.443] (II) modeset(0): Modeline "1600x900"x0.0   65.17  1600 1648 1696 1784  900 902 905 912 -hsync -vsync (36.5 kHz e)
Dernière modification par BlondVador le mar. 02 juin 2015, 08:51, modifié 3 fois.
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17629
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Nvidia & Xorg/PRIME] Impossible de démarrer sur la carte Intel

Message par benjarobin »

PRIME est incompatible que je sache avec les drivers propriétaires.
Zsh | KDE | PC fixe : AMD Ryzen 9900X, Radeon RX 7700 XT
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
BlondVador
Chu Ko Nu
Messages : 302
Inscription : ven. 29 janv. 2010, 21:41

Re: [Nvidia & Xorg/PRIME] Impossible de démarrer sur la carte Intel

Message par BlondVador »

C'est ce que j'ai cru comprendre sur le wiki Arch effectivement, cependant sous Ubuntu ils ont un petit soft nommé nvidia-prime qui semble fonctionner. J'ai trouvé un PKGBUILD qui est censé permettre l'installation de nvidia-prime. L'installation fonctionne mais ça s'arrête là, aucun outil ne fonctionne. Je suis bien conscient que c'est le PKGBUILD récupère le paquet pour Ubuntu mais l'auteur semble indiquer que son script fonctionnait en date du 11 février 2015.

Code : Tout sélectionner

# Maintainer: Dennis E. Mungai <dmngaie@gmail.com>
pkgname=nvidia-prime
pkgver=0.7
pkgrel=1
pkgdesc="Tools to enable NVIDIA's Prime."
url="https://launchpad.net/ubuntu/+source/nvidia-prime"
arch=('x86_64' 'i686')
license=('GPLv3')
depends=('lightdm' 'bbswitch' 'python' 'bash')
optdepends=('nvidia' 'lightdm-gtk3-greeter')
makedepends=()
conflicts=()
replaces=()
backup=()
#install='nvidia-prime.install'
source=("https://launchpad.net/ubuntu/+archive/primary/+files/${pkgname}_${pkgver}.tar.gz")
sha256sums=('SKIP')
 
package() {
  cd "${srcdir}/${pkgname}"
 
  mkdir -p "${pkgdir}"/usr/{bin,lib/systemd/system}
  mkdir -p "${pkgdir}"/usr/share/{doc/nvidia-prime,nvidia-prime,lightdm/lightdm.conf.d}
 
  #Install PRIME
  install -m755 $srcdir/nvidia-prime/get-quirk-options $pkgdir/usr/bin/get-quirk-options
  install -m755 $srcdir/nvidia-prime/prime-offload $pkgdir/usr/bin/prime-offload
  install -m755 $srcdir/nvidia-prime/prime-select $pkgdir/usr/bin/prime-select
  install -m755 $srcdir/nvidia-prime/prime-supported $pkgdir/usr/bin/prime-supported
  install -m755 $srcdir/nvidia-prime/prime-switch $pkgdir/usr/bin/prime-switch
 
  #Add nvidia-prime-quirks
  install -m755 $srcdir/nvidia-prime/prime-quirks $pkgdir/usr/share/nvidia-prime/prime-quirks
 
  #Add systemD service
  install -m644 $srcdir/nvidia-prime/debian/nvidia-prime.service $pkgdir/usr/lib/systemd/system/nvidia-prime.service
 
  #Add LightDM
  install -m644 $srcdir/nvidia-prime/90-nvidia.conf $pkgdir/usr/share/lightdm/lightdm.conf.d/90-nvidia.conf
 
  #Other Information
  install -m644 $srcdir/nvidia-prime/debian/changelog $pkgdir/usr/share/doc/nvidia-prime/changelog.gz
  install -m644 $srcdir/nvidia-prime/debian/copyright $pkgdir/usr/share/doc/nvidia-prime/copyright
}
 
# vim:set ts=2 sw=2 et:
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17629
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Nvidia & Xorg/PRIME] Impossible de démarrer sur la carte Intel

Message par benjarobin »

Une fois que tu as démarré avec la carte nvidia, si tu utilises nvidia-settings, tu n'as pas un "onglet" prime ?
Zsh | KDE | PC fixe : AMD Ryzen 9900X, Radeon RX 7700 XT
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
BlondVador
Chu Ko Nu
Messages : 302
Inscription : ven. 29 janv. 2010, 21:41

Re: [Nvidia & Xorg/PRIME] Impossible de démarrer sur la carte Intel et utiliser GPU Nvidia

Message par BlondVador »

Non, cependant j'ai bien de nouvelles entrées possibles dans le terminal telles que "prime-select intel|nvidia|amd". Il semble y avoir quelques soucis avec le script cependant :

Code : Tout sélectionner

[root@perru perru]# prime-select intel
Traceback (most recent call last):
  File "/usr/sbin/prime-select", line 345, in <module>
    switcher = Switcher()
  File "/usr/sbin/prime-select", line 141, in __init__
    int(not self._supported_architectures
AttributeError: 'dict_values' object has no attribute 'index

Code : Tout sélectionner

[root@perru perru]# prime-switch 
/usr/sbin/prime-switch: ligne 22: /usr/bin/gpu-manager: Aucun fichier ou dossier de ce type
J'ai essayé de trouver gpu-manager sur AUR, sans résultat. J'ai plus l'impression que c'est un problème de dépendance plus qu'autre chose.

Je suis tombé sur un sujet qui semblait intéressant mais incomplet également :
https://bbs.archlinux.org/viewtopic.php?id=194947

EDIT :
J'ai réussi à avancer un peu en utilisant python2 :

Code : Tout sélectionner

[root@perru perru]# python2 /usr/bin/prime-select intel
Info: the current alternatives in use are: [None, None]
Error: the installed packages do not support PRIME
Error: intel mode can't be enabled
J'ai zyeuté rapidement mon /usr/bin/prime-select, je vous le dépose ici si jamais :

Code : Tout sélectionner

#!/usr/bin/python
#
#       prime-select
#
#       Copyright 2013 Canonical Ltd.
#       Author: Alberto Milone <alberto.milone@canonical.com>
#
#       Script to switch between NVIDIA and Intel graphics driver libraries.
#
#       Usage:
#           prime-select   nvidia|intel|query
#           nvidia:   switches to NVIDIA's version of libGL.so
#           intel: switches to the open-source version of libGL.so
#           query: checks which version is currently active and writes
#                  "nvidia", "intel" or "unknown" to the standard output
#
#       Permission is hereby granted, free of charge, to any person
#       obtaining a copy of this software and associated documentation
#       files (the "Software"), to deal in the Software without
#       restriction, including without limitation the rights to use,
#       copy, modify, merge, publish, distribute, sublicense, and/or sell
#       copies of the Software, and to permit persons to whom the
#       Software is furnished to do so, subject to the following
#       conditions:
#
#       The above copyright notice and this permission notice shall be
#       included in all copies or substantial portions of the Software.
#
#       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#       EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
#       OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
#       NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
#       HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
#       WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#       FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
#       OTHER DEALINGS IN THE SOFTWARE.


import os
import sys
import re
import subprocess
from subprocess import Popen, PIPE, CalledProcessError

class Alternatives:

    def __init__(self, master_link):
        self._open_drivers_alternative = 'mesa/ld.so.conf'
        self._open_egl_drivers_alternative = 'mesa-egl/ld.so.conf'
        self._command = '/usr/bin/update-alternatives'
        self._master_link = master_link

        # Make sure that the PATH environment variable is set
        if not os.environ.get('PATH'):
            os.environ['PATH'] = '/sbin:/usr/sbin:/bin:/usr/bin'

    def list_alternatives(self):
        '''Get the list of alternatives for the master link'''
        dev_null = open('/dev/null', 'w')
        alternatives = []
        p1 = Popen([self._command, '--list', self._master_link],
                   stdout=PIPE, stderr=dev_null)
        p = p1.communicate()[0]
        dev_null.close()
        c = p.split('\n')
        for line in c:
            line.strip() and alternatives.append(line.strip())

        return alternatives

    def get_current_alternative(self, check_status=False):
        '''Get the alternative in use

        If check_status is True, then only the status will
        be reported (i.e. either "manual" or "auto")
        '''
        dev_null = open('/dev/null', 'w')
        current_alternative = None
        p1 = Popen([self._command, '--query', self._master_link],
                   stdout=PIPE, stderr=dev_null)
        p = p1.communicate()[0]
        dev_null.close()
        c = p.split('\n')
        if check_status:
            pattern = 'Status:'
        else:
            pattern = 'Value:'
        for line in c:
            if line.strip().startswith(pattern):
                return line.replace(pattern, '').strip()
        return None

    def get_alternative_by_name(self, name, ignore_pattern=None):
        '''Get the alternative link by providing the driver name

        ignore_pattern allows ignoring a substring in the name'''
        if ignore_pattern:
            name = name.replace(ignore_pattern, '')
        alternatives = self.list_alternatives()

        for alternative in alternatives:
            if alternative.split('/')[-2] == name:
                return alternative

        return None

    def get_open_drivers_alternative(self):
        '''Get the alternative link for open drivers'''
        return self.get_alternative_by_name(self._open_drivers_alternative)

    def get_open_egl_drivers_alternative(self):
        '''Get the alternative link for open EGL/GLES drivers'''
        return self.get_alternative_by_name(self._open_egl_drivers_alternative)

    def set_alternative(self, path):
        '''Tries to set an alternative and returns the boolean exit status'''
        try:
            subprocess.check_call([self._command, '--set',
                                   self._master_link, path])
            self.ldconfig()
        except CalledProcessError:
            return False
        return True

    def ldconfig(self):
        '''Call ldconfig'''
        try:
            subprocess.check_call(['/sbin/ldconfig'])
        except CalledProcessError:
            return False
        return True


class Switcher(object):

    def __init__(self):
        self._power_profile_path = '/etc/prime-discrete'
        self._supported_architectures = {'i386': 'i386', 'amd64': 'x86_64'}
        main_arch = self._get_architecture()
        other_arch = self._supported_architectures.values()[
                          int(not self._supported_architectures
                          .values().index(main_arch))]
        main_alternative_name = self._get_alternative_name_from_arch(main_arch)
        other_alternative_name = self._get_alternative_name_from_arch(other_arch)

        # We have 2 alternatives, one for each architecture
        self._gl_switcher = Alternatives(main_alternative_name)
        self._gl_switcher_other = Alternatives(other_alternative_name)

    def _get_architecture(self):
        dev_null = open('/dev/null', 'w')
        p1 = Popen(['dpkg', '--print-architecture'], stdout=PIPE, stderr=dev_null)
        p = p1.communicate()[0]
        dev_null.close()
        architecture = p.strip()
        return self._supported_architectures.get(architecture)

    def _get_alternative_name_from_arch(self, architecture):
        alternative = '%s-linux-gnu_gl_conf' % architecture
        return alternative

    def _simplify_x_alternative_name(self, alternative):
        return alternative.split('/')[-1]

    def _simplify_gl_alternative_name(self, alternative):
        return alternative.split('/')[-2]

    def _get_gl_alternatives_list(self):
        raw_alternatives = self._gl_switcher.list_alternatives()
        return  [ self._simplify_gl_alternative_name(x) for x in raw_alternatives ]

    def _update_initramfs(self):
        subprocess.call(['update-initramfs', '-u'])
        # This may not be necessary
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])

    def _get_current_alternative(self):
        # This is a list as the 2nd item belongs to another architecture
        alternatives = [None, None]
        raw_gl_alternative = self._gl_switcher.get_current_alternative()
        raw_gl_alternative_other = self._gl_switcher_other.get_current_alternative()

        if (raw_gl_alternative != None):
            alternatives[0] = self._simplify_gl_alternative_name(raw_gl_alternative)
        if (raw_gl_alternative_other != None):
            alternatives[1] = self._simplify_gl_alternative_name(raw_gl_alternative_other)

        return alternatives

    def _get_current_alternative_status(self):
        '''Get the current status i.e. either "auto" or "manual"'''
        # This is a list as the 2nd item belongs to another architecture
        alternatives = [None, None]
        raw_gl_alternative = self._gl_switcher.get_current_alternative(True)
        raw_gl_alternative_other = self._gl_switcher_other.get_current_alternative(True)

        if (raw_gl_alternative != None):
            alternatives[0] = raw_gl_alternative
        if (raw_gl_alternative_other != None):
            alternatives[1] = raw_gl_alternative_other

        return alternatives

    def enable_alternative(self, alternative):
        # Make sure that the alternative exists
        gl_alternative = self._gl_switcher.get_alternative_by_name(alternative)
        gl_alternative_other = self._gl_switcher_other.get_alternative_by_name(alternative)

        # See if they are null
        # Abort if gl_alternative is null
        if gl_alternative and gl_alternative_other:
            success = (self._gl_switcher.set_alternative(gl_alternative) and
                       self._gl_switcher_other.set_alternative(gl_alternative_other))
            return success
        else:
            sys.stderr.write("Error: no alternative can be found for %s\n" % alternative)

        return False

    def print_current_alternative(self):
        alternatives = self._get_current_alternative()

        try:
            alternative = str(alternatives[0])
            alternative_other = str(alternatives[1])
        except IndexError:
            # No alternative exists
            return False

        if (alternative == alternative_other and
            'nvidia' in alternative):
            if 'prime' in alternative:
                sys.stdout.write('intel\n')
            else:
                sys.stdout.write('nvidia\n')
        else:
            sys.stdout.write('unknown\n')

        return True

    def _write_profile(self, profile):
        if profile == 'intel':
            nvidia_power = 'off'
        elif profile == 'nvidia':
            nvidia_power = 'on'
        else:
            return False

        # Write the settings to the file
        settings = open(self._power_profile_path, 'w')
        settings.write('%s\n' % nvidia_power)
        settings.close()

    def _supports_prime(self):
        '''See if there are alternatives that support PRIME'''
        alternatives = self._get_gl_alternatives_list()
        for alternative in alternatives:
            if 'prime' in alternative:
                return True
        return False

    def _find_alternative_by_name(self, name, ignore_pattern=''):
        '''Find the alternative name that matches a generic name pattern'''
        alternatives = self._get_gl_alternatives_list()

        for alternative in alternatives:
            if name in alternative:
                if ignore_pattern and ignore_pattern in alternative:
                    continue
                return alternative
        return None

    def enable_profile(self, profile):
        current_driver = ''
        current_profile = ''
        alternatives = self._get_current_alternative()

        sys.stdout.write('Info: the current alternatives in use are: %s\n' % str(alternatives))

        # Make sure that the installed packages support PRIME
        if not self._supports_prime():
            sys.stderr.write('Error: the installed packages do not support PRIME\n')
            return False

        try:
            alternative = str(alternatives[0])
            alternative_other = str(alternatives[1])
        except IndexError:
            # No alternative exists
            sys.stderr.write('Error: the required alternatives do not exist\n')
            return False

        if alternative == alternative_other:
            if ((profile == 'intel' and 'prime' in alternative) or
                (profile == 'nvidia' and 'prime' not in alternative and
                 'nvidia' in alternative)):
                # No need to do anything if we're already using the desired
                # profile
                sys.stdout.write('Info: the %s profile is already in use\n' % (profile))
                return True

        # Enable the desired alternative
        if profile == 'intel':
            target_driver = self._find_alternative_by_name('prime')
        else:
            # Make sure to get nvidia-$flavour instead of nvidia-$flavour-prime
            target_driver = self._find_alternative_by_name('nvidia', ignore_pattern='prime')

        sys.stdout.write('Info: selecting %s for the %s profile\n' % (target_driver, profile))

        if self.enable_alternative(target_driver):
            # Write the settings to the config file
            self._write_profile(profile)
            return True
        else:
            return False


def check_root():
    if not os.geteuid() == 0:
        sys.stderr.write("This operation requires root privileges\n")
        exit(1)

def handle_alternatives_error(mode):
    sys.stderr.write('Error: %s mode can\'t be enabled\n' % mode)
    exit(1)

def handle_query_error():
    sys.stderr.write("Error: no alternative can be found\n")
    exit(1)

def usage():
    sys.stderr.write("Usage: %s nvidia|intel|query\n" % (sys.argv[0]))

if __name__ == '__main__':
    try:
        arg = sys.argv[1]
    except IndexError:
        arg = None

    if len(sys.argv[1:]) != 1:
        usage()
        exit(1)

    switcher = Switcher()

    if arg == 'intel' or arg == 'nvidia':
        check_root()
        if not switcher.enable_profile(arg):
            handle_alternatives_error(arg)
    elif arg == 'query':
        if not switcher.print_current_alternative():
            handle_query_error()
    else:
        usage()
        sys.exit(1)

    exit(0)
De ce que j'ai compris, le script switch du pilote libre nouveau pour la carte Intel au pilote proprio nvidia pour le GPU Nvidia. Etant donné qu'on ne peut avoir qu'un seul des deux pilotes sous arch à cause d'un conflit, je pense qu'on peut abandonner l'idée de ce petit script...

Je continue de fouiller le web à la recherche d'une piste mais étrangement, il ne semble pas il y avoir beaucoup d'archeux intéressés par une telle fonctionnalité... Dommage. Je pense qu'il faut adapter nvidia-prime pour arch. Je vais voir ce que je peux faire de mon côté et je proposerai un PKGBUILD sur AUR si j'arrive à quelque chose.

Le topic reste d'actualité, si jamais quelqu'un a une idée :).

EDIT 2 :
J'ai trouvé ce thread sur les forums anglais :
https://bbs.archlinux.org/viewtopic.php?id=177945

Le dernier post donne une procédure intéressante :
Switch to Intel:
-kill lightdm (login manager)
-rmmod nvidia
-echo "OFF" >> /proc/acpi/bbswitch
-Switch xorg.conf over to Intel version (Probably don't need one)
-start lightdm

Switch to Nvidia:
-kill lightdm
-modprobe nvidia
-echo "ON >> /proc/acpi/bbswitch
-Switch xorg.conf over to Nvidia version
-start lightdm
Du coup j'ai voulu me faire un petit script bash pour essayer :

Code : Tout sélectionner

systemctl stop lightdm.service& rmmod nvidia& tee /proc/acpi/bbswitch <<<OFF& cp /etc/X11/xorg.conf.bak-empty /etc/X11/xorg.conf& systemctl start lightdm.service
Le soucis c'est que ça ne relance pas ma session. Cependant si je reboot, je suis bien sur la carte Intel (évidemment puisque le xorg a changé). Comment pourrai-je faire ça "on the fly" ?
Répondre