[Mesa-dev] How to obtain OpenGL implementation/driver information?

Benoit Jacob bjacob at mozilla.com
Fri Feb 4 08:58:31 PST 2011

----- Original Message -----
> On Thu, Feb 3, 2011 at 4:37 PM, Benoit Jacob <bjacob at mozilla.com>
> wrote:
> > Hi,
> >
> > I'm trying to see how to implement selective
> > whitelisting/blacklisting of driver versions on X11 (my use case is
> > to whitelist drivers for Firefox). The naive approach consists in
> > creating an OpenGL context and calling glGetString(), however that
> > is not optimal for me, for these reasons:
> >  * This has been enough to trigger crashes in the past.
> >  * This can take long (this affects the startup time of the
> >  browser).
> >  * This doesn't always give driver version information (at least the
> >  ATI blob doesn't seem to).
> >
> > Ideally I want to be able to know the driver name, driver version,
> > Mesa version, and any other thing that you think may be relevant. I
> > need to get that information in a fast and safe way.
> >
> > Is there a good solution to this problem? It might even be
> > acceptable to assume that the X server is local, although of course
> > I would prefer a solution that works with remote X.
> >
> > I've been told to check xdriinfo, but this seems to only give the
> > driver name and not a driver version. I've also been told that
> > checking for GLX >= 1.4 would already ensure Mesa >= 7.9, is that
> > correct?
> >
> > Cheers,
> > Benoit
> There is no other way than glGetString if you ever experienced crash
> with it, it would be because you are doing something terribly wrong
> like using it without current context. glGetString is one of the most
> tested gl functions with the open source stack as it's the foundation
> of one of the most used gl program on linux aka glxinfo. I never did
> see glxinfo trigger a crash on any released mesa.

It's not glGetString that's crashing, it's glXMakeCurrent.

I forwarded a bug report from a user, though he's not been able to reproduce since:


A search in Mesa's bugzilla confirms that I'm not alone:


It seems that such crashes happen only after a X error in glxCreateNewContext. So it may be possible to avoid them by doing XSync and checking for errors. But that makes the process even slower.

It's not surprising that we'd be hitting crashes that glxinfo doesn't, since we may have done lots of X and GL calls already earlier in our application. One could say that we should check driver information once and for all upon creation of the first GL context; but I've had users experiencing these crashes already upon creation of the first GL context (mozilla bug 616416)

> Only other way i can think of are hackish and not reliable (like
> trying to read Xorg log which you have no garantee of existence or
> right to access or even place where it is or even worse when there is
> several X server running).


Since the glGetString way will at best be slow, especially if we have to XSync and check for errors, could you consider exposing this information as new glXGetServerString / glXGetClientString strings?


More information about the mesa-dev mailing list