# Cant boot ThinkPad W530 with discrete graphics

## Latrina

Hello folks,

I have a ThinkPad W530, and this one comes with Nvidia Optimus Hybrid Graphics, that is a integrated Intel HD4000 and a Discrete Nvidia Quadro K1000. So far I have been using it with the HD4000 only and to save juice, however since I will be using Vbox for PSD more often and Vbox guests video has been quite slow lately, I decided to switch from the integrated to the discrete.

The discrete graphics works and I can trigger it with the optirum command, however I can't seem to be able to start the system with the Discrete GPU as I get the following error https://goo.gl/aDjQRD .

I have tried everything and I have followed this wiki, but now go https://wiki.gentoo.org/wiki/NVidia/nvidia-drivers

The funny thing is that the initiramfs wont even bother to boot the kernel at all due to the following error "ACPI: Video Device [VID1] (multi-head:yes rom:yes post:no)".

This is my current setup:

make.conf

```
# built this stage.

# Please consult /usr/share/portage/config/make.conf.example for a more

# detailed example.

CFLAGS="-march=ivybridge -O2 -pipe"

VIDEO_CARDS="intel i965 nvidia"

INPUT_DEVICES="synaptics evdev keyboard libinput"

MAKEOPTS="-j8"

CXXFLAGS="${CFLAGS}"

# WARNING: Changing your CHOST is not something that should be done lightly.

# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.

CHOST="x86_64-pc-linux-gnu"

# These are the USE and USE_EXPAND flags that were used for

# buidling in addition to what is provided by the profile.

USE="-bindist -systemd X alsa pulseaudio crypt fontconfig git syslog openrc blkid cryptsetup glamor infinality consolekit kde"

CPU_FLAGS_X86="aes avx mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

PORTDIR="/usr/portage"

DISTDIR="${PORTDIR}/distfiles"

PKGDIR="${PORTDIR}/packages"

CONFIG_PROTECT_MASK="/etc/modules-load.d/lm_sensors.conf" #disable /etc protection write for selective file or subfolder

QEMU_SOFTMMU_TARGETS="x86_64 aarch64 arm"

QEMU_USER_TARGETS="x86_64 aarch64 arm"

```

@ThinkPad ~ $ equery u nvidia-drivers

```
[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

 * Found these USE flags for x11-drivers/nvidia-drivers-396.45:

 U I

 + + X           : Install the X.org driver, OpenGL libraries, XvMC libraries, and VDPAU

                   libraries

 + + abi_x86_32  : 32-bit (x86) libraries

 + + acpi        : Add support for Advanced Configuration and Power Interface

 + + compat      : Install non-GLVND libGL for backwards compatibility

 + + driver      : Install the kernel driver module

 - - gtk3        : Install nvidia-settings with support for GTK+ 3

 + + kms         : Enable support for kernel mode setting (KMS)

 + + multilib    : On 64bit systems, if you want to be able to compile 32bit and 64bit

                   binaries

 - - pax_kernel  : PaX patches from the PaX project

 - - static-libs : Build static versions of dynamic libraries as well

 + + tools       : Install additional tools such as nvidia-settings

 - - uvm         : Install the Unified Memory kernel module (nvidia-uvm) for sharing memory

                   between CPU and GPU in CUDA programs

 - - wayland     : Enable dev-libs/wayland backend

```

@ThinkPad ~ $ sudo eselect opengl list

```
Available OpenGL implementations:

  [1]   nvidia *

  [2]   xorg-x11
```

@ThinkPad ~ $ sudo eselect opencl list

```
Available OpenCL implementations:

  [1]   nvidia *

```

/etc/X11/xorg.conf.d/nvidia.conf

```

 Section "Device"

   Identifier  "nvidia"

   Driver      "nvidia"

 EndSection
```

Lastly, kernel configuration here https://pastebin.com/6nQsPzCw

Thanks

----------

## NeddySeagoon

Latrina,

You don't have two separate graphics systems, so you can't use the nVidia card alone.

The Intel alone works as thats a complete graphics system.

The nVidia GPU can only render into the Intel/nVidia shared pixel buffer. It has no connections to the outside world and cannot put the image onto the display surface.

You either use Intel alone or both Intel and nVidia together, since the nVidia does the rendering and the Intel updates the display.

Follow the Optimus guide on the Wiki.

----------

## depontius

Within my experience, the W530 is not one of those beasts.  I have two W530's, machines from work, and simply ran nouveau on both for ages, though recently I moved one of them to nVidia-drivers.  I've never done any Optimus or Bumblebee stuff for either.

The W520 was a crippled machine, as you say, but not the W530.  Now since he's asking for help, I'll need to see if this is a model-dependent kind of thing.  Next time I have one of them handy (I'm on vacation at the moment.) I'll check the specific model number.

----------

## Latrina

 *NeddySeagoon wrote:*   

> Latrina,
> 
> You don't have two separate graphics systems, so you can't use the nVidia card alone.
> 
> The Intel alone works as thats a complete graphics system.
> ...

 

Hey NeddySeagoon,

to my ignorance I thought I had two separate GPUs  :Sad:  ...

Anyways, I set the Graphics mode to Optimus and Optimus OS detection enabled in the BIOS and configured the system according to the guide you mentioned. However, when X starts the system is unusable. It is this slow not even Konsole would open or any other application really. It seems like there is no HW Acceleration, but it is much worse actually since a system with no HW Acceleration can still be usable up to certain extents.

I spotted this in Xorg.0.log, though I am not sure if this is the issue:

```
[    32.573] (**) NVIDIA(0): Enabling 2D acceleration

[    32.573] (**) NVIDIA(0): ConnectedMonitor string: "DFP-0"

[    32.573] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X

[    32.573] (EE) NVIDIA(0):     log file that the GLX module has been loaded in your X

[    32.573] (EE) NVIDIA(0):     server, and that the module is the NVIDIA GLX module.  If

[    32.573] (EE) NVIDIA(0):     you continue to encounter problems, Please try

[    32.573] (EE) NVIDIA(0):     reinstalling the NVIDIA driver.
```

This is the xorg.conf I am using:

```
Section "ServerLayout"

    Identifier     "Layout0"

    Screen      0  "Screen0"

    Inactive       "intel"

    InputDevice    "Keyboard0" "CoreKeyboard"

    InputDevice    "Mouse0" "CorePointer"

EndSection

Section "Files"

EndSection

Section "InputDevice"

    # generated from data in "/etc/conf.d/gpm"

    Identifier     "Mouse0"

    Driver         "mouse"

    Option         "Protocol"

    Option         "Device" "/dev/input/mice"

    Option         "Emulate3Buttons" "no"

    Option         "ZAxisMapping" "4 5"

EndSection

Section "InputClass"

        Identifier      "Trackpoint Wheel Emulation"

        MatchProduct    "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"

        MatchDevicePath "/dev/input/event*"

        Option          "EmulateWheel"          "true"

        Option          "EmulateWheelButton"    "2"

        Option          "Emulate3Buttons"       "false"

        Option          "XAxisMapping"          "6 7"

        Option          "YAxisMapping"          "4 5"

EndSection

Section "InputDevice"

    # generated from default

    Identifier     "Keyboard0"

    Driver         "kbd"

EndSection

Section "Monitor"

    Identifier     "Monitor0"

    VendorName     "Unknown"

    ModelName      "Unknown"

EndSection

Section "Device"

    Identifier     "Device0"

    Driver         "nvidia"

    VendorName     "NVIDIA Corporation"

    # Stuff on the net says to use BusID "PCI:1:0:0" but the manual says to use "1@0:0:0"

    BusID          "1@0:0:0"

    Option         "ConnectedMonitor" "DFP-0"

    Option         "CustomEDID" "DFP-0:/lib/firmware/edid/1920x1080_ThinkPad_W530.bin"

    Option         "UseEDID" "True"

    Option         "ModeValidation" "NoVirtualSizeCheck"

    # Option       "ModeDebug" "True"

EndSection

Section "Screen"

    Identifier     "Screen0"

    Device         "Device0"

    Monitor        "Monitor0"

    Option         "RenderAccel" "True"

    Option         "NoRenderExtension" "False"

    Option         "AllowGLXWithComposite" "True"

    Option         "AddARGBGLXVisuals" "True"

    Option         "DamageEvents" "True"

    Option         "ConnectToAcpid" "True"

    SubSection     "Display"

        Depth       24

        Modes      "1920x1080"

    EndSubSection

EndSection

Section "Device"

    Identifier     "intel"

    Driver         "modesetting"

    Option         "AccelMethod"    "glamor"

    Option         "DRI"

    Option         "CustomEDID" "DFP-0:/lib/firmware/edid/1920x1080_ThinkPad_W530.bin"

EndSection

Section "Screen"

    Identifier    "intel"

    Device        "intel"

    SubSection     "Display"

        Depth       24

        Modes      "1920x1080"

    EndSubSection

    Monitor        "Monitor0"

EndSection

Section "Extensions"

    Option         "Composite" "Enable"

EndSection
```

drm_kms_helper.edid_firmware=edid/1920x1080_ThinkPad_W530.bin was added to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub

/usr/share/sddm/scripts/Xsetup

```
xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto
```

Full Xorg.0.log here: https://pastebin.com/31VhMLNu

Any help would be much appreciated. Thanks  :Smile: 

----------

## hhfeuer

OpenGL seems to be switched to mesa:

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

[    32.542] (II) Module glx: vendor="X.Org Foundation"

[    32.542]    compiled for 1.19.5, module version = 1.0.0

[    32.542]    ABI class: X.Org Server Extension, version 10.0

```

so run 

eselect opengl set nvidia

again to if it gets switched. Furthermore, in your xorg.conf

    Option         "AccelMethod"    "glamor" 

should be

    Option         "AccelMethod"    "none"

----------

## Latrina

 *hhfeuer wrote:*   

> OpenGL seems to be switched to mesa:
> 
> ```
> [    32.524] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so
> 
> ...

 

Yep that did the trick thanks.

However it has been a struggle to address the massive tearing I was getting in KDE Plasma 5 with the Nvidia driver on. For the record enabling OpenGL 3.1 as Compositor Rendering Backend and adding 

export __GL_YIELD="USLEEP" to /etc/profile.d/tearfree_kde.sh seems to have fixed it, or well, mostly at least.

Thanks everyone for the help  :Smile: 

----------

## hhfeuer

To get a tear free display, simply enable prime sync. Set kernel paramter

nvidia-drm.modeset=1

----------

## Latrina

 *hhfeuer wrote:*   

> To get a tear free display, simply enable prime sync. Set kernel paramter
> 
> nvidia-drm.modeset=1

 

Hey I will try that thanks. Actually the tearing as well as desktop bar misshapen issues are not over unlike what I thought. I spent the whole evening yesterday trying to sort it but no go.

Matter of fact is I opened a new thread for that https://forums.gentoo.org/viewtopic-t-1085200.html There is also a screenshot of what the situation looks like. I don't really like to create threads over and over, but I am officially out of ideas.

Thanks

----------

## Latrina

Just for the record, the ThinkPad W520/30 have a MUX between the Intel and Nvidia card, and yes you can boot the system with just the Discrete GPU. 

The issue was I had to add "nox2apic" to GRUB_CMDLINE_LINUX_DEFAULT. Apparently this bug has been circulated for awhile, though it took me awhile to find it https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1687910 .

Thanks

----------

