nvidia prime - doesn't show nvidia as OpenGL vendor

Hi, I am trying to configure Optimus laptop with Nvidia/Intel combination. I am trying to setup xradr-managed configuration, using recommended Xorg.conf (as per http://us.download.nvidia.com/XFree86/Linux-x86/319.12/README/randr14.html), and I do not see black screen - but I do not think I am really using Nvidia acceleration, since flxinfo doesn’t show Nvidia as a vendor:

glxinfo | grep -i vendor
server glx vendor string: SGI
client glx vendor string: Mesa Project and SGI
    Vendor: VMware, Inc. (0xffffffff)
OpenGL vendor string: VMware, Inc.

Also, nvidia-settings doesn’t have Prime tab there, so I can’t switch between integrated and discrete graphic card. Is it expected, or am I missing something?

I am using latest Nvidia drivers and Xorg on a freshly installed system.

Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post will reveal a paperclip icon.

I figured this out, X server was not using Nvidia GLX libraries. My bad for not figuring it out myself.
However, after fixing that, I know have an issue when I can’t run any GLX app (be it glxinfo, glsgears or nvidia-settings when I try to click on Graphic Information) as normal users, X server fails with

The program 'nvidia-settings' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 415 error_code 2 request_code 153 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Everything runs perfect when run as root, but of course this is not a solution. I have found a lot of online material on the very same issue, but it was related to Nvidia driver 304.132, for example https://devtalk.nvidia.com/default/topic/968892/linux/geforce-7300le-with-304-132-glxinfo-fails-now-with-quot-x-error-of-failed-request-badvalue-quot-/2

I am currently running with

NVIDIA GLX Module  396.24  Wed Apr 25 23:17:01 PDT 2018

Should I try to upgrade to 396.45?

This error usually means that the client (in this case, nvidia-settings) is trying to use indirect GLX rendering, but indirect GLX is disabled in the X server.

The fact that it works when running as root means there’s likely a permission problem on the device files. Please check whether your user can access the /dev/nvidia* device nodes. You can also check what nvidia-settings or a simpler client such as glxgears are trying to do using strace.

And you, sir, are correct! I also came to the same conclusion, and it was very easy to see what’s wrong when I strace’d the binary.

For the benefit of any future reader, permissions on devices /dev/nvidia* were group/owner readable/writable, with root as owner and video as group, but not accessible for anybody else; and the user was not a member of the video group.

Thanks a lot for your help, Aaron. However, there is one last question (relatively minor) - nvidia-settings is supposed to show an option to switch from discrete gpu to integrated or not? Because it doesn’t for me. I can attach a screenshot if required. Or does it only work in Canonical distributions (mine is not) through some special hacks?

That’s a Canonical patch that they apply to the Ubuntu build of nvidia-settings. It’s not in the upstream version on github or the version we ship with the driver.