~ps-jenkins/compiz/latestsnapshot-10.9.10+13.10.20131004-0ubuntu1

« back to all changes in this revision

Viewing changes to debian/patches/unity_support_test.patch

  • Committer: Tarmac
  • Author(s): Łukasz 'sil2100' Zemczak
  • Date: 2013-08-20 22:33:53 UTC
  • mfrom: (3778.2.1 0.9.10)
  • Revision ID: tarmac-20130820223353-2dxxdapb9dzjmq2f
Remove the unity support test patch, we don't need it - also, the version in saucy already has this patch removed.

Approved by PS Jenkins bot, Andrea Azzarone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Description: force llvmpipe in the unity profile if we are in the grey zone,
2
 
#              meaning: the card and drivers have opengl support, however,
3
 
#              it doesn't met unity requirements (opengl < 1.4, no vertex
4
 
#              shaders support…).
5
 
# Forwarded: not-needed
6
 
# Bug: https://launchpad.net/bugs/1039155
7
 
# Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
8
 
=== modified file 'src/plugin.cpp'
9
 
--- old/src/plugin.cpp  2012-07-30 10:15:41 +0000
10
 
+++ new/src/plugin.cpp  2012-10-09 10:52:12 +0000
11
 
@@ -116,6 +116,60 @@
12
 
 }
13
 
 
14
 
 static bool
15
 
+setOpenGLPluginEnvironment ()
16
 
+{
17
 
+    /*
18
 
+     * Check if the hardware is adequate for Unity and if not, use LLVMpipe.
19
 
+     * Unfortunately the design of Mesa requires that this be done before
20
 
+     * libGL is loaded, which means before the opengl plugin is loaded.
21
 
+     */
22
 
+    bool toggledLLVM = false;
23
 
+
24
 
+    if (!getenv ("LIBGL_ALWAYS_SOFTWARE"))
25
 
+    {
26
 
+       const char *profile = getenv ("COMPIZ_CONFIG_PROFILE");
27
 
+       if (profile && !strcmp (profile, "ubuntu"))
28
 
+       {
29
 
+           int result = system ("/usr/lib/nux/unity_support_test");
30
 
+           int status = WEXITSTATUS (result);
31
 
+           compLogMessage ("core", CompLogLevelInfo,
32
 
+               "Unity is %s",
33
 
+               status == 0 ?   "fully supported by your hardware." :
34
 
+               status == 127 ? "undetectable" :
35
 
+                               "not supported by your hardware. "
36
 
+                               "Enabling software rendering instead (slow).");
37
 
+           if (status > 0 && status < 127)
38
 
+           {
39
 
+               setenv ("LIBGL_ALWAYS_SOFTWARE", "1", 1);
40
 
+               toggledLLVM = true;
41
 
+           }
42
 
+       }
43
 
+    }
44
 
+
45
 
+    return toggledLLVM;
46
 
+}
47
 
+
48
 
+static void
49
 
+unsetUnityshellPluginEnvironment ()
50
 
+{
51
 
+    unsetenv ("LIBGL_ALWAYS_SOFTWARE");
52
 
+}
53
 
+
54
 
+static void
55
 
+setPluginEnvironment (const char *name)
56
 
+{
57
 
+    if (!strcmp (name, "opengl"))
58
 
+       setOpenGLPluginEnvironment ();
59
 
+}
60
 
+
61
 
+static void
62
 
+unsetPluginEnvironment (const char *name)
63
 
+{
64
 
+    if (!strcmp (name, "unityshell"))
65
 
+       unsetUnityshellPluginEnvironment ();
66
 
+}
67
 
+
68
 
+static bool
69
 
 dlloaderLoadPlugin (CompPlugin *p,
70
 
                    const char *path,
71
 
                    const char *name)
72
 
@@ -127,6 +181,8 @@
73
 
     if (cloaderLoadPlugin (p, path, name))
74
 
        return true;
75
 
 
76
 
+    setPluginEnvironment (name);
77
 
+
78
 
     if (path)
79
 
     {
80
 
        file  = path;
81
 
@@ -197,6 +253,8 @@
82
 
     if (!loaded && dlhand)
83
 
        dlclose (dlhand);
84
 
 
85
 
+    unsetPluginEnvironment (name);
86
 
+
87
 
     return loaded;
88
 
 }
89
 
 
90