- Hybrid graphics
- Contents
- First Generation Hybrid Model (Basic Switching)
- Dynamic Switching Model
- Fully Power Down Discrete GPU
- Using bbswitch
- Using acpi_call
- System76
- Включение гибридной графики в Ubuntu на ноутбуках Nvidia + Intel (OpenGL, Vulkan)
- Введение
- 1. Устанавливаем драйвер
- 2. Настраиваем видеокарту
- 3. Запуск приложения с использованием дискретной графики
- Заключение
- Ubuntu Wiki
- HybridGraphics
- Hardware Requirements
- Software Requirements
- 12.04.3 — 12.04.5
- Installation
- 12.04.3 — 12.04.5
- Known issues
- Filing bugs
- Ubuntu Documentation
- Hybrid Graphics
- Introduction
- How to switch the GPU
- Enabling vga_switcheroo
- Using vga_switcheroo
- Script for use inside an X session
- Script for use during bootup
- acpi_call
- Installation
- How to use
- NVIDIA Optimus
- Various small fixes
- Fix fans running at full speed
- Fix brightness
- Fix Suspend/Wake Freezing
- Default GPU
- Console FB
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.
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 .
Источник
Включение гибридной графики в Ubuntu на ноутбуках Nvidia + Intel (OpenGL, Vulkan)
Введение
Это простая инструкция как включить гибридную графику intel-nvidia на ноутбуке. Чтобы определенные приложения запускались на дискретном чипе, а другие на встроенном. На свое удивление в интернете не нашел простую инструкцию того, как запускать определенные приложения, используя дискретную графику. Так что напишу так просто, на сколько считаю нужным
У меня система KDE Neon 5.21 — по большому счету — Ubuntu LTS с окружением рабочего стола KDE Plasma 5.21, видеочип GeForce MX150
1. Устанавливаем драйвер
a) Если у вас система на Qt (Как правило окружение KDE или LXQt), то с помощью данной команды через терминал загрузим программу для установки драйверов:
Если у вас система на GTK то с помощью это команды:
Хотя разницы принципиальной нет
b) Затем запускаем ее с правами root
Можно так же добавить ярлык для запуска в меню приложений
Инструкция для KDE
/.local/share/applications/ создадим файл software properties qt.desktop с таким содержанием
И файл software properties qt.sh в той же папке:
После перезагрузки ярлык появится в меню
Но это далеко не обязательно, вполне достаточно запустить из консоли для наших целей настройки гибридной графики
c) Переходим на последнюю вкладку Additional drivers и устанавливаем нужный драйвер. Я выбрал самой последней версии, который не tested и не server
d) После установки перезагружаем устройство
2. Настраиваем видеокарту
a) Загружаем следующую программу:
b) Переходим в PRIME Profiles Здесь мы видим три пункта:
NVIDIA (Performance Mode) — работать только на дискретной графике. Сильно потребляет батарею в несложных задачах, а так же ноутбук начинает греться. Зато система работает намного быстрее, но это того не стоит. У меня после установки драйвера этот пункт включился автоматически
NVIDIA On-Demand — некоторые приложения будут использовать дискретную графику nvidia, но по-умолчанию встроенная intel. Как запустить конкретное приложение с дискретной графикой напишу дальше
NVIDIA (Power Saving Mode) — отключение дискретной графики
Выбираем второй вариант — NVIDIA On-Demand , и перезагружаем систему
3. Запуск приложения с использованием дискретной графики
Это то, что сложнее всего гуглилось.
Для запуска приложения с использованием графики nvidia нужно задать для OpenGL две переменные среды:
для Vulkan только:
Делать это надо перед командой для запуска приложения. Например, нам нужно запустить из терминала приложение program с использованием дискретной графики. Нужно вызвать его так:
Соответственно, если у приложения есть ярлык (.desktop) в меню приложений, то надо изменить команду запуска в ярлыке. В KDE Plasma нужно нажать на него ПКМ, открыть свойства (или «изменить приложение. «), перейти во вкладку «приложение» и перед командой приписать данную приставку. В других средах похожего стола примерно так же
Пример: ярлык игры Wolfenstein — Blade of Agony
Можно сделать это же действие через текстовый редактор. Открываем ярлык, находим Exec= , и приписываем перед коммандой данную приставку __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia
Заключение
Данный метод, как я понял, точно работают для программ, использующих библиотеки OpenGL и Vulkan. У меня, к сожалению, не получилось запустить так Windows приложение через Wine, которое использует DirectX, но это уже совсем другая история. (OpenGL приложения под Wine работают)
Источник
Ubuntu Wiki
HybridGraphics
Some laptops come with two graphics cards: one for use in applications that require a lot of computing power such as games, called the discrete GPU, and one that is less powerful, but conserves energy, called the integrated GPU. The integrated GPU is often embedded in the CPU, hence the name. This concept is called Hybrid Graphics.
As per the discussions at UDS 1305, we have worked to officially support Hybrid graphics in Ubuntu 13.10 and in 12.04.3 LTS.
This enablement work builds upon NVIDIA’s work on PRIME and AMD’s work on PowerXpress.
Hardware Requirements
NVIDIA systems:
- A graphics card compatible with the NVIDIA driver 319 series or higher.
- An integrated Intel graphics card.
- A MUXless system with an Intel card and an NVIDIA discrete card.
AMD systems:
- A graphics card compatible with the fglrx driver 13.101 series or higher.
- An integrated Intel card.
- A MUXless system with an Intel or an AMD integrated card and an AMD discrete card.
Software Requirements
NVIDIA systems:
nvidia-331 or nvidia-331-updates
nvidia-prime (now a dependency of the nvidia packages)
AMD systems:
NVIDIA systems:
nvidia-319 or nvidia-319-updates
AMD systems:
fglrx 13.101 or higher
12.04.3 — 12.04.5
NVIDIA systems:
nvidia-319 or nvidia-319-updates
Raring’s backported kernel and X or higher
AMD systems:
Raring’s backported kernel and X or higher
Installation
NVIDIA systems:
Make sure that no other NVIDIA driver is installed (keep the nvidia-common package).
Install nvidia-331.
Reboot the system (restarting X won’t be enough).
NOTE: you can easily switch between GPUs from the Prime section of the nvidia-settings panel.
AMD systems:
- Make sure that no other fglrx driver is installed.
Install fglrx.
NVIDIA systems:
Make sure that no other NVIDIA driver is installed (keep the nvidia-common package).
Install nvidia-319 and nvidia-prime.
AMD systems:
- Make sure that no other fglrx driver is installed.
Install fglrx and fglrx-pxpress.
12.04.3 — 12.04.5
NVIDIA systems:
- Install one of the backported graphics stacks (e.g. either «linux-generic-lts-raring» and «xserver-xorg-lts-raring», or «linux-generic-lts-saucy» and «xserver-xorg-lts-saucy», or «linux-generic-lts-trusty» and «xserver-xorg-lts-trusty»)
Make sure that no other NVIDIA driver is installed (keep the nvidia-common package).
Install nvidia-319 (or nvidia-319-updates) and nvidia-prime.
AMD systems:
- Install one of the backported graphics stacks (e.g. either «linux-generic-lts-raring» and «xserver-xorg-lts-raring», or «linux-generic-lts-saucy» and «xserver-xorg-lts-saucy», or «linux-generic-lts-trusty» and «xserver-xorg-lts-trusty»)
- Make sure that no other fglrx driver is installed.
Install fglrx-experimental-13 and fglrx-pxpress.
Known issues
NVIDIA systems:
- You will experience screen tearing when moving windows around or watching videoclips.
Display hotplug won’t work and you will have to set up any external screens manually in your xorg.conf. [FIXED in 14.04]
Filing bugs
You can file bug reports against nvidia-prime for NVIDIA and fglrx-pxpress for AMD. No special tags are needed.
X/Config/HybridGraphics (последним исправлял пользователь albertomilone 2014-09-04 12:59:58)
The material on this wiki is available under a free license, see Copyright / License for details.
Источник
Ubuntu Documentation
Hybrid Graphics
Introduction
Some laptops come with two graphics cards: one for use in applications that require a lot of computing power such as games, called the discrete GPU, and one that is less powerful, but conserves energy, called the integrated GPU. The integrated GPU is often embedded in the CPU, hence the name. This concept is called Hybrid Graphics.
How to switch the GPU
The kernel shipped in Ubuntu 10.10 supports hybrid graphics by means of the vga_switcheroo flag. See vga_switcheroo below.
Enabling vga_switcheroo
vga_switcheroo is the kernel mechanism that allows you to switch between GPUs if your machine has a hardware mux. Note that this method is not supported by all machines and only works if you are using the opensource driver (nouveau, radeon) and not the proprietary ones (nvidia, fglrx).
To check whether your kernel is compiled with the proper option you can examine the file config-2.6.nn-mm-generic in the /boot directory:
this is an example of the result, with kernel version 4.1
If there is CONFIG_VGA_SWITCHEROO=y then what we need is there and we can proceed.
The vga_switcheroo mechanism will only be active when the kernel is booted with either the «modeset=1» kernel option, and/or the «nomodeset» option being absent.
These settings are stored in grub’s (the bootloader) own setting files in /etc/default/grub
Open that file with a text editor with root/admin privileges. This is a sample command line that opens the file with gedit text editor with root/admin privileges
In that text file there should be a
which must become
GRUB_CMDLINE_LINUX_DEFAULT=»quiet splash XXX.modeset=1″
where XXX = can be: «radeon» if you have a AMD/ATI card (most likely option since Intel and NVIDIA cards in dual-GPU notebooks have better ways of dealing with hybrid graphics, like bumblebee)
«noveau» for NVIDIA GPU
«i915» for Intel GPU
Then you need to write
to update boot parameters
and then reboot the PC.
To test if vga_switcheroo is enabled, look for the switch file:
Using vga_switcheroo
Once you’ve ensured that vga_switcheroo is available, you can use these options to switch between GPUs. Be prepared for a lockup (either immediately, or after a minute), the existence of this file does not mean that the machine is supported.
Allows you to verify the current state of the hybrid graphics. Typically, there will be two lines of output — one should indicate «Pwr» and the other should indicate «Off».
Turns on the GPU that is disconnected (not currently driving outputs), but does not switch outputs.
Connects integrated graphics with outputs.
Connects discrete graphics with outputs.
Turns off the graphics card that is currently disconnected.
There are also a couple of options that are useful from inside an X-Windows session:
Queues a switch to integrated graphics to occur when the X server is next restarted.
Queues a switch to discrete graphics to occur when the X server is next restarted.
Script for use inside an X session
Roberto Martinez has created a script which creates a graphical interface to switch between the graphics cards. He has released it over here. But you have to replace all the killall -u "$USER"" commands in his script with gnome-session-save --logout
To use this script, non-root users need permissions to write to /sys/kernel/debug/vgaswitcheroo/switch. If you run the script with sudo, it will just freeze the computer, since the script will then not end the current gnome session correctly.
To have permanent write permissions to the switch file, add the following line, replacing USERNAME with your username, to /etc/init.d/rc.local:
right before the «exit 0» line. This gives you exclusive permission to switch GPUs.
You can also assign this script a global hotkey using the keyboard shortcuts menu (System > Preferences > Keyboard Shortcuts). You’ll need to rename the script from Roberto Martinez to something without a .sh extension and place it into /usr/bin (as root) and make sure it is executable. Test it by running «switch_between_cards» without quotes from the terminal.
You may assign it any key combo you like so long as it’s not already defined (See Keyboard Shortcuts). Super + G or Ctrl + Alt + G work well.
Script for use during bootup
You may want to switch to a given graphics adapter during boot, for example to enable output for the GPU that Linux uses to query for passwords to decrypt the root volume (and other boot-time messages) or you may wish to instead disable one of the adapters during the boot process to conserve battery power.
There are currently no kernel options to control the vga_switcheroo mechanism, but here is an initramfs script that will accomplish the same task. Put that in a file named /etc/initramfs-tools/scripts/local-top/hybrid_boot_options:
Set it executable, and create new initramfs files with initramfs-tools:
or, if the command initramfs-tools doesn’t exist, use:
Now, you can add a command line to your kernel boot options in /etc/default/grub:
The above example enables both GPUs, switches to the integrated GPU, and finally turns off the discrete GPU.
Finally, the options needs to be actually applied to GRUB (since the above is just a template), which is done with grub-update:
And we’re done! You can also experiment with options during boot-time by pressing «e» in GRUB and adding/removing commands (separated by comma) from the «hybridopts=» option.
acpi_call
If you just want to have long battery life and slow temperature, you can use acpi_call: a linux kernel module that enables calls to ACPI. With acpi_call_GUI you can easily install and configure it via graphic interface.
It is a java program that allows you to:
- install the acpi_call kernel module (kernel would be recompiled automatically after each update);
- Deactivate discrete GPU;
- Automatically deactivate discrete GPU on every boot.
If you have enabled systemd, or if you’re using other linux distros that support it, you can use acpi_call_GUI_systemd.
Installation
Ensure that you have installed java and git, if not install these packages: git and openjdk-7-jre
After that open a terminal and type the following commands:
How to use
To launch acpi_call_GUI search it in yuor dash and click on the icon, or type in a terminal:
If you have a separate /home partition, you may need to use this command to launch acpi_call_GUI:
NVIDIA Optimus
vga_switcheroo is likely not going to work on these kind of machines. Most Optimus laptops do not have a hardware multiplexer. If you are lucky, you may find an option to disable the NVIDIA card for saving power or stick to the NVIDIA card for performance. See also How well do laptops with Nvidia Optimus work?
There are other methods to turn the device off and use the discrete video card. Such a method is called Bumblebee.
Various small fixes
Fix fans running at full speed
Roberto Martinez explains in his blog post, that he ran into a problem where his graphics card’s fan would run at full speed, if he didn’t have both graphics cards turned ON before shutting down his computer. He provides a script to fix it. All it does is run
before shutdown. See the blog post for more details.
Fix brightness
The brightness of the laptop display upon boot may be turned very low. If you have a nearly black screen during boot, you may be lucky and just need to press the correct key to increase brightness.
Fix Suspend/Wake Freezing
After having turned off the unused discrete card, if your laptop freezes after suspending and trying to wake, make a new file called «11_switcheroo_suspend» under /etc/pm/sleep.d and make sure the file is executable.
Default GPU
The GPU that is enabled by the BIOS during boot may be dependent on whether the laptop is plugged into AC power or not.
Console FB
You can select which device the linux kernel uses for the boot-time console using the kernel command line option fbcon, such as «fbcon=map:1» for /dev/fb1.
(Alternatively, if you want to keep one GPU disabled at all times, there is also the option of just blacklisting the relevant driver and update initramfs and thereby get rid of one of the fb devices.)
HybridGraphics (последним исправлял пользователь starshipeleven 2015-09-16 06:33:06)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details
Источник