The necessary plumbing has happened inside Mesa for handling the OpenGL ARB_texture_query_levels extension and it's now implemented for the open-source Intel Linux graphics driver on Sandy Bridge hardware and newer.
ARB_texture_query_levels requires at least GLSL 1.30 and is written against the OpenGL 4.2 specification as an extension to provide a new set of texture functions for GLSL to expose the number of mipmap levels for a sampler variable and other characteristics. The full specification can be found via the OpenGL.org registry
While there's the support within core Mesa and the GL Shading Language changes made, as is usually the case when other OpenGL extensions are enabled in Mesa, for right now there's only support for the Intel i965 hardware driver
. Intel made the necessary changes to better the Mesa OpenGL driver support and obviously they're most concerned just about their hardware driver, but in due time we will hopefully see the code taken advantage of within the Nouveau and Radeon drivers, etc. The support covers Sandy Bridge (Gen6) and newer hardware though when Gen5 hardware gets GLSL 1.30 by default, it should work there too.
This new OpenGL extension will be one of many extensions to be found in the next Mesa release due out in November. It's likely to be called Mesa 10.0 if OpenGL 3.2/3.3 support is reached.