Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NVIDIA PRIME render offload
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Saundersx
Apprentice
Apprentice


Joined: 11 Apr 2005
Posts: 253

PostPosted: Fri Aug 23, 2019 12:08 am    Post subject: NVIDIA PRIME render offload Reply with quote

I decided to give this a try since I own one of these cursed laptops. If you want to read into what this is here are some links
http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/primerenderoffload.html
https://devtalk.nvidia.com/default/topic/1060977

and some useful links for getting it working
https://devtalk.nvidia.com/default/topic/1061404/linux/prime-offload-not-working/
https://devtalk.nvidia.com/default/topic/957981/linux/prime-render-offloading-on-nvidia-optimus/post/5373053/#5373053

copypasta to test
Code:
mkdir -p /etc/portage/patches/x11-base/xorg-server-1.20.5
cd /etc/portage/patches/x11-base/xorg-server-1.20.5
wget "https://gitlab.freedesktop.org/xorg/xserver/commit/7f962c70b6d9c346477f23f6c15211e749110078.diff"
wget "https://gitlab.freedesktop.org/xorg/xserver/commit/37a36a6b5b887d5c5a17a6931ceba8ad5d1bb6d5.diff"
wget "https://gitlab.freedesktop.org/xorg/xserver/commit/8b67ec7cc6fda243480a5a8ca118b66242f3eb2c.diff"
wget "https://gitlab.freedesktop.org/xorg/xserver/commit/56c0a71fdd94a008e5d746261f70a713c4767f93.diff"
wget "https://gitlab.freedesktop.org/xorg/xserver/commit/b4231d69028adc8123801a7552b40a15ea928d1b.diff"
emerge x11-base/xorg-server


So there is one issue I cannot overcome which seems to be gentoo-centric.
Code:
$ eselect opengl list
Available OpenGL implementations:
  [1]   nvidia
  [2]   xorg-x11 *


so to boot into sddm/kde I need to leave this as "xorg-x11" otherwise it's just a blank screen. But when trying to offload to the nvidia gpu
Code:
$ __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only vkcube
vkEnumerateInstanceExtensionProperties failed to find the VK_KHR_surface extension.

Do you have a compatible Vulkan installable client driver (ICD) installed?
Please look at the Getting Started guide for additional information.

also
Code:
$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
server glx vendor string: SGI
client glx vendor string: Mesa Project and SGI
OpenGL vendor string: Intel Open Source Technology Center

after switching opengl to "nvidia" it works fine.
Code:
$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation

So the issue is how do I make it work without having to flop this around every time?
Back to top
View user's profile Send private message
Saundersx
Apprentice
Apprentice


Joined: 11 Apr 2005
Posts: 253

PostPosted: Sat Aug 24, 2019 8:08 am    Post subject: Reply with quote

here's something to try, make a script /usr/local/bin/nvidiagl.sh and put in
Code:
LD_LIBRARY_PATH="/usr/lib/opengl/nvidia/lib:/usr/lib64/opengl/nvidia/lib:$LD_LIBRARY_PATH" \
  __NV_PRIME_RENDER_OFFLOAD_PROVIDER="NVIDIA-G0" \
  __GLX_VENDOR_LIBRARY_NAME="nvidia" \
  __VK_LAYER_NV_optimus="NVIDIA_only" \
  $*


this appears to work for both opengl (glxinfo/glxgears) and vulkan (vkcube). have some more testing to do before i'm sold on using this, mainly how many more watts it's costing to keep the nvidia gpu on)

Code:
$ nvidiagl.sh glxinfo|grep vendor
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 184

PostPosted: Thu Aug 29, 2019 8:08 am    Post subject: Reply with quote

the render offload feature requires a proper glvnd setup, this is why this bug exists:
https://bugs.gentoo.org/692206
Needs patched ebuilds for at least xorg-server and nvidia-driver, patches are in the blocking bug reports.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments 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