Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Switching from Intel to NVIDIA (proprietary)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Shoaloak
n00b
n00b


Joined: 05 Nov 2016
Posts: 48

PostPosted: Fri Jan 20, 2017 3:22 pm    Post subject: [solved] Switching from Intel to NVIDIA (proprietary) Reply with quote

Hello Gentoo(wo)men,

I am currently running a 64-bit Gentoo OS /w SystemD & Gnome on my notebook using the integrated Intel Graphics and UEFI.
This runs fine but inside my notebook is also a NVIDIA Geforce 965M.
Aside from more raw GPU power, my main reason to switch is because i want to connect an external monitor using HDMI.
However, when i (dis)connect a HDMI cable, udevadm monitor doesn't register any events. My guess is that the HDMI is on the NVIDIA GPU.

tl;dr; What would be the best way for me to migrate from Intel to NVIDIA?

  • I figured out that the latest (375.26) x11-drivers/nvidia-drivers support the 965M.
  • Of course i am following the Gentoo bible, and it appears i must unmark "Support for frame buffer devices" in my kernel since this conflicts with the binary driver provided by NVIDIA?
    Also, on the wiki it says that the uvesafb driver will conflict with the NVIDIA driver if >361.28, so i must remove the "Support for frame buffer devices" and since i don't have dev-libs/klibc or sys-apps/v86d installed, just removing support will be enough?
    Last point on the matter of framebuffers is that i must remove "efifb support in kernel" since this causes problems with the initialization of the NVIDIA drivers. This means i don't have any framebuffers in my system?
    Quote:
    There is no known alternative framebuffer for (U)EFI systems.
    Does this have implications for my system? e.g. can't switch to non-xorg TTY or Plymouth can only boot in graphics mode?
  • In my make.conf, can i just add nvidia to VIDEO_CARDS or do i need to remove the "intel i965" flags?
  • My notebook also has Mshybrid Or Discrete Switch, currently set to Mshybrid. From what i gathered this isn't optimus technology(?), and the proprietary NVIDIA drivers will allow me to handle this?
  • Rebuilding with "emerge -uDU --with-bdeps=y @world" seems like a smart move with the changed use flag, but is this enough? Or do i also need to rebuild kernel modules?


I tried to do as much reconnaissance before posting this and i'm sorry if things seem self explanatory, but i want this transition to be as smooth as possible. :wink:


Last edited by Shoaloak on Mon Feb 06, 2017 12:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42860
Location: 56N 3W

PostPosted: Fri Jan 20, 2017 3:37 pm    Post subject: Reply with quote

Shoaloak,

Laptop ... intel ... nvidia ... that sounds like an Optimus graphics system.

It may not be but such laptops are rare. If you have an Optimus graphics system, follow the wiki page.
Its not clear from your link if you have Optimus or not.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 439
Location: Brazil

PostPosted: Fri Jan 20, 2017 3:41 pm    Post subject: Reply with quote

Like NeddySeagoon said, that's probably Optimus in your laptop. Try Gentoo wiki, Arch wiki or forum posts for working configs, Took me a while to get mine working here: https://forums.gentoo.org/viewtopic-t-1055194-highlight-.html
Back to top
View user's profile Send private message
Shoaloak
n00b
n00b


Joined: 05 Nov 2016
Posts: 48

PostPosted: Mon Jan 30, 2017 12:32 pm    Post subject: Yelp, it's Optimus Reply with quote

NeddySeagoon & saboya,

Thank you for the responses, it appears you are both correct. Reading Bumblebee documentation gave the proof i do have an Optimus enabled laptop.
Code:
# lspci -vnn | grep '\''[030[02]\]'
00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:191b] (rev 06) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1427] (rev a1) (prog-if 00 [VGA controller])

I shall follow the NVIDIA/Optimus wiki and try to get things working.
Since i'm still installing x11-drivers/nvidia-drivers but this time with Optimus in mind, i think all the things mentioned in my previous post are still applicable unless otherwise mentioned on the Optimus page.
I am however a bit confused with these wiki pages implying the complete removal of the "intel i965" VIDEO_CARDS use flags.

Will report back with questions or (hopefully) succes stories. :roll:
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Jan 30, 2017 2:11 pm    Post subject: Reply with quote

Quote:
This article is about native Optimus support using the official Nvidia drivers (x11-drivers/nvidia-drivers) – it is not about bumblebee; bumblebee is not used in the following configuration.
Contents


your guide enforces only the nvidia hardware.

i personally avoid htose hybrid notebooks. They do not even work in windows 10 wiht a much better hardware than my dated asus g75vw wiht ivybridge, where the nivida gpu is hardwired to the lvds. when you are buying new hardware i recommend going for those few gamer laptops where the nvidia gpu is hardwired to the lvds. The hardware is badly designed which causes issues. a lack of hdmi 2.0 because of intel limitations on their bad silicon.

You are aksing for bumblebee. thats a different issue.
Back to top
View user's profile Send private message
Shoaloak
n00b
n00b


Joined: 05 Nov 2016
Posts: 48

PostPosted: Mon Jan 30, 2017 2:21 pm    Post subject: Reply with quote

Roman_Gruber wrote:
Quote:
This article is about native Optimus support using the official Nvidia drivers (x11-drivers/nvidia-drivers) – it is not about bumblebee; bumblebee is not used in the following configuration.
Contents


your guide enforces only the nvidia hardware.

You are aksing for bumblebee. thats a different issue.


i only used the bumblebee guide's one liner to figure out whether or not my notebook had Optimus.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Jan 30, 2017 2:35 pm    Post subject: Reply with quote

https://wiki.archlinux.org/index.php/bumblebee

... From Bumblebee's FAQ: "Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in GNU/Linux systems. Such feature involves two graphics cards with two different power consumption profiles plugged in a layered way sharing a single framebuffer."

...

Quote:
The integrated GPU manages the display while the dedicated GPU manages the most demanding rendering and ships the work to the integrated GPU to be displayed. When the laptop is running on battery supply, the dedicated GPU is turned off to save power and prolong the battery life


--

vs the gentoo link i critized, enforces maybe always the nivida gpu on. Judging on the descritption of that gentoo link.

--

when you want to have longer battery life you should use bumblebee

--

its up to you. do you want to have always on nvidia gpu => use that gentoo link above

when you want to have longer battery life use that bumblebee thing
Back to top
View user's profile Send private message
Shoaloak
n00b
n00b


Joined: 05 Nov 2016
Posts: 48

PostPosted: Mon Jan 30, 2017 5:56 pm    Post subject: Bumblebee + NVIDIA How To on Gentoo Reply with quote

Roman_Gruber,

Thanks for pointing out that the Gentoo wiki optimus page only enforces the NVIDIA hardware.
After reading your comment i realised that Bumblebee probably is the better option considering battery time. :arrow:

Online I finally found the information(1, 2) suggesting that it's perfectly fine to add nvidia to the VIDEO_CARDS use flags, resulting in
Code:
VIDEO_CARDS="intel i965 nvidia"

After this I let emerge do an deep update with changed use flags.
Code:
# emerge -avuDU –with-bdeps=y @world

This went fine except for the NVIDIA drivers failing:
Code:
FATAL: modpost: GPL-incompatible module nvdia-drm.ko uses GPL-ONLY symbol ‘mutex_destroy’

Luckily, this problem was easily solved by setting CONFIG_DEBUG_MUTEXES=n in the Linux kernel.
After rebuilding the kernel, emerge finished emerging NVIDIA without problems.
(If a person is reading this later in time, please do take a look on the Gentoo wiki (nvidia, optimus) on what to select and what to remove from your kernel.)

After NVIDIA, I installed Bumblebee.
Code:
# emerge -av x11-misc/bumblebee

In the documentation it mentions the creation of the bumblebee group and adding the regular user to this group.
The group is already created on install, so I only needed to add myself to this group.
Code:
# gpasswd -a <username> bumblebee

I also noticed there was a Bumblebee service, so i enabled it.
Code:
# systemctl enable bumblebeed.service


Since the kernel was (re)built and Bumblebee installed, i did an
Code:
# emerge @module-rebuild
since documentation states that every time the kernel is built, this must be done.

After all this, I reset my system to check if everything worked.
Code:
# glxgears -info
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER   = Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2)
GL_VERSION    = 3.0 Mesa 12.0.1
GL_VENDOR     = Intel Open Source Technology Center
GL_EXTENSIONS = ...
301 frames in 5.0 seconds = 60.022 FPS

Code:
# optirun glxgears -info
GL_RENDERER   = GeForce GTX 965M/PCIe/SSE2
GL_VERSION    = 4.5.0 NVIDIA 375.26
GL_VENDOR     = NVIDIA Corporation
GL_EXTENSIONS = ...
3736 frames in 5.0 seconds = 747.057 FPS

Which it seems to be, but now comes the funny part...

Quote:
Aside from more raw GPU power, my main reason to switch is because i want to connect an external monitor using HDMI.

My HDMI still wasn't working. Thankfully, after some research I've also found a working solution for my HDMI problem.
I edited my /etc/bumblebee/bumblebee.conf.
Code:
KeepUnusedXServer=true
Driver=nvidia

#below [driver-nvidia]
KernelDriver=nvidia
PMMethod=none

Edited /etc/bumblebee/xorg.conf.nvidia
Code:
Section "ServerLayout"
    Identifier  "Layout0"
EndSection

Section "Device"
    Identifier  "DiscreteNvidia"
    Driver      "nvidia"
    VendorName  "NVIDIA Corporation"
    BusID "PCI:01:00:0"
    Option "ProbeAllGpus" "false"
    Option "NoLogo" "true"
    #Option "UseEDID" "false"
    #Option "UseDisplayDevice" "none"
EndSection


The final piece of the puzzle is the intel-virtual-output program, which somehow isn't within the x11-drivers/xf86-video-intel package... So I've installed it myself.
Code:
# git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-intel
# cd xf86-video-intel
# ./autogen.sh
# cd tools
# make
# cp intel-virtual-output /usr/bin/
# chmod +x /usr/bin/intel-virtual-output


Now, after a reboot, I can (finally) use my external monitor using a 3 liner bash script.
Code:
modprobe bbswitch
optirun true
intel-virtual-output


And to disable my discrete GPU to save my battery i have modified/extended the referred blogpost's script:
Code:
bbxorgpid=$(ps x | grep 'bumblebee/xorg.conf.nvidia' | awk 'NR==1{print $1}')
kill -15 $bbxorgpid
sleep 5
# since nvidia was 'in use', also had to disable these modules
rmmod nvidia_drm
rmmod nvidia_modeset
rmmod nvidia
tee /proc/acpi/bbswitch <<<OFF


EDIT: To change the brightness of the external monitor, run:
Code:
optirun -b none nvidia-settings -c :8

Go to: GPU 0 - (Your GPU name) -> DFP-0 (Your monitor name) -> Color Correction.

EDIT: To boot your system with discrete GPU disabled (battery saving)
1. automatically load bbswitch:
Code:
# echo "bbswitch" > /etc/modules-load.d/bbswitch.conf

2. Since Gentoo uses kmod, edit /etc/modprobe.d/bbswitch.conf to reflect your needs. disabling the card on boot would be:
Code:
options bbswitch load_state=0

For module options, see:
Code:
# modinfo bbswitch
...
parm:           load_state:Initial card state (0 = off, 1 = on, -1 = unchanged) (int)
parm:           unload_state:Card state on unload (0 = off, 1 = on, -1 = unchanged) (int)
parm:           skip_optimus_dsm:Skip probe of Optimus discrete DSM (default = false) (bool)

Warning: some machines don't like a disabled GPU at shutdown.
If your machine happens to be one, set unload_state=1 in /etc/modprobe.d/bbswitch.conf.
P.S. With this configuration, your enable script can be changed to:
Code:
#!/bin/bash
tee /proc/acpi/bbswitch <<<ON
optirun true
intel-virtual-output
since bbswitch is loaded during boot time.

---
Hope somebody else will benefit from this information, took some time to figure it all out. :roll:
If anybody spots room for improvement, please mention it. I'm still a Gentoo n00b. (Maybe use portage for intel-virtual-output program?)

-- posted from my external monitor :wink:


Last edited by Shoaloak on Wed Feb 01, 2017 11:58 am; edited 8 times in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Jan 30, 2017 10:18 pm    Post subject: Reply with quote

MY Asus g75VW notebook has the nivida gpu hardwired to the lvds without the intel gpu.

I usually use nvidia-settings. Nvidia-settings => Display-Section => detect displays => than i set it up => tha i can instantly use it. there is also an option to safe that config to a file to be reused.

--

Please try to run nvidia-settings and see if you can detect the displays, and if you can set it up!

--

I am not very fond of those hybrid notebooks, so I do not have any expierence with HDMI and hydrbrid graphics. I will not buy those notebooks also!

--

Alternatively you can use the xrandr tool...
Back to top
View user's profile Send private message
Shoaloak
n00b
n00b


Joined: 05 Nov 2016
Posts: 48

PostPosted: Mon Jan 30, 2017 10:49 pm    Post subject: Reply with quote

Roman_Gruber wrote:
MY Asus g75VW notebook has the nivida gpu hardwired to the lvds without the intel gpu.

I usually use nvidia-settings. Nvidia-settings => Display-Section => detect displays => than i set it up => tha i can instantly use it. there is also an option to safe that config to a file to be reused.

--

Please try to run nvidia-settings and see if you can detect the displays, and if you can set it up!

--

I am not very fond of those hybrid notebooks, so I do not have any expierence with HDMI and hydrbrid graphics. I will not buy those notebooks also!

--

Alternatively you can use the xrandr tool...


Already fixed it myself, but thank you for brainstorming with me. :)

EDIT:
Everything works, but do notice errors in dmesg.
Code:
ACPI Exception: AE_NOT_FOUND, Evaluating _DOD (20150930/video-1216)
ACPI Warning: \_SB_.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

# both multiple times at random


Doesn't crash my system, but I do notice small glitch effects sometimes with HDMI plugged in and not using the external monitor.
Will look at it another time and post back any useful data.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Jan 30, 2017 11:00 pm    Post subject: Reply with quote

WElcome in my club. The club of broken UEFI.


Code:
[   21.686899] ACPI Warning: \_SB.PCI0.PEG0.GFX0._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20160831/nsarguments-95)


AFter many bugs.kernel.org requests, providing info, a few of my special keys are working. I have one hint on how to maybe fix the remaining keys, when I have more time coding the DSDT file. kernel devs are not very motivated to fix those aCPI bugs. i did solve the biggest piece myself, and got a few keys working after a year thinking about it regularly, how to get it done.


You should check if some special keys are not working. Like backlight, wifi rfkill, keyboard backlight, mute, volume up / down, touchpad toggle, display toggle and such ... check also if suspend and such works,
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 439
Location: Brazil

PostPosted: Tue Jan 31, 2017 1:28 am    Post subject: Reply with quote

I got some of these on my laptop, some are harmless according to a guy in the bumblebee github:

https://github.com/Bumblebee-Project/bbswitch/commit/ee0591b9b8d0a42f60eae6f9c644e6a1be4323d6#commitcomment-4685919

I got a ASUS laptop, I had to do 2 things in order to get my special keys working:

1 - Multimedia keys (volume up/down/switch): Build ASUS NB WMI module.
2 - Backlight control keys: 'acpi_osi= ' in the kernel command line.

There's good info in the Arch Wiki about these quirks for a variety of models.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Jan 31, 2017 1:53 am    Post subject: Reply with quote

saboya wrote:

2 - Backlight control keys: 'acpi_osi= ' in the kernel command line.


That's a bug in the execution of the path. The result or execution of acpi_osi= should never be used or executed in teh first place. its some sort of abuse / dirty hack, to get in a path which should never be executed.

This is the excemption when 2 of many keys are working and hte others are dead.
on the ordinary executed branch, those 2 keys are dead and hte others are working by now.

When I find more time I have to dig deeper ...

---

Yes ASUS has this Execution bug in their UEFI. or lets say, windows does something else as the software in the linux environment handles it.

--

As said my UEFI is broken. I do not need a quirk. I need to rewrite parts of my UEFI to hardcode the desired functionality. The software environment in gnu / linux and its components just executes it in another way as microsoft has intended it for the UEFI platform. microsoft had its finger in that UEFI thing, and most platforms are only tested / made for windows, so when it works in windows, it does not matter if it is broken or not.

PS: LAST ASUS and MSI notebooks for myself because of poor firmware / poor build quality in recent models. 4-5 years ago they had proper build quality on some models
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 439
Location: Brazil

PostPosted: Tue Jan 31, 2017 2:39 am    Post subject: Reply with quote

Roman_Gruber wrote:
saboya wrote:

2 - Backlight control keys: 'acpi_osi= ' in the kernel command line.


That's a bug in the execution of the path. The result or execution of acpi_osi= should never be used or executed in teh first place. its some sort of abuse / dirty hack, to get in a path which should never be executed.

This is the excemption when 2 of many keys are working and hte others are dead.
on the ordinary executed branch, those 2 keys are dead and hte others are working by now.

When I find more time I have to dig deeper ...

---

Yes ASUS has this Execution bug in their UEFI. or lets say, windows does something else as the software in the linux environment handles it.

--

As said my UEFI is broken. I do not need a quirk. I need to rewrite parts of my UEFI to hardcode the desired functionality. The software environment in gnu / linux and its components just executes it in another way as microsoft has intended it for the UEFI platform. microsoft had its finger in that UEFI thing, and most platforms are only tested / made for windows, so when it works in windows, it does not matter if it is broken or not.

PS: LAST ASUS and MSI notebooks for myself because of poor firmware / poor build quality in recent models. 4-5 years ago they had proper build quality on some models

You're probably right, I have no idea why it works or not, I just want it to work for now :) If you can point me to the right direction, maybe I can help debugging this and trying to solve it the correct way.
Back to top
View user's profile Send private message
Shoaloak
n00b
n00b


Joined: 05 Nov 2016
Posts: 48

PostPosted: Tue Jan 31, 2017 11:33 am    Post subject: ACPI Warning Reply with quote

saboya wrote:
I got some of these on my laptop, some are harmless according to a guy in the bumblebee github:

https://github.com/Bumblebee-Project/bbswitch/commit/ee0591b9b8d0a42f60eae6f9c644e6a1be4323d6#commitcomment-4685919

You are right, seems like NVIDIA is violating the ACPI, both on Windows & GNU/Linux.
bbGithub::acpibob wrote:
Their code (both driver and ASL) is in clear violation of the ACPI specification.

bbGithub::Lekensteyn wrote:
NVIDIA's Windows driver also passes Buffer instead of a Package

It's weird though, i only get the ACPI error's when i plug in the HDMI cable and don't use the monitor.
The only way to fix this if NVIDIA patched their code or file a bug with the ACPI subsystem in kernel bugzilla.

Roman_Gruber wrote:
WElcome in my club. The club of broken UEFI.


Code:
[   21.686899] ACPI Warning: \_SB.PCI0.PEG0.GFX0._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20160831/nsarguments-95)


AFter many bugs.kernel.org requests, providing info, a few of my special keys are working. I have one hint on how to maybe fix the remaining keys, when I have more time coding the DSDT file. kernel devs are not very motivated to fix those aCPI bugs. i did solve the biggest piece myself, and got a few keys working after a year thinking about it regularly, how to get it done.


You should check if some special keys are not working. Like backlight, wifi rfkill, keyboard backlight, mute, volume up / down, touchpad toggle, display toggle and such ... check also if suspend and such works,

Sucks to hear you have so much trouble with your Asus machine. On my notebook all special keys are working except for brightness+/-, wifi switch and Aeroplane mode.

saboya wrote:
2 - Backlight control keys: 'acpi_osi= ' in the kernel command line.

Tried this, didn't work and removed the brightness functionality from Gnome. So I removed that kernel command since Gnome is my only way of changing brightness.
Roman_Gruber wrote:
its some sort of abuse / dirty hack
I guess it's a good thing i removed it then. :roll:

saboya wrote:
You're probably right, I have no idea why it works or not, I just want it to work for now :) If you can point me to the right direction, maybe I can help debugging this and trying to solve it the correct way.

Roman_Gruber, i feel the same as saboya. Please let me know if I can help. Getting the fn keys to work is not a high priority, but it would be nice. :)

I already tried capturing the fn+F# key events with xev and then remapping them with xmodmap to xbacklight. But unfortunately xev notices nothing, which leads me to believe you might be correct about UEFI/Hardware handling these events.
Back to top
View user's profile Send private message
corin
n00b
n00b


Joined: 26 Jul 2017
Posts: 16

PostPosted: Wed Jan 23, 2019 3:52 am    Post subject: Reply with quote

I would just like to note that the x11-drivers/xf86-video-intel package will build the intel-virtual-output tool when the tools useflag is enabled. :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum