NVIDIA proprietary driver doesn't work

I use HP Pavilion Gaming laptop with hybrin graphics.
If I’m trying to run this command:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | egrep "OpenGL vendor|OpenGL renderer"

I’m getting this error:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  39
  Current serial number in output stream:  40

And if I try to run any other game/program by using the Prime offload to run it on my NVIDIA GPU, the game/program runs on my integrated graphics.
nvidia-bug-report.log.gz (1.5 MB)

Can you please check xrandr --listproviders? From your bug report log, I see an Xorg.0.log.old where it loaded the NVIDIA driver correctly but in Xorg.0.log it didn’t, I think because the NVIDIA kernel modules (nvidia, nvidia-modeset, and nvidia-drm) aren’t loaded. It looks like the modules were loaded at one point, so I’m not sure why they are unloaded now.

xrandr --listproviders:

Providers: number : 1
Provider 0: id: 0x54; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 4; outputs: 1; associated providers: 0; name: Unknown AMD Radeon GPU @ pci:0000:05:00.0
    output eDP

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia xrandr --listproviders:

Providers: number : 1
Provider 0: id: 0x54; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 4; outputs: 1; associated providers: 0; name: Unknown AMD Radeon GPU @ pci:0000:05:00.0
    output eDP

lsmod | grep nvidia:

nvidia_drm             65536  0
nvidia_modeset       1232896  1 nvidia_drm
nvidia_uvm           1146880  0
nvidia              34197504  2 nvidia_uvm,nvidia_modeset
drm_kms_helper        286720  2 amdgpu,nvidia_drm
drm                   573440  18 gpu_sched,drm_kms_helper,amdgpu,drm_ttm_helper,nvidia_drm,ttm

cat /etc/dracut.conf.d/60-nvidia-default.conf:
add_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-uvm "

Please create /etc/X11/xorg.conf.d/10-nvidia.conf

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection