kwin/glx: Avoid MSAA configs in initBufferConfigs()

It appears that we're accidentally choosing an MSAA config with the
Intel driver in Mesa 9.0. So change the algorithm to take the values
of GLX_SAMPLES and GLX_SAMPLE_BUFFERS into account.

Found by Kenneth Graunke.
This commit is contained in:
Fredrik Höglund 2012-10-30 18:20:00 +01:00
parent e4d970ef5f
commit 70c35b8284

View file

@ -270,12 +270,15 @@ bool SceneOpenGL::initBufferConfigs()
fbcbuffer_nondb = NULL; fbcbuffer_nondb = NULL;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
int back, stencil, depth, caveat, alpha; int back, stencil, depth, caveat, msaa_buffers, msaa_samples, alpha;
back = i > 0 ? INT_MAX : 1; back = i > 0 ? INT_MAX : 1;
stencil = INT_MAX; stencil = INT_MAX;
depth = INT_MAX; depth = INT_MAX;
caveat = INT_MAX; caveat = INT_MAX;
msaa_buffers = INT_MAX;
msaa_samples = INT_MAX;
alpha = 0; alpha = 0;
for (int j = 0; j < cnt; j++) { for (int j = 0; j < cnt; j++) {
XVisualInfo *vi; XVisualInfo *vi;
int visual_depth; int visual_depth;
@ -322,10 +325,26 @@ bool SceneOpenGL::initBufferConfigs()
GLX_CONFIG_CAVEAT, &caveat_value); GLX_CONFIG_CAVEAT, &caveat_value);
if (caveat_value > caveat) if (caveat_value > caveat)
continue; continue;
int msaa_buffers_value;
glXGetFBConfigAttrib(display(), fbconfigs[j], GLX_SAMPLE_BUFFERS,
&msaa_buffers_value);
if (msaa_buffers_value > msaa_buffers)
continue;
int msaa_samples_value;
glXGetFBConfigAttrib(display(), fbconfigs[j], GLX_SAMPLES,
&msaa_samples_value);
if (msaa_samples_value > msaa_samples)
continue;
back = back_value; back = back_value;
stencil = stencil_value; stencil = stencil_value;
depth = depth_value; depth = depth_value;
caveat = caveat_value; caveat = caveat_value;
msaa_buffers = msaa_buffers_value;
msaa_samples = msaa_samples_value;
if (i > 0) if (i > 0)
fbcbuffer_nondb = fbconfigs[ j ]; fbcbuffer_nondb = fbconfigs[ j ];
else else