# Optimus and Slim, just get a black screen

## BrummieJim

Hi,

I've tried to go through as many tutorials on this as I can (https://forums.gentoo.org/viewtopic-t-959568-highlight-optimus.html), but to no avail. As soon as I switch to the new Xorg file I get a black screen. If anyone's got an ideas I'd be grateful. I've emerged all of the packages

- Kernel 3.9.x (if the kernel is not at least a 3.9.0 it will not work)

- Xorg version 1.13.4 or higher (Tested on 1.13.4 and 1.14.1 version)

- xrandr 1.4.0

- nvidia drivers 319.12 or higher (Tested with the 319.17 version) 

I've put this in the make.conf VIDEO_CARDS="intel nvidia modesetting"

Here's my lspci

 *Quote:*   

> [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)
> ...

 

My xorg.conf is;

 *Quote:*   

> 
> 
> Section "ServerLayout"
> 
>     Identifier "layout"
> ...

 

and the .xinitrc in my user's home directory is this

 *Quote:*   

> 
> 
> xrandr --setprovideroutputsource modesetting NVIDIA-0
> 
> xrandr --auto 
> ...

 

I've tried starting this through /etc/init.d/xdm start (as root) and startx (as user) ; both result in a black screen.

Here's my xorg.conf

 *Quote:*   

> [  6640.826] 
> 
> X.Org X Server 1.15.0
> 
> Release Date: 2013-12-27
> ...

 

If anyone's got any ideas, I'd be really grateful. I've generated a EDID file, I'm not sure how I should use it.

My laptop is a ASUS X552C,

Thanks,

----------

## Roman_Gruber

I highly recommend that you use the unstable nvidia-driver + latest unstable gentoo-sources. As i used for years nvidia on linux a newer version has some hidden bug fixes sometimes which maybe just solves your problem.

Best way is to try around until it works. with the binary drivers there is not really a better solution sometimes.

----------

## Princess Nell

I tried slim but dropped it in favour of lightdm.

Not sure the xrandr commands will work in .xinitrc. I have those commands in a separate script and it is executed during lightdm startup, i.e. before user login.

----------

## BrummieJim

Could you explain how you ran that from a script in lightdm please? Also, does the xorg.conf look right? [Edit] actually don't want to use lightDM due to all the Gnome dependencies.

I think there's something deeper going on as the error

40.973] (WW) NVIDIA(0): Unable to get display device for DPI computation. 

[ 6641.322] (EE) NVIDIA(0): Failed to initiate mode change.

[ 6641.322] (EE) NVIDIA(0): Failed to complete mode change

[ 6641.334] (II) NVIDIA(0): Built-in logo is bigger than the screen.

----------

## cyberjun

Hi,

Check this thread: https://forums.gentoo.org/viewtopic-t-997018-highlight-optimus.html

The nvidia drivers errors you mention can be ignored. They are not the cause of black screen.

--cyberjun

----------

## Princess Nell

Your xorg.conf looks nearly like mine. The Screen section has two additions:

```

    Option "AllowEmptyInitialConfiguration"

    Option "UseDisplayDevice" "none"

```

/etc/lightdm/lightdm.conf:

```

display-setup-script=/usr/bin/lightdmxrandr

```

and finally, /usr/bin/lightdmxrandr:

```

#!/bin/sh

xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto

```

Yes, it looks like I perused the link posted by cyberjun  :Smile: 

----------

## Atmmac

If you want to use the optimus functionality I would recommend the following... I tried the same tutorial you referenced and spent weeks trying to get it to work.

Go unstable on the nvidia drivers.

Update your kernel to at least 3.12.x ( i had problems on 3.10.x)

Remove all the xrandr config adjustments you made.

delete your xorg.conf

adjust your make.conf to have the following

VIDEO_CARDS="intel nvidia"

add a global bbswitch use flag as well.

do an emerge -auDN @world

emerge bbswitch and bumblebee if it doesn't get pulled in with the flags

make sure eselect opengl list shows xorg as selected and not nvidia.

add yourself to the video and bumblebee groups.

Restart the machine and try an optirun glxgears

You should be golden. In the future also pull in primus with the overlay. The performance is much better.

Good luck.

----------

## lexming

There is a little trick in slim to execute xrandr before login. The command used by slim to take screenshots can be changed to any other command. Therefore, it is possible to put the two xrandr commands that activate the GPU off-loading in a small script and  change the screenshot_cmd parameter in /etc/slim.conf to execute that script, instead of the screenshot utility. The execution of xrandr will not be automatic of course, but just pressing F11 will bring the screen back to live.

The screenshot_cmd in /etc/slim.conf 

```
[...]

screenshot_cmd      /etc/X11/xinit/xinitrc.d/94-xrandr

[...]
```

My /etc/X11/xinit/xinitrc.d/94-xrandr file 

```
#!/bin/sh

xrandr --setprovideroutputsource modesetting NVIDIA-0

xrandr --auto 
```

----------

