Гибридная графика amd linux

Hybrid graphics

Hybrid-graphics is a concept involving two graphics cards on same computer. Laptop manufacturers have developed new technologies involving two graphic cards with different abilities and power consumptions on a single computer. Hybrid-graphics has been developed to support both high performance and power saving use cases.

There are a variety of technologies and each manufacturer developed its own solution to this problem. This technology is well supported on Windows but it’s still quite experimental with Linux distributions. Here we try to explain a little about each approach and describe some community solutions to the lack of GNU/Linux systems support.

Contents

First Generation Hybrid Model (Basic Switching)

This section is being considered for removal.

The first generation of notebooks with hybrid graphics follow an approach that involves a two graphic card setup with a hardware multiplexer (MUX). It allows power save and low-end 3D rendering by using an Integrated Graphics Processor (IGP) or a major power consumption with 3D rendering performance using a Dedicated/Discrete Graphics Processor (DGP). This model makes the user choose (at boot time or at login time) between the two power/graphics profiles and is almost fixed throughout the user session. The switch is done in a workflow similar to the following:

  • Turn off the display
  • Turn on the DGP
  • Switch the multiplexer
  • Turn off the IGP
  • Turn the display on again

This switch is somewhat rough and adds some blinks and black screens in laptops that could do it «on the fly». Later approaches made the transition a little more user-friendly.

Dynamic Switching Model

Most of the new Hybrid-graphics technologies involve two graphic cards as the basic switching but now the DGP and IGP are plugged to a framebuffer and there is no hardware multiplexer. The IGP is always on and the DGP is switched on/off when there is a need in power-save or performance-rendering. In most cases there is no way to use only the DGP and all the switching and rendering is controlled by software. At startup, the Linux kernel starts using a video mode and setting up low-level graphic drivers which will be used by the applications. Most of the Linux distributions then use X.org to create a graphical environment. Finally, a few other softwares are launched, first a login manager and then a window manager, and so on. This hierarchical system has been designed to be used in most of cases on a single graphic card.

Fully Power Down Discrete GPU

You may want to turn off the high-performance graphics processor to save battery power.

Using bbswitch

With an NVidia GPU, this can be more safely done using bbswitch, which consists of a kernel package that automatically issues the correct ACPI calls to disable the discrete GPU when not needed, or automatically at boot.

Using acpi_call

Otherwise, and for GPUs not supported by bbswitch, the same can be done manually installing the acpi_call package.

Once installed load the kernel module:

With the kernel module loaded, execute the script at /usr/share/acpi_call/examples/turn_off_gpu.sh

The script will go through all the known data buses and attempt to turn them off. You will get an output similar to the following:

See the «works»? This means the script found a bus which your GPU sits on and it has now turned off the chip. To confirm this, your battery time remaining should have increased.

Turning off the GPU automatically

Currently, the chip will turn back on with the next reboot. To get around this, add the kernel module to the array of modules to load at boot:

At boot

To turn off the GPU at boot it is possible to use systemd-tmpfiles.

The above config will be loaded at boot by systemd. What it does is write the specific OFF signal to the /proc/acpi/call file. Obviously, replace the \_SB.PCI0.PEG0.PEGP._OFF with the one which works on your system (please note that you need to escape the backslash).

After X server initialization

On some systems, turning off the discrete GPU before the X server is initialized may hang the system. In such cases, it may be better to disable the GPU after X server initialization, which is possible with some display managers. In LightDM, for instance, the display-setup-script seat configuration parameter could be used to execute a script as root that disables the GPU.

Читайте также:  Тестирование процессора windows 10

System76

Some System76 laptops (like the Oryx Pro) have their own unique hybrid graphics option. To make use of it, install system76-power AUR , enable the system76-power service, and run system76-power graphics hybrid .

Источник

Гибридная графика amd linux

This article covers the radeon open source driver which supports the majority of AMD (previously ATI) GPUs.

Contents

Selecting the right driver

Depending on the card you have, find the right driver in Xorg#AMD. This page has instructions for ATI.

If unsure, try this open source driver first, it will suit most needs and is generally less problematic. See the feature matrix to know what is supported and the decoder ring to translate marketing names (e.g. Radeon HD4330) to chip names (e.g. R700).

Installation

Install the mesa package, which provides the DRI driver for 3D acceleration.

  • For 32-bit application support, also install the lib32-mesa package from the multilib repostory.
  • For the DDX driver (which provides 2D acceleration in Xorg), install the xf86-video-ati package.

Loading

The radeon kernel module should load fine automatically on system boot.

If it does not happen, then:

  • Make sure you do not have nomodeset or vga= as a kernel parameter, since radeon requires KMS.
  • Also, check that you have not disabled radeon by using any kernel module blacklisting.

Enable early KMS

Xorg configuration

Xorg will automatically load the driver and it will use your monitor’s EDID to set the native resolution. Configuration is only required for tuning the driver.

If you want manual configuration, create /etc/X11/xorg.conf.d/20-radeon.conf , and add the following:

Using this section, you can enable features and tweak the driver settings.

Performance tuning

Enabling video acceleration

Graphical tools

  • WattmanGTK — A GTK3 user-interface written in Python 3, which allows you to view, monitor Radeon performance, fan speeds and power states and the ability to overclock the graphics processor. It uses the AMDGPU kernel driver.

https://github.com/BoukeHaarsma23/WattmanGTK || wattman-gtk-gitAUR

  • radeon-profile — Qt application for displaying info about a Radeon card.

https://github.com/marazmista/radeon-profile || radeon-profile-gitAUR

Driver options

The following options apply to /etc/X11/xorg.conf.d/20-radeon.conf .

Please read radeon(4) and RadeonFeature first before applying driver options.

Acceleration architecture; Glamor is available as a 2D acceleration method implemented through OpenGL, and it is the default for R600 (Radeon HD2000 series) and newer graphic cards. Older cards use EXA.

DRI3 is enabled by default since xf86-video-ati 7.8.0. For older drivers, which use DRI2 by default, switch to DRI3 with the following option:

TearFree is a tearing prevention option which prevents tearing by using the hardware page flipping mechanism:

ColorTiling and ColorTiling2D are supposed to be enabled by default. Tiled mode can provide significant performance benefits with 3D applications. It is disabled if the DRM module is too old or if the current display configuration does not support it. KMS ColorTiling2D is only supported on R600 (Radeon HD2000 series) and newer chips:

When using Glamor as acceleration architecture, it is possible to enable the ShadowPrimary option, which enables a so-called «shadow primary» buffer for fast CPU access to pixel data, and separate scanout buffers for each display controller (CRTC). This may improve performance for some 2D workloads, potentially at the expense of other (e.g. 3D, video) workloads. Note that enabling this option currently disables Option «EnablePageFlip»:

EXAVSync is only available when using EXA and can be enabled to avoid tearing by stalling the engine until the display controller has passed the destination region. It reduces tearing at the cost of performance and has been known to cause instability on some chips:

Below is a sample configuration file of /etc/X11/xorg.conf.d/20-radeon.conf :

Kernel parameters

Defining the gartsize, if not autodetected, can be done by adding radeon.gartsize=32 as a kernel parameter.

The changes take effect at the next reboot.

Deactivating PCIe 2.0

Since kernel 3.6, PCI Express 2.0 in radeon is turned on by default.

It may be unstable with some motherboards. It can be deactivated by adding radeon.pcie_gen2=0 as a kernel parameter.

See Phoronix article for more information.

Gallium Heads-Up Display

The radeon driver supports the activation of a heads-up display (HUD) which can draw transparent graphs and text on top of applications that are rendering, such as games. These can show values such as the current frame rate or the CPU load for each CPU core or an average of all of them. The HUD is controlled by the GALLIUM_HUD environment variable, and can be passed the following list of parameters among others:

  • «fps» — displays current frames per second
  • «cpu» — displays the average CPU load
  • «cpu0» — displays the CPU load for the first CPU core
  • «cpu0+cpu1» — displays the CPU load for the first two CPU cores
  • «draw-calls» — displays how many times each material in an object is drawn to the screen
  • «requested-VRAM» — displays how much VRAM is being used on the GPU
  • «pixels-rendered» — displays how many pixels are being displayed

To see a full list of parameters, as well as some notes on operating GALLIUM_HUD, you can also pass the «help» parameter to a simple application such as glxgears and see the corresponding terminal output:

More information can be found from this mailing list post or this blog post.

Читайте также:  Happy new year windows

Hybrid graphics/AMD Dynamic Switchable Graphics

It is the technology used on recent laptops equiped with two GPUs, one power-efficent (generally Intel integrated card) and one more powerful and more power-hungry (generally Radeon or Nvidia). There are two ways to get it work:

  • If it is not required to run ‘GPU-hungry’ applications, it is possible to disable the discrete card (see Ubuntu wiki): echo OFF > /sys/kernel/debug/vgaswitcheroo/switch .
  • PRIME: Is a proper way to use hybrid graphics on Linux, but still requires a bit of manual intervention from the user.

Powersaving

With the radeon driver, power saving is disabled by default and has to be enabled manually if desired.

You can choose between three different methods:

Dynamic power management

Since kernel 3.13, DPM is enabled by default for lots of AMD Radeon hardware. If you want to disable it, add the parameter radeon.dpm=0 to the kernel parameters.

Unlike dynpm, the «dpm» method uses hardware on the GPU to dynamically change the clocks and voltage based on GPU load. It also enables clock and power gating.

There are 3 operation modes to choose from:

  • battery lowest power consumption
  • balanced sane default
  • performance highest performance

They can be changed via sysfs:

For testing or debugging purposes, you can force the card to run in a set performance mode:

  • auto default; uses all levels in the power state
  • low enforces the lowest performance level
  • high enforces the highest performance level

Commandline Tools

  • radcard — A script to get and set DPM power states and levels

Old methods

Dynamic frequency switching

This method dynamically changes the frequency depending on GPU load, so performance is ramped up when running GPU intensive apps, and ramped down when the GPU is idle. The re-clocking is attempted during vertical blanking periods, but due to the timing of the re-clocking functions, does not always complete in the blanking period, which can lead to flicker in the display. Due to this, dynpm only works when a single head is active.

It can be activated by simply running the following command:

Profile-based frequency switching

This method will allow you to select one of the five profiles (described below). Different profiles, for the most part, end up changing the frequency/voltage of the GPU. This method is not as aggressive, but is more stable and flicker free and works with multiple heads active.

To activate the method, run the following command:

Select one of the available profiles:

  • default uses the default clocks and does not change the power state. This is the default behaviour.
  • auto selects between mid and high power states based on the whether the system is on battery power or not.
  • low forces the gpu to be in the low power state all the time. Note that low can cause display problems on some laptops, which is why auto only uses low when monitors are off. Selected on other profiles when the monitors are in the DPMS-off state.
  • mid forces the gpu to be in the mid power state all the time.
  • high forces the gpu to be in the high power state all the time.

As an example, we will activate the low profile (replace low with any of the aforementioned profiles as necessary):

Persistent configuration

The methods described above are not persistent. To make them persistent, you may create a udev rule (example for #Profile-based frequency switching):

As another example, dynamic power management can be permanently forced to a certain performance level:

To determine the KERNEL name execute:

Other notes

To view the speed that the GPU is running at, perform the following command and you will get something like this output:

It depends on which GPU line yours is, however. Along with the radeon driver versions, kernel versions, etc. So it may not have much/any voltage regulation at all.

Thermal sensors are implemented via external i2c chips or via the internal thermal sensor (rv6xx-evergreen only). To get the temperature on asics that use i2c chips, you need to load the appropriate hwmon driver for the sensor used on your board (lm63, lm64, etc.). The drm will attempt to load the appropriate hwmon driver. On boards that use the internal thermal sensor, the drm will set up the hwmon interface automatically. When the appropriate driver is loaded, the temperatures can be accessed via lm_sensors tools or via sysfs in /sys/class/hwmon .

Fan Speed

While the power saving features above should handle fan speeds quite well, some cards may still be too noisy in their idle state. In this case, and when your card supports it, you can change the fan speed manually.

To control the GPU fan, see Fan speed control#AMDGPU sysfs fan control (amdgpu and radeon share the same controls for this).

For persistence, see the example in #Persistent configuration.

If a fixed value is not desired, there are possibilities to define a custom fan curve manually by, for example, writing a script in which fan speeds are set depending on the current temperature (current value in /sys/class/drm/card0/device/hwmon/hwmon0/temp1_input ).

A GUI solution is available by installing radeon-profile-git AUR .

TV out

First, check that you have an S-video output: xrandr should give you something like

Читайте также:  Линукс дистрибутивы что это такое

Now we should tell Xorg that it is actually connected (it is, right?)

Setting TV standard to use:

Adding a mode for it (currently supports only 800×600):

Now let us try to see what we have:

At this point you should see a 800×600 version of your desktop on your TV.

To disable the output, do

Force TV-out in KMS

The kernel can recognize video= parameter in following form (see KMS for more details):

Parameters with whitespaces must be quoted:

Current mkinitcpio implementation also requires # in front. For example:

  • GRUB Legacy can pass such command line as is.
  • LILO needs backslashes for doublequotes (append # \»video=9-pin DIN-1:1024×768-24@60e\» )

You can get list of your video outputs with following command:

HDMI audio

HDMI audio is supported in the xf86-video-ati video driver. To disable HDMI audio add radeon.audio=0 to your kernel parameters.

If there is no video after boot up, the driver option has to be disabled.

Multihead setup

Using the RandR extension

See Multihead#RandR how to setup multiple monitors by using RandR.

Independent X screens

Independent dual-headed setups can be configured the usual way. However you might want to know that the radeon driver has a «ZaphodHeads» option which allows you to bind a specific device section to an output of your choice:

This can be a life-saver, when using videocards that have more than two outputs. For instance one HDMI out, one DVI, one VGA, will only select and use HDMI+DVI outputs for the dual-head setup, unless you explicitly specify «ZaphodHeads» «VGA-0» .

Turn vsync off

The radeon driver will probably enable vsync by default, which is perfectly fine except for benchmarking. To turn it off try the vblank_mode=0 environment variable or create

/.drirc (edit it if it already exists) and add the following:

If vsync is still enabled, you can disable it by editing /etc/X11/xorg.conf.d/20-radeon.conf . See #Driver options.

Troubleshooting

Performance and/or artifacts issues when using EXA

If having 2D performance issues, like slow scrolling in a terminal or webbrowser, adding Option «MigrationHeuristic» «greedy» as device option may solve the issue.

In addition disabling EXAPixmaps may solve artifacts issues, although this is generally not recommended and may cause other issues.

Adding undetected/unsupported resolutions

TV showing a black border around the screen

When connecting a TV using the HDMI port, the TV may show a blurry picture with a 2-3cm border around it. This protects against overscanning (see Wikipedia:Overscan), but can be turned off using xrandr:

Black screen and no console, but X works in KMS

This is a solution to the no-console problem that might come up, when using two or more ATI cards on the same PC. Fujitsu Siemens Amilo PA 3553 laptop for example has this problem. This is due to fbcon console driver mapping itself to the wrong framebuffer device that exists on the wrong card. This can be fixed by adding this to the kernel boot line:

This will tell the fbcon to map itself to the /dev/fb1 framebuffer dev and not the /dev/fb0 , that in our case exists on the wrong graphics card. If that does not fix your problem, try booting with

ATI X1600 (RV530 series) 3D application show black windows

There are three possible solutions:

  • Try adding pci=nomsi to your boot loader Kernel parameters.
  • If this does not work, you can try adding noapic instead of pci=nomsi .
  • If none of the above work, then you can try running vblank_mode=0 glxgears or vblank_mode=1 glxgears to see which one works for you, then install driconfAUR and set that option in

Cursor corruption after coming out of sleep

If the cursor becomes corrupted like it’s repeating itself vertically after the monitor(s) comes out of sleep, set «SWCursor» «True» in the «Device» section of the /etc/X11/xorg.conf.d/20-radeon.conf configuration file.

DisplayPort stays black on multimonitor mode

Try booting with the kernel parameter radeon.audio=0 .

R9-390 Poor Performance and/or Instability

Firmware issues with R9-390 series cards include poor performance and crashes (frequently caused by gaming or using Google Maps) possibly related DPM. Comment 115 of this bug report includes instructions for a fix.

QHD / UHD / 4k support over HDMI for older Radeon cards

Older cards have their pixel clock limited to 165MHz for HDMI. Hence, they do not support QHD or 4k only via dual-link DVI but not over HDMI.

One possibility to work around this is to use custom modes with lower refresh rate, e.g. 30Hz.

Another one is a kernel patch removing the pixel clock limit, but this may damage the card!

The patch introduces a new kernel parameter radeon.hdmimhz which alters the pixel clock limit.

Be sure to use a high speed HDMI cable for this.

Horizontal flickering occasionally when using 4k DP output on 390X

If you use 390X (or perhaps similar models) and the 4k output from DP, you may experiencing occasional horizontal artifacts / flickering. It’s like every half an hour or so, a horizontal strip of pixels (with a height of

100 pixels and runs across the whole screen’s width) shaking up and down for a few seconds. This might be a bug of radeon driver. Changing to AMDGPU seems to fix it.

See also

Benchmark showing the open source driver is on par performance-wise with the proprietary driver for many cards.

Источник

Оцените статью