# [VIDEO] Nvidia Optimus sans Bumblebee & Co

## davidou2a

Salut tout le monde,

J'ai pu lire par ci par la que depuis les drivers 319.xx de Nvidia que le support Optimus etait a priori en intégration et qu'il fallait utiliser xrandr et le modesetting pour "switcher" ou rester sur le GPU et non la carte intégrée...

J'ai suivi les fils de discussions et les docs suivantes, mais je sèche, ca ne fonctionne pas j'ai un magnifique (EE) No Screen Found avec Xorg lorsque je mets mon Xorg.conf... et que je demarre en faisant un startx (XDM desactivé bien sur)

https://wiki.gentoo.org/wiki/NVidia/nvidia-drivers#Kernel_compatibility

https://forums.gentoo.org/viewtopic-t-982060.html

https://forums.gentoo.org/viewtopic-t-959568.html

Je suis sous kernel : gentoo-sources-3.13.0-r1, j'ai patché comme ci-dessous :

https://forums.gentoo.org/viewtopic-p-7490644.html

Mes infos :

make.conf :

```
CHOST="x86_64-pc-linux-gnu"

CFLAGS="-march=core-avx-i -O2 -pipe"

CXXFLAGS="${CFLAGS}"

# ENV OPTIONS

VIDEO_CARDS="intel nvidia modesetting"

INPUT_DEVICES="evdev"

LINGUAS="fr fr_FR"

ACCEPT_LICENSE="*"

ACCEPT_KEYWORDS="~amd64"

GRUB_PLATFORMS="efi-64"

USE="bluetooth cups dhcpcd efi mmx networkmanager rar samba sse sse2 xrandr \

     zip -gnome -kde -qt-static -qt3support -qt4 -wxwidgets"

# MIRRORS

GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ \

            ftp://gentoo.imj.fr/pub/gentoo/ \

            http://mirrors.linuxant.fr/distfiles.gentoo.org/ \

            ftp://mirrors.linuxant.fr/distfiles.gentoo.org/ \

            http://gentoo.modulix.net/gentoo/ \

            ftp://mirror.ovh.net/gentoo-distfiles/ \

            http://mirror.ovh.net/gentoo-distfiles/"

            

SYNC="rsync://rsync.fr.gentoo.org/gentoo-portage"

# PORTAGE OPTIONS

PORTAGE_ELOG_CLASSES="log warn error info"

PORTAGE_ELOG_SYSTEM="echo:log,warn save:log,warn,error,info syslog:error"

EMERGE_DEFAULT_OPTS="--jobs=5 --load-average=5.0 --with-bdeps y"

PORTDIR="/usr/portage"

DISTDIR="${PORTDIR}/distfiles"

PKGDIR="${PORTDIR}/packages"

PORTAGE_NICENESS="0"

MAKEOPTS="-j4 -l4"
```

```
Portage 2.2.8-r1 (default/linux/amd64/13.0/desktop, gcc-4.8.2, glibc-2.18-r1, 3.13.0-gentoo-r1 x86_64)

=================================================================

System uname: Linux-3.13.0-gentoo-r1-x86_64-Intel-R-_Core-TM-_i7-3630QM_CPU_@_2.40GHz-with-gentoo-2.2

KiB Mem:     5539524 total,   2965160 free

KiB Swap:    5242876 total,   5242876 free

Timestamp of tree: Sat, 01 Feb 2014 11:15:01 +0000

ld GNU ld (GNU Binutils) 2.24

app-shells/bash:          4.2_p45-r1

dev-java/java-config:     2.2.0

dev-lang/python:          2.7.6, 3.3.3

dev-util/cmake:           2.8.12.1-r4

dev-util/pkgconfig:       0.28

sys-apps/baselayout:      2.2

sys-apps/openrc:          0.12.4

sys-apps/sandbox:         2.6-r1

sys-devel/autoconf:       2.13, 2.69

sys-devel/automake:       1.11.6, 1.13.4, 1.14.1

sys-devel/binutils:       2.24-r2

sys-devel/gcc:            4.8.2

sys-devel/gcc-config:     1.8

sys-devel/libtool:        2.4.2

sys-devel/make:           4.0-r1

sys-kernel/linux-headers: 3.13 (virtual/os-headers)

sys-libs/glibc:           2.18-r1

Repositories: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core-avx-i -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=core-avx-i -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

EMERGE_DEFAULT_OPTS="--jobs=5 --load-average=5.0 --with-bdeps y"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/             ftp://gentoo.imj.fr/pub/gentoo/             http://mirrors.linuxant.fr/distfiles.gentoo.org/             ftp://mirrors.linuxant.fr/distfiles.gentoo.org/             http://gentoo.modulix.net/gentoo/             ftp://mirror.ovh.net/gentoo-distfiles/             http://mirror.ovh.net/gentoo-distfiles/"

LANG="fr_FR.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j9 -l9"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.fr.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dhcpcd dri dts dvd dvdr efi emboss encode exif fam firefox flac fortran gdbm gif gpm gtk iconv ipv6 jpeg lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg multilib ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds rar readline samba sdl session spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis x264 xcb xml xrandr xv xvid zip zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="fr fr_FR" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="intel nvidia modesetting" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
```

equery list xf86*

```
x11-drivers/xf86-input-evdev-2.8.2

x11-drivers/xf86-video-intel-2.99.907-r1

x11-drivers/xf86-video-modesetting-0.8.1

x11-proto/xf86bigfontproto-1.2.0-r1

x11-proto/xf86dgaproto-2.1-r2

x11-proto/xf86driproto-2.1.1-r1

x11-proto/xf86miscproto-0.9.3

x11-proto/xf86rushproto-1.1.2-r1

x11-proto/xf86vidmodeproto-2.3.1-r1
```

equery list xorg*

```
x11-base/xorg-drivers-1.15

x11-base/xorg-server-1.15.0
```

xorg.conf

```
#Ceci est le contenu du fichier

Section "Module"

   Load    "glx"

EndSection

Section "DRI"

    Mode 0666

EndSection

Section "ServerLayout"

    Identifier "layout"

    Screen 0 "nvidia"

    Inactive "intel"

EndSection

Section "Device"

    Identifier "nvidia"

    Driver "nvidia"

    BusID "01:00.0"

EndSection

Section "Screen"

    Identifier "nvidia"

    Device "nvidia"

    # Uncomment this line if your computer has no display devices connected to

    # the NVIDIA GPU.  Leave it commented if you have display devices

    # connected to the NVIDIA GPU that you would like to use.

    # Option "UseDisplayDevice" "none"

    # Option "AllowEmptyInitialConfiguration"

EndSection

Section "Device"

    Identifier "intel"

    Driver "modesetting"

    # BusID "00:02.0"

EndSection

Section "Screen"

    Identifier "intel"

    Device "intel"

EndSection

Section "Extensions"

   Option "Composite" "Enable"

   Option "RENDER"    "Enable"

EndSection
```

LSPCI :

```
00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)

00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)

00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)

00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)

00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation HM76 Express Chipset LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)

00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)

01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 635M] (rev a1)

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)

03:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)
```

Niveau dmesg j'ai remarqué ça :

```
[    0.000000] Checking aperture...

[    0.000000] No AGP bridge found

[    0.876718] [drm] Initialized drm 1.1.0 20060810

[    0.877717] [drm] Memory usable by graphics device = 2048

[    0.915746] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).

[    0.915749] [drm] Driver supports precise vblank timestamp

[    8.466379] nvidia: module license 'NVIDIA' taints kernel.

[    8.466383] Disabling lock debugging due to kernel taint

[    8.473347] nvidia 0000:01:00.0: enabling device (0006 -> 0007)

[    8.473409] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none

[    8.473552] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 1

[    8.473556] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  331.38  Wed Jan  8 19:32:30 PST 2014

[    8.863403] nvidia 0000:01:00.0: irq 45 for MSI/MSI-X

[    8.869939] NVRM: failed to copy vbios to system memory.

[    8.871848] NVRM: RmInitAdapter failed! (0x30:0xffffffff:720)

[    8.871856] NVRM: rm_init_adapter failed for device bearing minor number 0

[    8.871873] NVRM: nvidia_frontend_open: minor 0, module->open() failed, error -5
```

Xorg.0.log

```
[  2139.808] 

X.Org X Server 1.15.0

Release Date: 2013-12-27

[  2139.810] X Protocol Version 11, Revision 0

[  2139.810] Build Operating System: Linux 3.10.25-gentoo x86_64 Gentoo

[  2139.811] Current Operating System: Linux Gent00x 3.13.0-gentoo-r1 #4 SMP Thu Jan 30 12:26:33 CET 2014 x86_64

[  2139.811] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.13.0-gentoo-r1 root=/dev/sda3 ro

[  2139.812] Build Date: 29 January 2014  05:49:38PM

[  2139.813]  

[  2139.814] Current version of pixman: 0.32.4

[  2139.815]    Before reporting problems, check http://wiki.x.org

   to make sure that you have the latest version.

[  2139.815] Markers: (--) probed, (**) from config file, (==) default setting,

   (++) from command line, (!!) notice, (II) informational,

   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.

[  2139.818] (==) Log file: "/var/log/Xorg.0.log", Time: Sat Feb  1 13:30:21 2014

[  2139.819] (==) Using config file: "/etc/X11/xorg.conf"

[  2139.820] (==) Using config directory: "/etc/X11/xorg.conf.d"

[  2139.821] (==) Using system config directory "/usr/share/X11/xorg.conf.d"

[  2139.821] (==) ServerLayout "layout"

[  2139.821] (**) |-->Screen "nvidia" (0)

[  2139.821] (**) |   |-->Monitor "<default monitor>"

[  2139.821] (**) |   |-->Device "nvidia"

[  2139.821] (==) No monitor specified for screen "nvidia".

   Using a default monitor configuration.

[  2139.821] (**) |-->Inactive Device "intel"

[  2139.821] (==) Automatically adding devices

[  2139.821] (==) Automatically enabling devices

[  2139.821] (==) Automatically adding GPU devices

[  2139.821] (WW) The directory "/usr/share/fonts/OTF/" does not exist.

[  2139.821]    Entry deleted from font path.

[  2139.821] (==) FontPath set to:

   /usr/share/fonts/misc/,

   /usr/share/fonts/TTF/,

   /usr/share/fonts/Type1/,

   /usr/share/fonts/100dpi/,

   /usr/share/fonts/75dpi/

[  2139.821] (==) ModulePath set to "/usr/lib64/xorg/modules"

[  2139.821] (**) Extension "Composite" is enabled

[  2139.821] (**) Extension "RENDER" is enabled

[  2139.821] (II) The server relies on udev to provide the list of input devices.

   If no devices become available, reconfigure udev or disable AutoAddDevices.

[  2139.821] (II) Loader magic: 0x7ffc60

[  2139.821] (II) Module ABI versions:

[  2139.821]    X.Org ANSI C Emulation: 0.4

[  2139.821]    X.Org Video Driver: 15.0

[  2139.821]    X.Org XInput driver : 20.0

[  2139.821]    X.Org Server Extension : 8.0

[  2139.821] (II) xfree86: Adding drm device (/dev/dri/card1)

[  2139.821] (II) xfree86: Adding drm device (/dev/dri/card0)

[  2139.822] (--) PCI:*(0:0:2:0) 8086:0166:1043:10bc rev 9, Mem @ 0xf7400000/4194304, 0xd0000000/268435456, I/O @ 0x0000f000/64

[  2139.822] (--) PCI: (0:1:0:0) 10de:0de3:1043:10bc rev 161, Mem @ 0xf6000000/16777216, 0xe0000000/268435456, 0xf0000000/33554432, I/O @ 0x0000e000/128, BIOS @ 0x????????/524288

[  2139.823] Initializing built-in extension Generic Event Extension

[  2139.824] Initializing built-in extension SHAPE

[  2139.825] Initializing built-in extension MIT-SHM

[  2139.826] Initializing built-in extension XInputExtension

[  2139.826] Initializing built-in extension XTEST

[  2139.827] Initializing built-in extension BIG-REQUESTS

[  2139.828] Initializing built-in extension SYNC

[  2139.829] Initializing built-in extension XKEYBOARD

[  2139.830] Initializing built-in extension XC-MISC

[  2139.831] Initializing built-in extension XINERAMA

[  2139.831] Initializing built-in extension XFIXES

[  2139.832] Initializing built-in extension RENDER

[  2139.833] Initializing built-in extension RANDR

[  2139.834] Initializing built-in extension COMPOSITE

[  2139.835] Initializing built-in extension DAMAGE

[  2139.836] Initializing built-in extension MIT-SCREEN-SAVER

[  2139.836] Initializing built-in extension DOUBLE-BUFFER

[  2139.837] Initializing built-in extension RECORD

[  2139.838] Initializing built-in extension DPMS

[  2139.839] Initializing built-in extension Present

[  2139.839] Initializing built-in extension DRI3

[  2139.840] Initializing built-in extension X-Resource

[  2139.841] Initializing built-in extension XVideo

[  2139.842] Initializing built-in extension XVideo-MotionCompensation

[  2139.842] Initializing built-in extension XFree86-VidModeExtension

[  2139.843] Initializing built-in extension XFree86-DGA

[  2139.844] Initializing built-in extension XFree86-DRI

[  2139.844] Initializing built-in extension DRI2

[  2139.844] (II) "glx" will be loaded. This was enabled by default and also specified in the config file.

[  2139.844] (II) LoadModule: "glx"

[  2139.844] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so

[  2139.853] (II) Module glx: vendor="NVIDIA Corporation"

[  2139.853]    compiled for 4.0.2, module version = 1.0.0

[  2139.853]    Module class: X.Org Server Extension

[  2139.853] (II) NVIDIA GLX Module  331.38  Wed Jan  8 19:10:17 PST 2014

[  2139.853] Loading extension GLX

[  2139.853] (II) LoadModule: "nvidia"

[  2139.853] (II) Loading /usr/lib64/xorg/modules/drivers/nvidia_drv.so

[  2139.854] (II) Module nvidia: vendor="NVIDIA Corporation"

[  2139.854]    compiled for 4.0.2, module version = 1.0.0

[  2139.854]    Module class: X.Org Video Driver

[  2139.854] (II) LoadModule: "modesetting"

[  2139.854] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so

[  2139.854] (II) Module modesetting: vendor="X.Org Foundation"

[  2139.854]    compiled for 1.15.0, module version = 0.8.1

[  2139.854]    Module class: X.Org Video Driver

[  2139.854]    ABI class: X.Org Video Driver, version 15.0

[  2139.854] (II) NVIDIA dlloader X Driver  331.38  Wed Jan  8 18:51:00 PST 2014

[  2139.854] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs

[  2139.854] (II) modesetting: Driver for Modesetting Kernel Drivers: kms

[  2139.854] (--) using VT number 8

[  2139.857] (II) modesetting(G0): using drv /dev/dri/card0

[  2139.857] (WW) Falling back to old probe method for modesetting

[  2139.857] (EE) No devices detected.

[  2139.857] (EE) 

Fatal server error:

[  2139.857] (EE) no screens found(EE) 

[  2139.857] (EE) 

Please consult the The X.Org Foundation support 

    at http://wiki.x.org

 for help. 

[  2139.857] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.

[  2139.858] (EE) 
```

Mon .xinitrc

```
hellmaker@Gent00x ~ $ cat .xinitrc 

export LANG="fr_FR.UTF-8"

#xrandr --setprovideroutputsource 0x46 0x2b4

#xrandr --output LVDS-0 --off

#xrandr --auto 

xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto

startxfce4
```

Je ne vois pas ce qui bloque du moins ça me saute pas aux yeux... si une ame charitable remarque quelque chose d'interessant...

----------

