Nvidia Prime Render Offload "X Error of failed request"

I have a System 76 Gazelle laptop with a Nvidia GTX 1060 Ti running Fedora 31 KDE Spin. I followed the instructions in this post to install and setup the Nvidia drivers from RPMFusion. When I attempt to use Prime Render Offload, it works for Vulcan, but I get an error message for GLX.

$ # As shown @ https://rpmfusion.org/Howto/Optimus#PRIME_Render_Offload
$ __NV_PRIME_RENDER_OFFLOAD=1 vkcube #works
$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  100
  Current serial number in output stream:  101

Based on the “Troubleshooting” section of Nvidia’s documentation on Prime Render Offloading, I find that glamorgl is loaded correctly:

$ grep "glamor" < /var/log/Xorg.0.log
[    22.149] (II) Loading sub module "glamoregl"
[    22.149] (II) LoadModule: "glamoregl"
[    22.149] (II) Loading /usr/lib64/xorg/modules/libglamoregl.so
[    22.162] (II) Module glamoregl: vendor="X.Org Foundation"
[    22.782] (II) modeset(0): glamor X acceleration enabled on Mesa Intel(R) UHD Graphics (CML GT2)
[    22.782] (II) modeset(0): glamor initialized

Also, the kernel module appears to have a slightly different name, but be loaded correctly:

$ lsmod | grep nvidia
nvidia_drm             61440  2
nvidia_modeset       1220608  3 nvidia_drm
nvidia_uvm           1150976  0
nvidia              28286976  105 nvidia_uvm,nvidia_modeset
i2c_nvidia_gpu         16384  0
drm_kms_helper        266240  2 nvidia_drm,i915
drm                   626688  15 drm_kms_helper,nvidia_drm,i915

Creating Nvidia’s recommended xorg.conf results in my not being able to use an external monitor, but does not remove the error message above.

Please advise on how I can further troubleshoot the Prime Render Offloading.

Based on a related post on Nvidia’s developer forums, I found that the error message is associated primarily with the creation of an indirect GLX context. My user was forced to use an indirect context because it did not have permission to access the nvidia devices:

$ ls -l /dev/nvidia*
crw-rw---- root vglusers 0 B Tue Dec 29 07:26:40 2020  /dev/nvidia-modeset
crw-rw-rw- root root     0 B Tue Dec 29 07:26:40 2020  /dev/nvidia-uvm
crw-rw-rw- root root     0 B Tue Dec 29 07:26:40 2020  /dev/nvidia-uvm-tools
crw-rw---- root vglusers 0 B Tue Dec 29 07:26:40 2020  /dev/nvidia0
crw-rw---- root vglusers 0 B Tue Dec 29 07:26:40 2020  /dev/nvidiactl

All I had to do was add myself to the vglusers group, and reboot.

$ sudo usermod -a -G vglusers MillironX
$ reboot
$ __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