ALT Linux hardware support
 help / color / mirror / Atom feed
From: Konstantin Lepikhov <lakostis@unsafe.ru>
To: lakostis kernels discuss list <kernels@lists.unsafe.ru>
Cc: ALT Linux Hardware Mailing List <hardware@lists.altlinux.org>
Subject: Re: [Hardware] [Kernels] I: xorg w/ PRIME offload
Date: Tue, 20 Aug 2019 14:07:43 +0200
Message-ID: <20190820120743.GA1817@lks.home> (raw)
In-Reply-To: <20190814130319.GA7201@lks.home>

On 08/14/2019, at 03:03:19 PM you wrote:

> Привет!
> 
> в glvnd репозиторий залит обновленный xorg-server с патчами от nvidia для
> поддержка т.н. PRIME offloading:
> 
> http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/primerenderoffload.html
> 
> > PRIME render offload is the ability to have an X screen rendered by one
> > GPU, but choose certain applications within that X screen to be rendered
> > on a different GPU. This is particularly useful in combination with
> > dynamic power management to leave an NVIDIA GPU powered off, except when
> > it is needed to render select performance-sensitive applications.
> 
> Данный функционал появился совсем недавно в свежих дровах от nvidia и я
> хочу его проверить (благо как раз под рукой есть ноутбук с дискретной
> графикой).
> 
> Так что если вам неожиданно приедет обновление для xorg-server не
> пугайтесь, это так и задумано.
> 
Итак, все работает. Небольшие заметки по использованию:

Что такое PRIME render offload
------------------------------

Раньше если у вас был ноутбук с дискретной графикой от nvidia (думаю, это
90% подобных конфигураций), то под linux'ом выключать/включать во время
работы дискретный GPU было нельзя: можно было только отключить GPU во
время загрузки через bbswitch или использовать технологию Optimus от
Nvidia, где рендеринг всегда шел на дискретную карту, а встроенная
использовалась для отображениях[1]. Были еще хаки со всякими bumblebee но
они требовали много ручной возни и всевозможных патчей для своей работы. И
как обычно, что-то не работало как надо, особенно приложения для Vulkan.

Но с выходом новых драйверов версии 435.17 все изменилось.

Включаем PRIME render offload
-----------------------------

Сначала нужно убедиться, что у вас установлен xorg-server с нужными
патчами (т.е. тот, что сейчас лежит в glvnd репозитории[2]) и правильная
версия драйверов nvidia (>= 435.17).

Затем убедиться, что конфигурация GPU не содержит никаких модификаций для
bumblebee/optimus и тд.

$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x1e0 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:modesetting
Provider 1: id: 0x1b8 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0

тут видно, что все подключено на provider0, и второй провайдер (NVIDIA-G0)
не получает никакой нагрузки.

Проверяем результат
-------------------

- рендеринг силами встроенного GPU

$ glxinfo -B
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2) (0x591b)
..

- рендеринг дискретным GPU

$ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo -B
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 4096 MB
    Total available memory: 4096 MB
    Currently available dedicated video memory: 4009 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1050/PCIe/SSE2

(вместо __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
__GLX_VENDOR_LIBRARY_NAME=nvidia можно просто указать
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia)

- проверяем vulkaninfo со встроенным GPU

$ vulkaninfo |fgrep 'GPU id'
INTEL-MESA: warning: ../src/intel/vulkan/anv_device.c:1504: FINISHME:
Implement pop-free point clipping
		GPU id       : 0 (Intel(R) HD Graphics 630 (Kaby Lake GT2))
		GPU id       : 1 (GeForce GTX 1050)

- проверяем с дискретным:

$ __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only
 vulkaninfo|fgrep GPU
     GPU id       : 0 (GeForce GTX 1050)
     GPU id       : 0 (GeForce GTX 1050)
     GPU id       : 0 (GeForce GTX 1050)
     GPU id       : 0 (GeForce GTX 1050)
..
GPU0
	   deviceType     = DISCRETE_GPU

за всеми опциями см. документацию к драйверу, там очень много полезных
флагов.

PS все проверено на ноутбуке Dell XPS 15".

1. В оригинальной документации к Optimus написано след.
...
Forced Rendering ModeOEMs are provided mechanisms within the driver to
dynamically override standard Optimus rendering behavior, and force
graphics rendering for all applications to occur using either Integrated
Graphics or High Performance Graphics. Some OEMs exploit this feature
through the use of a physical switch, or a hot key. Others have linked
this feature to the use of OS power plans. For example, an OEM may choose
to make the system render using only Integrated Graphics when on battery
mode. 

что, конечно, вносит ряд ограничений на использование, особенно, если
производитель ноутбука не сделал аппаратной возможности переключать
профили.

2. http://www.unsafe.ru/lakostis/RPMS/ALTLinux/glvnd/repo/

-- 
WBR et al.


           reply	other threads:[~2019-08-20 12:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20190814130319.GA7201@lks.home>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190820120743.GA1817@lks.home \
    --to=lakostis@unsafe.ru \
    --cc=hardware@lists.altlinux.org \
    --cc=kernels@lists.unsafe.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux hardware support

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/hardware/0 hardware/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 hardware hardware/ http://lore.altlinux.org/hardware \
		hardware@altlinux.ru hardware@lists.altlinux.org hardware@lists.altlinux.ru hardware@lists.altlinux.com hardware@altlinux.org
	public-inbox-index hardware

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.hardware


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git