Bisecting Mesa

Tango-document-new.png

Tango-document-new.png

This article is a stub.

Notes: Bad title - bisecting mesa is the same as bisecting any other project. If this needs to be specific, the information should be covered upstream. (Discuss)

Often when reporting bugs encountered with Mesa a user may be asked to bisect between the last known version that worked for them and the newer version which is causing them problems in order to see what is the troublesome commit. On Arch this can be done fairly trivially thanks to the functionality of the AUR.

Reverting to an older Mesa release

It might be useful to confirm that it is the new Mesa that is causing the problem. Downgrading packages on Arch can be accomplished trivially as long as an older version of the package is still stored as cache on your system. For example, if the newer version is 10.3.2 and the previous version that worked was 10.3.1, you can do the following:

# cd /var/cache/pacman/pkg
# sudo pacman -U mesa-10.3.1-1-i686.pkg.tar.xz mesa-dri-10.3.1-1-i686.pkg.tar.xz mesa-libgl-10.3.1-1-i686.pkg.tar.xz
Note: Even if the older version fixes the problem it is still possible that is not a bug with Mesa at all but a problem with the packages as provided by Arch.

To go back to to the most recent version of Mesa you can simply re-install them as an update or use the cached versions of the new Mesa packages by replacing the version number with that of the desired newer version.

Building Mesa from git

In order to bisect we are going to need to build a version of Mesa from git. This can be accomplished by building the mesa-git package from the AUR.

Download the tarball from the AUR and extract the directory. Change into the directory from inside a console and run the following command:

# makepkg -o

If you are using yaourt this can also be accomplished by doing the following instead:

# yaourt -G mesa-git; cd mesa-git

Setting up the Bisect

Once building Mesa is successfully accomplished you need to change into the following directory:

# cd src/mesa

From there you can start the process of bisecting:

# git bisect start

The following command will show you all the tags you can use to specify where to bisect:

# git tag

Following on from the earlier example, we will assume the Mesa 10.3.1 worked for us while Mesa 10.3.2 did not:

# git bisect good mesa-10.3.1
# git bisect bad mesa-10.3.2

Now that we have our good and bad versions tagged we can proceed to test commits.

Bisecting Mesa

Change back into the directory you extracted from the tarball. If you are still in the directory mentioned in the previous section this can be accomplished like so:

# cd ../..

You can now build and install your mesa-git package over your previously installed mesa:

# makepkg -efsi
Note: It is very important to keep the -e prefix intact as otherwise it will remove all the changes you have made.

Once the new package is installed you can test for your previously discovered error. Return to the directory you were in the previous section:

# cd src/mesa

If you encountered your problem, tell Mesa that it was bad:

# git bisect bad

If you did not encounter your problem, tell Mesa that it was good:

# git bisect good

Then do as described at the beginning of this section again and repeat until git bisect names the troublesome commit.

Note: It will actually count down the number of steps all the way down to zero, so it is important not to stop until it actually names the first bad commit.

Restoring Mesa

You can re-install mesa either by doing the following or by reverting to an older version as is described in the first section:

# pacman -S mesa