summaryrefslogtreecommitdiff
path: root/extra/kdebase-workspace/fix-mesa9.patch
blob: 4c5fca4083baceb0be4a9f915e34473a1cc92751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
commit 6cf057777555a5d0c834de3a0165a62916cf3b40
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Tue Oct 30 18:20:00 2012 +0100

    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.

diff --git a/kwin/scene_opengl_glx.cpp b/kwin/scene_opengl_glx.cpp
index 1fe2f18..cf7933b 100644
--- a/kwin/scene_opengl_glx.cpp
+++ b/kwin/scene_opengl_glx.cpp
@@ -270,12 +270,15 @@ bool SceneOpenGL::initBufferConfigs()
     fbcbuffer_nondb = NULL;
 
     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;
         stencil = INT_MAX;
         depth = INT_MAX;
         caveat = INT_MAX;
+        msaa_buffers = INT_MAX;
+        msaa_samples = INT_MAX;
         alpha = 0;
+
         for (int j = 0; j < cnt; j++) {
             XVisualInfo *vi;
             int visual_depth;
@@ -322,10 +325,26 @@ bool SceneOpenGL::initBufferConfigs()
                                  GLX_CONFIG_CAVEAT, &caveat_value);
             if (caveat_value > caveat)
                 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;
             stencil = stencil_value;
             depth = depth_value;
             caveat = caveat_value;
+            msaa_buffers = msaa_buffers_value;
+            msaa_samples = msaa_samples_value;
+
             if (i > 0)
                 fbcbuffer_nondb = fbconfigs[ j ];
             else