Pop!_Os: NVidia gpu card very slow (or not working) Linux

So after a long while I wanted to get back to CS:GO on my Thinkpad X1 Extreme with hybrid Intel/Nvidia GPU, and the performance was horrible!

Long story short: (re)install the Nvidia drivers to get the Nvidia card working.

First: Testing if the NVidia card is active

You can test if you are actually using the NVidia card by running this command:

 ~  glxinfo|egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 
 ~  

You can see in the example above that Intel means that you’re still using the Intel onboard graphics card for all your OpenGL stuff (including games like CS:GO)

And Intel GPU is not good for gaming.

Note: If it actually says NVIDIA in your output then don’t continue with the solution below.

Solution: (Re-)Install the NVidia driver

Check if you have the driver currently installed:

dpkg -l |grep nvidia

Notice: If the package is installed on your system then the package name is preceded by ii

There should be driver package named nvidia-driver-xxx installed. Where xxx is the version number.

In my system it looks like this:

~  dpkg -l |grep nvidia                         
ii  libnvidia-cfg1-470:amd64                470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-470                    470.57.02-1pop0~1627044105~21.04~f9815ed                             all          Shared files used by the NVIDIA libraries
rc  libnvidia-compute-435:amd64             440.31-1pop1~1573485407~19.04~af08493                                amd64        Transitional package for libnvidia-compute-440
rc  libnvidia-compute-455:amd64             460.67-1pop0~1616430777~20.04~71e1ad1                                amd64        Transitional package for libnvidia-compute-460
rc  libnvidia-compute-460:amd64             465.31-1pop0~1623777959~20.10~a3ca7f3                                amd64        Transitional package for libnvidia-compute-465
rc  libnvidia-compute-465:amd64             470.57.02-1pop0~1627044105~20.10~f9815ed                             amd64        Transitional package for libnvidia-compute-470
ii  libnvidia-compute-470:amd64             470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA libcompute package
ii  libnvidia-compute-470:i386              470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         NVIDIA libcompute package
ii  libnvidia-decode-470:amd64              470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-470:i386               470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-470:amd64              470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-470:i386               470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-470:amd64               470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-470:amd64                470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-470:i386                 470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-440:i386                   470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         Transitional package for libnvidia-gl-470
ii  libnvidia-gl-470:amd64                  470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-470:i386                   470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-ifr1-470:amd64                470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA OpenGL-based Inband Frame Readback runtime library
ii  libnvidia-ifr1-470:i386                 470.57.02-1pop0~1627044105~21.04~f9815ed                             i386         NVIDIA OpenGL-based Inband Frame Readback runtime library
rc  nvidia-compute-utils-460                460.73.01-1pop0~1620243205~20.10~9a91ef9                             amd64        NVIDIA compute utilities
ii  nvidia-compute-utils-470                470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA compute utilities
rc  nvidia-dkms-460                         460.73.01-1pop0~1620243205~20.10~9a91ef9                             amd64        NVIDIA DKMS package
ii  nvidia-dkms-470                         470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA DKMS package
rc  nvidia-driver-460                       460.67-1pop0~1616430777~20.10~71e1ad1                                amd64        NVIDIA driver metapackage
ii  nvidia-driver-470                       470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA driver metapackage
rc  nvidia-kernel-common-460                460.73.01-1pop0~1620243205~20.10~9a91ef9                             amd64        Shared files used with the kernel module
ii  nvidia-kernel-common-470                470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-470                470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA kernel source package
ii  nvidia-settings                         470.57.01-0ubuntu0.21.04.1                                           amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-470                        470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                 0.18build2                                                           all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-470           470.57.02-1pop0~1627044105~21.04~f9815ed                             amd64        NVIDIA binary Xorg driver
 ~  

Re-Install the driver package by installing the latest nvidia-driver-xxx package to your system with the following command:

sudo apt install nvidia-driver-xxx

Accept the additional packages and after the installation, reboot your system. You should now have the correct output when you run the glxinfo command in the first paragraph.

glxinfo|egrep "OpenGL vendor|OpenGL renderer"

Example output:

~  glxinfo|egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050 Ti with Max-Q Design/PCIe/SSE2