Mesa vs Qt

I woke up this morning in a not-so-good mood and thought I had enough of a hardware problem I had on my PC that had been bugging me for about two weeks. I then started troubleshooting my hardware and after pulling out my video card and putting it back in, everything was miraculously solved. So it seemed to me like today was the day for miracle fixes and I addressed an extremely weird problem that came up on my laptop since probably last Sunday:

I was working on a Qt project that uses OpenGL (I'll soon post about it) and I left it working relatively fine on Sunday. While I worked on that project, I had an ongoing update on Gentoo's world of just 17 packages, none of them sensitive to the system. I also changed my X Server configuration to something less sophisticated because I had done some changes trying to get Compiz working on my radeon driver and I thought those were messing up a part of my program... yet I forgot to restart X to test those changes. Nevertheless, everything was working ok when I shut down my laptop that night.

Yesterday I was going to do some more work on that project and I tried to run a modified version of it and it "failed with an unexpected error" as my Qt Creator said. I tried it from the console, and it died with a Segmentation Fault. I removed all changes and it still died with a Segmentation Fault. I went to the original version of the project (I was working on a separate folder to do those changes) and I ran the original version, and it died with a Segfault too. I then ran it on GDB and observed that the program was dying on a call to glxWaitX() which was done internally by libQtGL to libGL. I was really puzzled but after double checking the list of installed packages on Sunday's update and reasuring nothing could have changed my OpenGL implementation, I remembered that untested change on my X Server. So I reconfigured my X Server with the defaults (using xservercf), restarted X and tried again... nothing.

Today I Googled on Segfaults on glxWaitX() and I realized people were having the exact same problem on Mythtv on Ubuntu, and many other Qt4 + OpenGL programs on Fedora, all bugs report were recent: between April and May of this year. One of the guys at the Fedora bug report said the problem was specific to Qt and OpenGL, and that it was solved on SVN versions of the Mesa library. It didn't make any sense to me: I had not changed anything on my Mesa configuration recently, so I kept trying workarounds reinstalling the version I had of Mesa library (7.3-r1) and libDRM (that's NOT Digital Rights Management!) and nothing helped. I then gave in on my research and opted for the easy fix: I bumped up a version of Mesa an libDRM and emerged those new packages... and everything was miraculously working back again.

I'll probably never know what happened there, which actually sucks because that's one of the reasons I use Gentoo, because it lets you get down and dirty with the system to understand what can go wrong and how to fix it. But the good thing is I can now go back to my important project. I hope to read someone's comments here telling me what was that all about, and I also hope this post helps some other Gentoo (or any other distro whatsoever) user experiencing the same problems. Happy Hacking!