Difference between revisions of "HOWTO: Get AMD/ATI or Nvidia Video Cards working in Sabayon"

From Sabayon Wiki
Jump to: navigation, search
m (removed portage use, replaced with entropy for llvm.)
m (TEAM RED - AMD)
 
(20 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
{{Warning| '''SUPPORTED AMD HARDWARE'''
 
{{Warning| '''SUPPORTED AMD HARDWARE'''
FGLRX is currently being deprecated. AMDGPU is the new platform. Devices not supported by AMDGPU will be supported by radeon. AMDGPU-PRO is in BETA and currently only supported on .deb and .rpm distributions during the BETA.  
+
FGLRX is currently deprecated. AMDGPU is the new platform. Devices not supported by AMDGPU will be supported by radeon. AMDGPU-PRO is currently only supported on .deb and .rpm distributions.  
 
}}
 
}}
  
Line 88: Line 88:
 
= <span style="color:RED">TEAM RED - AMD</span> =
 
= <span style="color:RED">TEAM RED - AMD</span> =
  
==FGLRX to Open Source (radeon or AMDGPU)==
+
=='''FGLRX to Open Source (radeon or AMDGPU)'''==
  
 
{{Note| '''SED'''
 
{{Note| '''SED'''
Line 132: Line 132:
  
  
== AMDGPU w/Display Code <span sytle="color:red">*EXPERIMENTAL!*</span> ==
+
== '''AMDGPU w/Display Code *EXPERIMENTAL!*''' ==
  
  
So first you'll want to be aware you're going to be adding a couple community repositories for packages. One repository will be using -9999 packages for MESA, LIBDRM, and (hopefully soon) LLVM.
+
So first you'll want to be aware you're going to be adding a couple community repositories for packages. One repository will be using -9999 packages for MESA, LIBDRM, and LLVM.
You'll also want to be aware that you should still keep your current kernel in case anything goes wrong. That will allow you to continue booting into your system from the advanced options in GRUB by selecting the older kernel.
+
You'll also want to be aware that you should still keep your current kernel in case anything goes wrong. That will allow you to continue booting into your system from the advanced options in GRUB by selecting the older kernel. This newer kernel and experimental packages will not be supported.
  
{{Warning| '''AMD Display Code is not mainline!'''
+
{{Warning| '''Not all AMD Display Code is not mainline!'''
This is all incomplete code that has yet not been adopted into the mainline kernel. Results may vary and this may not be the same as the finalized versions of code.
+
This contains incomplete code that has yet not been adopted into the mainline kernel. Results may vary and this may not be the same as the finalized versions of code.
 
}}
 
}}
  
  
Lets get started!
+
Lets get started with prep work!
 
{{Console| <pre class="clear">
 
{{Console| <pre class="clear">
 
localhost root # equo update; equo upgrade
 
localhost root # equo update; equo upgrade
Line 149: Line 149:
 
localhost root # enman add gaming-live
 
localhost root # enman add gaming-live
 
localhost root # enman add community
 
localhost root # enman add community
 +
localhost root # equo update; equo upgrade
 
localhost root # echo "media-libs/mesa-9999" >> /etc/entropy/packages/package.unmask
 
localhost root # echo "media-libs/mesa-9999" >> /etc/entropy/packages/package.unmask
 
localhost root # echo "x11-libs/libdrm-9999" >> /etc/entropy/packages/package.unmask
 
localhost root # echo "x11-libs/libdrm-9999" >> /etc/entropy/packages/package.unmask
 
localhost root # echo "sys-devel/llvm-9999" >> /etc/entropy/packages/package.unmask
 
localhost root # echo "sys-devel/llvm-9999" >> /etc/entropy/packages/package.unmask
localhost root # equo update
 
 
localhost root # equo install v86d bison make cmake automake gcc genkernel-next git dev-python/sphinx re2c dev-util/ninja sys-devel/llvm-9999 x11-libs/libdrm-9999 media-libs/mesa-9999
 
localhost root # equo install v86d bison make cmake automake gcc genkernel-next git dev-python/sphinx re2c dev-util/ninja sys-devel/llvm-9999 x11-libs/libdrm-9999 media-libs/mesa-9999
localhost root # equo upgrade
 
localhost root # git clone -b amd-staging-drm-next git://people.freedesktop.org/~agd5f/linux   
 
localhost root # mv linux /usr/src/linux-4.13.0-amdgpu
 
localhost root # cd /usr/src
 
localhost root # rm -rf linux
 
localhost root # ln -s linux-4.13.0-amdgpu/ linux
 
localhost root # cd linux
 
 
</pre>}}
 
</pre>}}
  
  
Now to add a small patch that hasn't made it to the source yet as of 25.09.2017. source: https://lists.freedesktop.org/archives/amd-gfx/2017-September/013326.html
+
Now lets download a kernel with display code.
 
 
  
 
{{Console| <pre class="clear">
 
{{Console| <pre class="clear">
localhost root # sed -i "s/(adev, 64, 4)/(adev, 64, 9)/" drivers/gpu/drm/amd/amdgpu/gmc_v{6..8}_0.c
+
localhost root # git clone -b amd-staging-drm-next --depth=1 git://people.freedesktop.org/~agd5f/linux   
 +
localhost root # mv linux /usr/src/linux-4.17.0-amdgpu
 +
localhost root # cd /usr/src
 +
localhost root # rm -rf linux
 +
localhost root # ln -s linux-4.17.0-amdgpu/ linux
 +
localhost root # cd linux
 
</pre>}}
 
</pre>}}
  
Line 174: Line 171:
 
Now we finish configuring and building the kernel. Now's you chance to make any other config changes you want. If you use lvm add the --lvm flag to the genkernel command.
 
Now we finish configuring and building the kernel. Now's you chance to make any other config changes you want. If you use lvm add the --lvm flag to the genkernel command.
 
You can also double check Device Drivers -> Graphics Support -> Display Engine Configuration -> AMD DC is enabled as well as Raven family if you plan on owning an APU based on Raven.
 
You can also double check Device Drivers -> Graphics Support -> Display Engine Configuration -> AMD DC is enabled as well as Raven family if you plan on owning an APU based on Raven.
 
  
 
{{Console| <pre class="clear">
 
{{Console| <pre class="clear">
Line 183: Line 179:
 
localhost root # grub2-mkconfig -o /boot/grub/grub.cfg  
 
localhost root # grub2-mkconfig -o /boot/grub/grub.cfg  
 
</pre>}}
 
</pre>}}
 +
 +
 +
You can watch the git repo for updates/fixes/changes etc at https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next to decide if you want to update the kernel again. If you do this, none of the sed commands are necessary for the config as /proc/config.gz will already have the updated config changes.
  
 
= <span style="color:green">TEAM GREEN - NVIDIA</span> =
 
= <span style="color:green">TEAM GREEN - NVIDIA</span> =
If for some reason you don't have proprietary Nvidia drivers installed and you want them, there are simple steps to follow.
 
  
== Available driver version ==
+
== Booting live/installer disc with vesa graphics on older GPUs ==
 +
Can't seem to get the GUI on the installer disc and seem stuck at a black screen or terminal? We've got you covered. When selecting an option from the boot screen
 +
edit the boot line and include the following at the end of the line.
 +
 
 +
{{Console| <pre class="clear">modprobe.blacklist=nvidia xdriver=vesa</pre>}}
 +
 
 +
This should get you into the live session to perform an install. Afterwards, you'll need to either switch to Nouveau or a proprietary driver version that supports your card.
 +
 
 +
=='''Proprietary'''==
 +
Sabayon should already come with the latest nvidia-drivers, but if for some reason you don't have correct proprietary Nvidia drivers installed
 +
there are simple steps to follow.
 +
 
 +
=== Prepare if returning from nouveau ===
 +
Because we use the proprietary drivers by default, the opensource driver is usually already blacklisted; but if you switched to the opensource driver and are
 +
returning to the proprietary offerings, you must first blacklist the opensource driver.
 +
 
 +
{{Console| <pre class="clear">localhost root # sed -i s/'#blacklist nouveau'/'blacklist nouveau'/ /etc/modprobe.d/blacklist.conf </pre>}}
 +
 
 +
=== Available driver version ===
  
 
To get a list of all drivers for all kernels that are available:
 
To get a list of all drivers for all kernels that are available:
Line 195: Line 211:
 
{{Console| <pre class="clear">$ equo search -qv nvidia-drivers#$(uname -r)</pre>}}
 
{{Console| <pre class="clear">$ equo search -qv nvidia-drivers#$(uname -r)</pre>}}
  
== Installation  ==
 
Knowing what driver version you want to install (usually the newest, i.e. highest number version, it may differ if you have old card that needs older drivers):
 
 
=== Newest drivers for currently running kernel ===
 
=== Newest drivers for currently running kernel ===
 
{{Console| <pre class="clear">localhost root # equo install --ask nvidia-driver#$(uname -r) nvidia-userspace</pre>}}
 
{{Console| <pre class="clear">localhost root # equo install --ask nvidia-driver#$(uname -r) nvidia-userspace</pre>}}
Line 202: Line 216:
  
 
=== Older drivers for currently running kernel ===
 
=== Older drivers for currently running kernel ===
 +
{{Note| '''Not supported or Guaranteed'''
 +
It has been noticed that depending on the old GPU or GPU drivers version, they may or may not work. This seems pretty hit and miss.
 +
Mobile GPUs and non-discrete GPUs (integrated in the motherboard) appear to be affected by this. If you're using an GPU older than
 +
Fermi or an integrated GPU, we recommend using the open source nouveau driver.
 +
}}
 +
 
List Nvidia drivers for your current kernel (insturctions above), and install it along with corresponding '''nvidia-userspace''', e.g.:
 
List Nvidia drivers for your current kernel (insturctions above), and install it along with corresponding '''nvidia-userspace''', e.g.:
{{Console| <pre class="clear">localhost root # equo install --ask nvidia-drivers-304.108#$(uname -r) nvidia-drivers-304.108</pre>}}
+
{{Console| <pre class="clear">localhost root # equo install --ask nvidia-drivers-340.104#$(uname -r) nvidia-drivers-340.104</pre>}}
 +
 
 +
now lets switch from opensource opengl libraries to proprietary nvidia opengl libraries
 +
 
 +
{{Console| <pre class="clear">localhost root # eselect opengl set nvidia</pre>}}
  
== Block nouveau driver ==
+
=='''Open Source - Switching to Nouveau drivers'''==
For Nvidia drivers to work properly nouveau can't be loaded. Thus, it must be blocked.
+
If Sabayon is installed you reboot and you find you're stuck at a login terminal or just wan to switch to open source drivers, this is a simple fix.  
 +
Just login with your user you created. Then we'll remove the proprietary drivers and the blacklist for nouveau using the following:
  
{{Console| <pre class="clear">localhost root # echo blacklist nouveau >> /etc/modprobe.d/blacklist.conf </pre>}}
+
=== Unblock nouveau driver ===
 +
Because we use the proprietary drivers by default, the opensource driver is blacklisted. You must first unblock the driver from being loaded.
 +
 
 +
{{Console| <pre class="clear">localhost root # sed -i s/'blacklist nouveau'/'#blacklist nouveau'/ /etc/modprobe.d/blacklist.conf </pre>}}
 +
 
 +
You still must block or remove the proprietary driver. Now that both drivers have the ability to load, it will most likely lock up the machine
 +
on boot or cause instability. Both drivers cannot be loaded at the same time.
 +
 
 +
=== Removal of proprietary driver ===
 +
You can blacklist the nvidia drivers OR remove them entirely. Removal is the simplest method.
 +
 
 +
{{Console| <pre class="clear">localhost root # equo update; equo remove nvidia-drivers nvidia-userspace</pre>}}
 +
 
 +
Now lets make sure we're using the correct opengl libraries
 +
 
 +
{{Console| <pre class="clear">localhost root # eselect opengl set xorg-x11</pre>}}
 +
 
 +
Now reboot and you'll be using nouveau. If you ever feel like returning to proprietary drivers, you'll need to blacklist nouveau again. then
  
== Set Nvidia drivers as active ==
 
{{Console| <pre class="clear">localhost root # eselect opengl set nvidia</pre>}}
 
  
 
[[Category:Graphics|Get Ati or Nvidia Video Cards working in Sabayon]]
 
[[Category:Graphics|Get Ati or Nvidia Video Cards working in Sabayon]]

Latest revision as of 03:13, 3 March 2018

i18n: en pl


Stop.png
SUPPORTED AMD HARDWARE

FGLRX is currently deprecated. AMDGPU is the new platform. Devices not supported by AMDGPU will be supported by radeon. AMDGPU-PRO is currently only supported on .deb and .rpm distributions.

Kernel Upgrade (optional)

Repository Database Update

First things first! Update the database to make sure we have the most up to date package available! This will give us the most recent list of kernels and drivers.

[email protected] ~ $ su
localhost root # equo update

Method 1 (kernel-switcher tool)

This method should automagically install the corresponding driver updates and addons such as the zfs mod.


Lets see what is available!

localhost root # kernel-switcher list

Find a kernel you wish to use, and switch!

localhost root # kernel-switcher switch linux-sabayon-4.1.7

Method 2 (Manual)

This method isn't better or worse than kernel-switcher. It just allows you to know exactly whats going on, what you are doing, and what is changing. This method doesn't automagically upgrade drivers or install addons such as virtualbox addons or the zfs mod.

localhost root # equo install sys-kernel/linux-sabayon
localhost root # equo install sys-kernel/sabayon-sources


Now use eselect to set the soft links(shortcuts) to the proper libraries and files. eselect allows us to keep different libraries so we can switch without damaging the system by replacing important files.

First off we need to know which is our new kernel and bzimage

localhost root # eselect bzimage list
localhost root # eselect kernel list


You should get something like this...

localhost root # eselect bzimage list
Available kernel targets:
  [1]   kernel-genkernel-x86_64-3.13.0-sabayon *
  [2]   kernel-genkernel-x86_64-4.1.0-sabayon
localhost root # eselect kernel list
Available kernel symlink targets:
  [1]   linux-3.13.0-sabayon
  [2]   linux-4.1.0-sabayon *
localhost root # 


Now select the newer bzimage and kernel.

localhost root # eselect bzimage set 2
localhost root # eselect kernel set 2


Once your new kernel is installed reboot!

Clean (optional)

Once you have everything working you can remove the old kernel if you like. MAKE SURE YOU SELECT THE CORRECT KERNEL! Look using "equo search linux-sabayon" then copy and paste!

[email protected] ~ $ su
localhost root # equo remove sys-kernel/linux-sabayon-3.13.11

TEAM RED - AMD

FGLRX to Open Source (radeon or AMDGPU)

Question.png
SED

In these instructions you'll notice the sed command. This may make some people leary as not everyone understands this command. "sed" stands for "stream editor". It can edit the edit file for you by substituting lines, words, strings, etc. In this case we are using it to remove a line in blacklist.conf and nomodeset command in grub config files.

If you don't feel fully comfortable about this command. Back up your file or use nano (vi etc.) to edit the file!


"Why" you ask? Besides the drivers not quickly supporting new Kernel releases, Open Source drivers are getting better all the time and AMD has announced plans to open source as much as possible. The majority of the drivers will be opensource while proprietary features will remain in a kernel agnostic binary blob. If you want to go full opensource, then the driver will hook into mesa for all rendering etc. If you want proprietary features, the same driver hooks into a binary blob. Same driver, different options. AMDGPU-PRO will basically be a full install of the opensource driver, but with binaries included. Currently AMDGPU-PRO isn't available to Gentoo in this BETA phase.

[email protected] ~ $ su
localhost root # equo update
localhost root # equo remove ati-drivers ati-userspace amdcccle
localhost root # equo install xf86-video-ati xf86-video-amdgpu
localhost root # eselect opengl set xorg-x11
localhost root # sed -i 's/nomodeset//g' /etc/default/grub
localhost root # sed -i 's/nomodeset//g' /boot/grub/grub.cfg
localhost root # sed -i 's/"blacklist radeon"//g' /etc/modprobe.d/blacklist.conf
localhost root # rm -rf /etc/X11/xorg.conf

Newer versions of X11 do not require an xorg.conf file. If any special settings are required or wanted you can apply an override in /etc/X11/xorg.conf.d/

localhost root # vi /etc/X11/xorg.conf.d/30-Devices.conf

Now we can add typical xorg.conf configurations for the devices such as tearfree. This is typically for the more savvy.

Section "Device"
	Identifier	"Card0"
	Driver		"amdgpu"
	BusID		"PCI:1:0:0"
	Option		"TearFree"		"True"
	Option		"EnablePageFlip"	"True"
EndSection



AMDGPU w/Display Code *EXPERIMENTAL!*

So first you'll want to be aware you're going to be adding a couple community repositories for packages. One repository will be using -9999 packages for MESA, LIBDRM, and LLVM. You'll also want to be aware that you should still keep your current kernel in case anything goes wrong. That will allow you to continue booting into your system from the advanced options in GRUB by selecting the older kernel. This newer kernel and experimental packages will not be supported.

Stop.png
Not all AMD Display Code is not mainline!

This contains incomplete code that has yet not been adopted into the mainline kernel. Results may vary and this may not be the same as the finalized versions of code.


Lets get started with prep work!

localhost root # equo update; equo upgrade
localhost root # equo install enman
localhost root # enman add gaming-live
localhost root # enman add community
localhost root # equo update; equo upgrade
localhost root # echo "media-libs/mesa-9999" >> /etc/entropy/packages/package.unmask
localhost root # echo "x11-libs/libdrm-9999" >> /etc/entropy/packages/package.unmask
localhost root # echo "sys-devel/llvm-9999" >> /etc/entropy/packages/package.unmask
localhost root # equo install v86d bison make cmake automake gcc genkernel-next git dev-python/sphinx re2c dev-util/ninja sys-devel/llvm-9999 x11-libs/libdrm-9999 media-libs/mesa-9999


Now lets download a kernel with display code.

localhost root # git clone -b amd-staging-drm-next --depth=1 git://people.freedesktop.org/~agd5f/linux    
localhost root # mv linux /usr/src/linux-4.17.0-amdgpu
localhost root # cd /usr/src
localhost root # rm -rf linux
localhost root # ln -s linux-4.17.0-amdgpu/ linux
localhost root # cd linux


Now we finish configuring and building the kernel. Now's you chance to make any other config changes you want. If you use lvm add the --lvm flag to the genkernel command. You can also double check Device Drivers -> Graphics Support -> Display Engine Configuration -> AMD DC is enabled as well as Raven family if you plan on owning an APU based on Raven.

localhost root # zcat /proc/config.gz > /usr/src/config
localhost root # sed -i '5495 a CONFIG_DRM_AMD_DC=y' /usr/src/config
localhost root # sed -i '5496 a CONFIG_DRM_AMD_DC_DCN1_0=y' /usr/src/config
localhost root # genkernel --kernel-config=/usr/src/config --menuconfig --splash=sabayon --luks all
localhost root # grub2-mkconfig -o /boot/grub/grub.cfg 


You can watch the git repo for updates/fixes/changes etc at https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next to decide if you want to update the kernel again. If you do this, none of the sed commands are necessary for the config as /proc/config.gz will already have the updated config changes.

TEAM GREEN - NVIDIA

Booting live/installer disc with vesa graphics on older GPUs

Can't seem to get the GUI on the installer disc and seem stuck at a black screen or terminal? We've got you covered. When selecting an option from the boot screen edit the boot line and include the following at the end of the line.

modprobe.blacklist=nvidia xdriver=vesa

This should get you into the live session to perform an install. Afterwards, you'll need to either switch to Nouveau or a proprietary driver version that supports your card.

Proprietary

Sabayon should already come with the latest nvidia-drivers, but if for some reason you don't have correct proprietary Nvidia drivers installed there are simple steps to follow.

Prepare if returning from nouveau

Because we use the proprietary drivers by default, the opensource driver is usually already blacklisted; but if you switched to the opensource driver and are returning to the proprietary offerings, you must first blacklist the opensource driver.

localhost root # sed -i s/'#blacklist nouveau'/'blacklist nouveau'/ /etc/modprobe.d/blacklist.conf 

Available driver version

To get a list of all drivers for all kernels that are available:

$ equo search -qv nvidia-drivers

List of all drivers versions available for currently running kernel:

$ equo search -qv nvidia-drivers#$(uname -r)

Newest drivers for currently running kernel

localhost root # equo install --ask nvidia-driver#$(uname -r) nvidia-userspace

Will install newest driver available for currently running kernel.

Older drivers for currently running kernel

Question.png
Not supported or Guaranteed

It has been noticed that depending on the old GPU or GPU drivers version, they may or may not work. This seems pretty hit and miss. Mobile GPUs and non-discrete GPUs (integrated in the motherboard) appear to be affected by this. If you're using an GPU older than Fermi or an integrated GPU, we recommend using the open source nouveau driver.

List Nvidia drivers for your current kernel (insturctions above), and install it along with corresponding nvidia-userspace, e.g.:

localhost root # equo install --ask nvidia-drivers-340.104#$(uname -r) nvidia-drivers-340.104

now lets switch from opensource opengl libraries to proprietary nvidia opengl libraries

localhost root # eselect opengl set nvidia

Open Source - Switching to Nouveau drivers

If Sabayon is installed you reboot and you find you're stuck at a login terminal or just wan to switch to open source drivers, this is a simple fix. Just login with your user you created. Then we'll remove the proprietary drivers and the blacklist for nouveau using the following:

Unblock nouveau driver

Because we use the proprietary drivers by default, the opensource driver is blacklisted. You must first unblock the driver from being loaded.

localhost root # sed -i s/'blacklist nouveau'/'#blacklist nouveau'/ /etc/modprobe.d/blacklist.conf 

You still must block or remove the proprietary driver. Now that both drivers have the ability to load, it will most likely lock up the machine on boot or cause instability. Both drivers cannot be loaded at the same time.

Removal of proprietary driver

You can blacklist the nvidia drivers OR remove them entirely. Removal is the simplest method.

localhost root # equo update; equo remove nvidia-drivers nvidia-userspace

Now lets make sure we're using the correct opengl libraries

localhost root # eselect opengl set xorg-x11

Now reboot and you'll be using nouveau. If you ever feel like returning to proprietary drivers, you'll need to blacklist nouveau again. then