Submitted by AMV007 on

Ubuntu + Nvidia + on demand + external display

Nvidia added on-demand, but it not working good with external display, for example google chrome got white area rectangles instead menu with external display.

to fix it, you can use next aliases in you bashrc:

alias nvidia_run='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only'

alias intel_run='__NV_PRIME_RENDER_OFFLOAD=0 __VK_LAYER_NV_optimus=non_NVIDIA_only'

alias intel_run_ext='__NV_PRIME_RENDER_OFFLOAD=0 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=non_NVIDIA_only' #for external display

 

if you want to fix all applications artifacts in this mode - you can add this strings into your .profile:
 

#export for on demand - so there will be no external display errors

export __NV_PRIME_RENDER_OFFLOAD=0

export __GLX_VENDOR_LIBRARY_NAME=nvidia # for some reason it's a key feature ???

export __VK_LAYER_NV_optimus=non_NVIDIA_only

 

That's all, after that you can use external display and on-demand without problems.