How to update mesa drivers?

How do I know which mesa drivers I'm using and how to update them?

I do not want the latest possible release, I want the latest possible official ubuntu release.

I'm on Ubuntu 20.04 and I'm having a problem with OpenGL that I think could be fixed by a new mesa driver.


CHECK LOADED MODULE One way to check which gpu drivers you are using is to run the following command:

lsmod | grep "gpu"

For me, this command shows the following output:

i2c_nvidia_  16384  0

These are: module name, size, other modules using this one.

If you plug the module name into the following:

modinfo <module-name>

you will get some additional info, including path version, License, author, and description.

CHECK ALL MODULES This will tell you which module you are using, but it won't tell you which ones you have installed on your system.

For this, you can just navigate to them and look for yourself.

Locating them is a 2 step process. First of all, you need your kernel version-name. To get this, run uname -r.

Next plug this into the following command:

cd /lib/modules/<kernel-name>/kernel/drivers/ && la

The resulting output will be a list of folders corresponding to driver types. For example, my list contains the directories radeon & noueve. Both of these are types of mesa driver, and neither were displayed with lsmod. This is because they are downloaded, but aren't currently being used.

cd /lib/modules/$(uname -r)/kernel/drivers/

CHECK OPENGL DRIVERS

Although all Ubuntu drivers are supposed to be built as modules, this is not always the case. This is particularly true for proprietary drivers.

Coincidentally, many drivers associated with graphics and rendering are proprietary, including Mesa drivers.

In order to find opengl drivers that are not modules, run

glxinfo | grep Mesa 

You can also try rerunning, but grepping "render" or "opengl" instead. This will likely show many mesa drivers that were missed by the previous searches. As I said, this shouldn't be the case, but many / most of these were made by hardware companies. They build their products for as many environments as possible, so we are lucky to get a proprietary solution at all, let alone one that follows the conventions of this environment.

DOWNLOADING

In order to get the drivers you need, once you figure out which ones you currently have, you can do so from The Ubuntu mesa PPA. You'll need to add it with

sudo add-apt-repository ppa:kisak/kisak-mesa

Once it is added, run an update to get it into your source list. From there, you can add either automatically or manually. As you need a certain version, you will likely fare better with the latter.

Detailed instructions for both methods, plus valuable info on the subject can be found here.