[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

compiz: Changes to 'debian-unstable'



 debian/changelog                                                           |    2 
 debian/control                                                             |    1 
 debian/patches/030_no_fade_in_staticswicher.patch                          |   12 
 debian/patches/056_Preserve-DESTDIR-if-no-override-in-COMPIZ_DESTDIR.patch |   22 
 debian/patches/060_move_checks_to_compiz.patch                             |  196 -
 debian/patches/065_add_bailer_and_detection_plugins.patch                  |  652 ++++
 debian/patches/085_add_grid_plugin.patch                                   | 1461 ++++++++++
 debian/patches/086_new_grid_defaults.patch                                 |   49 
 debian/patches/series                                                      |    5 
 debian/rules                                                               |    9 
 debian/source/local-options                                                |    2 
 11 files changed, 2200 insertions(+), 211 deletions(-)

New commits:
commit 784abdee22139d95eb1e7a9cec04d1a8accc7437
Author: Sean Finney <seanius@debian.org>
Date:   Sat Feb 26 22:43:37 2011 +0000

    Prepare new upload

diff --git a/debian/changelog b/debian/changelog
index ecb8ce6..e57eb08 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-compiz (0.9.2.1+git20110226-1) experimental; urgency=low
+compiz (0.9.2.1+git20110226.f059fae9-1) experimental; urgency=low
 
   [ Sean Finney ]
   * Incorporate Janos Guljas' compiz packaging work, thanks!

commit 6e9d7f78e86d9d53aec87b665dfb706c1433fa36
Author: Sean Finney <seanius@debian.org>
Date:   Sun Feb 27 00:23:46 2011 +0000

    Cleanup leftover .pot file in clean target

diff --git a/debian/rules b/debian/rules
index cd2efcc..b583b80 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,6 +11,11 @@ DEFAULT_PLUGINS = "core bailer detection composite opengl decor mousepoll vpswit
 %:
 	dh $@
 
+clean:
+	dh clean
+	# upstream build leaves this around
+	rm -f po/compiz.pot
+
 override_dh_auto_configure:
 	# currently, segfault if CMAKE_BUILD_TYPE=Release
 	dh_auto_configure -- -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_DEFAULT_PLUGINS=\"$(DEFAULT_PLUGINS)\" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCOMPIZ_PACKAGING_ENABLED=TRUE

commit ee1eb7fabb2faa084d1a32ddc383a977d996d1e4
Author: Sean Finney <seanius@debian.org>
Date:   Sat Feb 26 17:46:43 2011 +0000

    Add unapply-patches and abort-on-upstream-changes to source local-options
    
    This should allow tools like git-buildpackage to remain happy with the
    new 3.0 (quilt) format. If you're using git-buildpackage, you might
    also want to have
    
    	cleaner = debuild clean && rm -rf .pc
    
    in your ~/.gbp.conf until #591858 is fixed.

diff --git a/debian/source/local-options b/debian/source/local-options
new file mode 100644
index 0000000..9cdfca9
--- /dev/null
+++ b/debian/source/local-options
@@ -0,0 +1,2 @@
+unapply-patches
+abort-on-upstream-changes

commit f0b2e5bf112a200bdf55f9f807dc21da25dbf1e6
Author: Sean Finney <seanius@debian.org>
Date:   Sat Feb 26 16:43:19 2011 +0000

    Add missing build dep on libglibmm-2.4-dev

diff --git a/debian/control b/debian/control
index 659747e..9c6002e 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,7 @@ Build-Depends: cmake (>= 2.6), debhelper (>= 7.0.50~), intltool, libtool,
  libdbus-glib-1-dev, libgconf2-dev, 
  libgl1-mesa-dev (>= 6.5.1) | libgl-dev, libglib2.0-dev, libgnome-desktop-dev,
  libboost1.42-dev, libboost-serialization1.42-dev,
+ libglibmm-2.4-dev,
  libgnomeui-dev, 
  libgnome-window-settings-dev, libgtk2.0-dev, libice-dev (>= 1:1.0.1), 
  libmetacity-dev (>= 1:2.30.0), libpango1.0-dev, libpng12-dev | libpng-dev, librsvg2-dev,

commit 72dd7ed370a58e90a062450c0a5af8edc7acce5f
Author: Sean Finney <seanius@debian.org>
Date:   Sat Feb 26 16:16:29 2011 +0000

    Update list of default plugins and cmake configuration options

diff --git a/debian/rules b/debian/rules
index 4308488..cd2efcc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,14 +6,14 @@
 
 CORE_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+CORE_ABIVERSION[[:space:]]+//p' include/core/core.h )
 
-DEFAULT_PLUGINS = "core composite opengl decor mousepoll scale expo move compiztoolbox place wall ezoom staticswitcher resize wobbly cube rotate 3d cubeaddon"
+DEFAULT_PLUGINS = "core bailer detection composite opengl decor mousepoll vpswitch regex animation snap expo move compiztoolbox place grid gnomecompat wall ezoom workarounds staticswitcher resize fade scale session"
 
 %:
 	dh $@
 
 override_dh_auto_configure:
 	# currently, segfault if CMAKE_BUILD_TYPE=Release
-	dh_auto_configure -- -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_DEFAULT_PLUGINS=\"$(DEFAULT_PLUGINS)\" -DCMAKE_BUILD_TYPE=Debug -DCOMPIZ_PACKAGING_ENABLED=TRUE
+	dh_auto_configure -- -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_DEFAULT_PLUGINS=\"$(DEFAULT_PLUGINS)\" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCOMPIZ_PACKAGING_ENABLED=TRUE
 
 override_dh_install:
 	# cmake findcompiz_install use COMPIZ_DESTDIR and using COMPIZ_DESTDIR and

commit c60d5ec32e62e4ab5bea7b2945c4ce97acf9f40f
Author: Sean Finney <seanius@debian.org>
Date:   Sat Feb 26 15:29:33 2011 +0000

    Synchronize patches with ubuntu 1:0.9.4-0ubuntu1

diff --git a/debian/patches/030_no_fade_in_staticswicher.patch b/debian/patches/030_no_fade_in_staticswicher.patch
new file mode 100644
index 0000000..00fe917
--- /dev/null
+++ b/debian/patches/030_no_fade_in_staticswicher.patch
@@ -0,0 +1,12 @@
+Index: compiz-0.9.2.1+glibmainloop2/plugins/fade/fade.xml.in
+===================================================================
+--- compiz-0.9.2.1+glibmainloop2.orig/plugins/fade/fade.xml.in	2010-12-06 12:23:04.705212002 +0100
++++ compiz-0.9.2.1+glibmainloop2/plugins/fade/fade.xml.in	2010-12-06 12:23:23.761212002 +0100
+@@ -9,6 +9,7 @@
+ 	    </requirement>
+ 	    <relation type="after">
+ 		<plugin>decor</plugin>
++		<plugin>staticswitcher</plugin>
+ 	    </relation>
+ 	    <relation type="before">
+ 		<plugin>cube</plugin>
diff --git a/debian/patches/060_move_checks_to_compiz.patch b/debian/patches/060_move_checks_to_compiz.patch
index 6313e2c..32258c6 100644
--- a/debian/patches/060_move_checks_to_compiz.patch
+++ b/debian/patches/060_move_checks_to_compiz.patch
@@ -3,202 +3,29 @@
 #  running compiz. However, this duplicated several checks that compiz
 #  runs on its own and was slow due to being a shell script.
 #  .
-#  This patch adds checks for blacklisted video cards, software rendering,
-#  running a GNOME failsafe session, and will restart with --indirect-rendering
-#  if it cannot find GLX_EXT_texture_from_pixmap. It makes all of these checks
-#  as well as the ones compiz already runs launch a fallback WM if they fail.
-#  .
 #  This patch adds in default options and plugins if none are provided on
 #  the command line so running `compiz` continues to work like expected.
 # Forwarded: not-needed
 # Origin: Ubuntu
 # Author: Travis Watkins <amaranth@ubuntu.com>
 
-Index: compiz-0.9.0+jasonglibbranch1/plugins/opengl/src/screen.cpp
-===================================================================
---- compiz-0.9.0+jasonglibbranch1.orig/plugins/opengl/src/screen.cpp	2010-10-04 00:36:06.000000000 +0200
-+++ compiz-0.9.0+jasonglibbranch1/plugins/opengl/src/screen.cpp	2010-11-05 16:12:14.273534001 +0100
-@@ -94,6 +94,7 @@
-     GLfloat		 diffuseLight[]   = { 0.9f, 0.9f,  0.9f, 0.9f };
-     GLfloat		 light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
-     XWindowAttributes    attr;
-+    const char           *glRenderer;
- 
-     if (indirectRendering)
-     {
-@@ -183,6 +184,34 @@
-     if (!strstr (glxExtensions, "GLX_EXT_texture_from_pixmap") ||
-         !GL::bindTexImage || !GL::releaseTexImage)
-     {
-+	/* try again with indirect rendering */
-+	if (!indirectRendering)
-+	{
-+	    char **copy;
-+
-+	    copy = (char **)malloc ((programArgc + 2) * sizeof (char *));
-+	    for (i = 0; i < programArgc; i++)
-+	    {
-+		copy[i] = strdup (programArgv[i]);
-+	    }
-+	    copy[i++] = "--indirect-rendering";
-+	    copy[i] = NULL;
-+	    execvp (programName, copy);
-+
-+	    /* if we made it here execvp failed */
-+	    for (i = 0; copy[i] != NULL; i++)
-+	    {
-+		free (copy[i]);
-+	    }
-+	    free (copy);
-+
-+	    compLogMessage ("core", CompLogLevelFatal,
-+			    "Failed to launch with --indirect-rendering");
-+	    XFree (visinfo);
-+
-+	    return;
-+	}
-+
- 	compLogMessage ("opengl", CompLogLevelFatal,
- 			"GLX_EXT_texture_from_pixmap is missing");
- 	GL::textureFromPixmap = false;
-@@ -225,6 +254,18 @@
- 	setFailed ();
- 	return;
-     }
-+
-+    glRenderer = (const char *) glGetString (GL_RENDERER);
-+    if (glRenderer != NULL &&
-+	(strcmp (glRenderer, "Software Rasterizer") == 0 ||
-+	 strcmp (glRenderer, "Mesa X11") == 0))
-+    {
-+	compLogMessage ("core", CompLogLevelFatal,
-+			"Software rendering detected.");
-+
-+	setFailed ();
-+	return;
-+    }
- 
-     if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))
- 	GL::textureNonPowerOfTwo = true;
-Index: compiz-0.9.0+jasonglibbranch1/src/main.cpp
+Index: compiz-0.9.4/src/main.cpp
 ===================================================================
---- compiz-0.9.0+jasonglibbranch1.orig/src/main.cpp	2010-10-04 00:36:06.000000000 +0200
-+++ compiz-0.9.0+jasonglibbranch1/src/main.cpp	2010-11-05 16:12:24.437534001 +0100
-@@ -59,6 +59,13 @@
- 
- unsigned int pluginClassHandlerIndex = 0;
- 
-+char *blacklist[] = {
-+	"8086:3577", /* Intel 830MG, 845G (LP: #259385) */
-+	"8086:2562",
-+
-+	NULL
-+};
-+
- static void
- usage (void)
- {
-@@ -79,6 +86,28 @@
- 	    programName);
- }
- 
-+void
-+launchFallbackWM (void)
-+{
-+    char *fallback = NULL;
-+
-+    if (getenv ("KDE_FULL_SESSION") != NULL)
-+	fallback = "kwin";
-+    else if (getenv ("GNOME_DESKTOP_SESSION_ID") != NULL)
-+	fallback = "metacity";
-+    else if (access ("/usr/bin/xfwm4", F_OK) == 0)
-+	fallback = "xfwm4";
-+
-+    printf ("\nLaunching fallback window manager\n");
-+    if (fallback != NULL)
-+	execlp (fallback, fallback, "--replace", (char *)NULL);
-+    else
-+	execlp ("xterm", "xterm", (char *)NULL);
-+
-+    /* we should never get here but if we do just exit */
-+    exit (EXIT_FAILURE);
-+}
-+
- static void
- signalHandler (int sig)
- {
-@@ -107,16 +136,42 @@
-     int	                    i;
-     bool                    disableSm = false;
-     char                    *clientId = NULL;
-+    char                    *command;
- 
-     programName = argv[0];
-     programArgc = argc;
-     programArgv = argv;
- 
-+    if (getenv ("GNOME_DESKTOP_SESSION_ID") != NULL &&
-+	strcmp (getenv ("GNOME_DESKTOP_SESSION_ID"), "Failsafe") == 0)
-+    {
-+	printf ("Detected GNOME failsafe session.\n");
-+	launchFallbackWM ();
-+    }
-+
-+    for (i = 0; blacklist[i] != NULL; i++)
-+    {
-+	asprintf (&command, "lspci -n | grep -q %s", blacklist[i]);
-+	if (system(command) == 0)
-+	{
-+	    printf ("Blacklisted PCI ID %s detected\n", blacklist[i]);
-+	    launchFallbackWM ();
-+	}
-+	free (command);
-+    }
-+
-     signal (SIGHUP, signalHandler);
-     signal (SIGCHLD, signalHandler);
-     signal (SIGINT, signalHandler);
-     signal (SIGTERM, signalHandler);
- 
-+    /* if no options are passed run with defaults */
-+    if (argc == 1)
-+    {
-+	useDesktopHints = false;
-+	replaceCurrentWm = true;
-+    }
-+
-     for (i = 1; i < argc; i++)
-     {
- 	if (!strcmp (argv[i], "--help"))
-@@ -183,14 +238,18 @@
+--- compiz-0.9.4.orig/src/main.cpp	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/src/main.cpp	2011-02-24 11:17:38.142752891 +0100
+@@ -170,6 +170,10 @@
  	}
      }
  
 +    /* add in default plugins if none are given */
 +    if (plugins.size () == 0)
-+        plugins.push_back ("ccp");
++	plugins.push_back ("ccp");
 +
-     screen = new CompScreen ();
-     if (!screen)
--	return 1;
-+	launchFallbackWM ();
- 
-     modHandler = new ModifierHandler ();
- 
-     if (!modHandler)
--	return 1;
-+	launchFallbackWM ();
+     initialPlugins = plugins;
  
-     if (!plugins.empty ())
-     {
-@@ -211,12 +270,22 @@
-     }
- 
-     if (!screen->init (displayName))
--	return 1;
-+	launchFallbackWM ();
- 
-     modHandler->updateModifierMappings ();
+     return true;
+@@ -226,7 +230,16 @@
+ 	return false;
  
      if (!disableSm)
 +    {
@@ -209,9 +36,8 @@ Index: compiz-0.9.0+jasonglibbranch1/src/main.cpp
 +		clientId = strdup (desktop_autostart_id);
 +	    unsetenv ("DESKTOP_AUTOSTART_ID");
 +	}
-+
  	CompSession::init (clientId);
 +    }
  
-     screen->eventLoop ();
- 
+     return true;
+ }
diff --git a/debian/patches/065_add_bailer_and_detection_plugins.patch b/debian/patches/065_add_bailer_and_detection_plugins.patch
new file mode 100644
index 0000000..6b7ac73
--- /dev/null
+++ b/debian/patches/065_add_bailer_and_detection_plugins.patch
@@ -0,0 +1,652 @@
+## Description: add some description
+## Origin/Author: add some origin or author
+## Bug: bug URL
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/CMakeLists.txt	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,5 @@
++find_package (Compiz REQUIRED)
++
++include (CompizPlugin)
++
++compiz_plugin (bailer)
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/bailer.xml.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/bailer.xml.in	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,82 @@
++<compiz>
++    <plugin name="bailer" useBcop="true">
++    <_short>Bailer</_short>
++    <_long>Take decisive action if something is affecting the experience</_long>
++    <category>Utility</category>
++    <deps>
++        <relation type="before">
++            <plugin>composite</plugin>
++            <plugin>opengl</plugin>
++        </relation>
++    </deps>
++	<options>
++	    <option name="fatal_fallback_mode" type="int">
++		<_short>Fatal fallback mode</_short>
++		<_long>How best to handle a fatal fallback</_long>
++		<min>0</min>
++		<max>3</max>
++		<default>2</default>
++		<desc>
++		    <value>0</value>
++		    <_name>No action</_name>
++		</desc>
++		<desc>
++		    <value>1</value>
++		    <_name>Reduced functionality mode</_name>
++		</desc>
++		<desc>
++		    <value>2</value>
++		    <_name>Detect session fallback</_name>
++		</desc>
++		<desc>
++		    <value>3</value>
++		    <_name>Execute custom fallback</_name>
++		</desc>
++	    </option>
++	    <option name="custom_fallback_window_manager" type="string">
++		<_short>Custom fallback window manager command</_short>
++		<_long>Command to execute when selecting to do a custom fallback</_long>
++	    </option>
++	    <option name="custom_alternative_shell" type="string">
++		<_short>Custom alternative shell command</_short>
++		<_long>If compiz is providing a shell and it can't load, an alternative shell will be launched. This is to override the alternative shell detection</_long>
++	    </option>
++	    <option name="poor_performance_fallback" type="int">
++		<_short>Poor performance fallback</_short>
++		<_long>What do do when plugins indicate that performance is reading poor levels</_long>
++		<desc>
++		    <value>0</value>
++		    <_name>No action</_name>
++		</desc>
++		<desc>
++		    <value>1</value>
++		    <_name>Launch fatal fallback</_name>
++		</desc>
++		<desc>
++		    <value>2</value>
++		    <_name>Unload a custom list of plugins</_name>
++		</desc>
++		<desc>
++		    <value>3</value>
++		    <_name>Reduced functionality mode</_name>
++		</desc>
++		<min>0</min>
++		<max>2</max>
++		<default>0</default>
++	    </option>
++	    <option name="bad_performance_threshold" type="int">
++		<_short>Bad performance threshold</_short>
++		<_long>How much bad performance to tolerate before taking decisive action</_long>
++		<min>0</min>
++		<max>300</max>
++		<default>50</default>
++	    </option>
++	    <option name="bad_plugins" type="list">
++		<_short>Bad Plugins</_short>
++		<_long>Plugins to unload in case the session is being impacted</_long>
++		<default></default>
++		<type>string</type>
++	    </option>
++	</options>
++    </plugin>
++</compiz>
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.cpp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.cpp	2011-01-25 13:34:27.007567000 +0100
+@@ -0,0 +1,277 @@
++/**
++ * Compiz bailer plugin
++ *
++ * bailer.cpp
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should be thought of as a "manager" plugin for compiz
++ * it handles signals by various other plugins (eg handleCompizEvent)
++ * and then takes decisive action on those signals when appropriate
++ * based on the configuration.
++ *
++ * For example, it will handle signals from plugins that someone is
++ * doing something stupid and terminate the offending plugin,
++ * or handle signals that performance is poor, wait a little while
++ * and then take decisive action to restore the user experience.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@ubuntu.com>
++ * 	    Sam Spilsbury <sam.spilsbury@canonical.com>
++ */
++
++#include "bailer.h"
++
++COMPIZ_PLUGIN_20090315 (bailer, BailerPluginVTable);
++
++static CompString reducedFunctionalityUnload[] = {"opengl", "composite"};
++static CompString compizShellUnload[] = {"unityshell"};
++static CompString noARBUnload[] = {"colorfilter", "blur", "bicubic", "water", "reflex"};
++static CompString noComplexUnload[] = {"blur", "water"};
++
++/*
++ * BailerScreen::detectFallbackWM ()
++ *
++ * Reads the session environment propeties and tries to detect
++ * which fallback window manager would be appropriate to launch here
++ *
++ * returns: a CompString with the fallback wm command
++ *
++ */
++CompString
++BailerScreen::detectFallbackWM ()
++{
++    if (getenv ("KDE_FULL_SESSION") != NULL)
++	return "kwin --replace";
++    else if (getenv ("GNOME_DESKTOP_SESSION_ID") != NULL)
++	return "metacity --replace";
++    else if (access ("/usr/bin/xfwm4", F_OK) == 0)
++	return "xfwm4 --replace";
++
++    return "";
++}
++
++/*
++ * BailerScreen::ensureShell
++ *
++ * Because compiz might be providing the panel shell or whatever
++ * (eg, Ubuntu's Unity plugin), we need to ensure that our desktop
++ * services come back when compiz goes away or when the Compiz
++ * shell(s) can't run.
++ *
++ */
++void
++BailerScreen::ensureShell ()
++{
++
++    CompString alternative_shell = optionGetCustomAlternativeShell();
++    compLogMessage ("bailer",
++			        CompLogLevelInfo,
++			        "Ensuring a shell for your session");
++
++    /* FIXME: will be nicer to get the detection module at start and so, not loading plugin rather
++                   than unloading them, isn't it? */    
++    unloadPlugins (compizShellUnload);    
++    
++    if (strcmp (alternative_shell.c_str (), "") != 0)
++    {
++	compLogMessage ("bailer",
++			            CompLogLevelInfo,
++			            "Custom shell set: no detection magic: %s", alternative_shell.c_str ());
++	screen->runCommand (alternative_shell.c_str ());
++	return;
++    }
++    
++    if (getenv ("GDMSESSION") != NULL && (strcmp (getenv ("GDMSESSION"), "gnome") == 0)) {
++	screen->runCommand ("gnome-panel");
++    }
++}
++
++/*
++ * BailerScreen::doUnload
++ *
++ * Unload given plugins at the top of the main loop
++ *
++ */
++bool
++BailerScreen::doUnload (std::vector <CompString> plugins)
++{
++    foreach (CompString &plugin, plugins)
++    {
++	CompPlugin *p = CompPlugin::find (plugin.c_str ());
++
++	if (p)
++	    (*loaderUnloadPlugin) (p);
++    }
++
++    return false;
++}
++
++/*
++ * BailerScreen::unloadPlugins
++ *
++ * Add plugins to the unload timer so that we don't unload stuff
++ * during wrapped function calls
++ *
++ */
++void
++BailerScreen::unloadPlugins (CompString *plugins)
++{
++    std::vector <CompString> pv (plugins, plugins + sizeof (plugins) / sizeof (*plugins));
++
++    mSafeUnloadTimer.stop ();
++    mSafeUnloadTimer.setCallback (boost::bind (&BailerScreen::doUnload, this, pv));
++    mSafeUnloadTimer.start ();
++}
++
++void
++BailerScreen::unloadPlugins (std::vector <CompString> plugins)
++{
++    mSafeUnloadTimer.stop ();
++    mSafeUnloadTimer.setCallback (boost::bind (&BailerScreen::doUnload, this, plugins));
++    mSafeUnloadTimer.start ();
++}
++
++
++/*
++ * BailerScreen::doFallback ()
++ *
++ * Do the actual fallback if a plugin asks for it
++ *
++ */
++void
++BailerScreen::doFatalFallback ()
++{
++    switch (optionGetFatalFallbackMode ())
++    {
++	case BailerOptions::FatalFallbackModeReducedFunctionalityMode:
++	    unloadPlugins (reducedFunctionalityUnload); break;
++	case BailerOptions::FatalFallbackModeDetectSessionFallback:
++	    ensureShell ();
++	    screen->runCommand (detectFallbackWM ().c_str ());
++	    exit (EXIT_FAILURE);
++	    break;
++	case BailerOptions::FatalFallbackModeExecuteCustomFallback:
++	    ensureShell ();
++	    screen->runCommand (optionGetCustomFallbackWindowManager ().c_str ());
++	    exit (EXIT_FAILURE);
++	case BailerOptions::FatalFallbackModeNoAction:
++	default:
++	    break;
++    }
++}
++
++/*
++ * BailerScreen::doPerformanceFallback
++ *
++ * Not as bad as a fatal fallback, but try to recover from bad
++ * performance if a plugin thinks we are not doing so well.
++ *
++ */
++void
++BailerScreen::doPerformanceFallback ()
++{
++    switch (optionGetPoorPerformanceFallback ())
++    {
++	case BailerScreen::PoorPerformanceFallbackLaunchFatalFallback:
++	    doFatalFallback ();
++	    break;
++	case BailerScreen::PoorPerformanceFallbackUnloadACustomListOfPlugins:
++	{
++	    CompOption::Value::Vector vv = optionGetBadPlugins ();
++	    std::vector <CompString> pv;
++
++	    foreach (CompOption::Value &v, vv)
++		pv.push_back (v.s ());
++
++	    unloadPlugins (pv);
++
++	    break;
++	}
++	case BailerScreen::PoorPerformanceFallbackReducedFunctionalityMode:
++	    unloadPlugins (reducedFunctionalityUnload); break;
++	case BailerScreen::PoorPerformanceFallbackNoAction:
++	default:
++	    break;
++    }
++}
++
++/*
++ * BailerScreen::changeSessionType
++ *
++ * Unloads and loads plugins depending on what kind of session we wanted
++ *
++ */
++void
++BailerScreen::changeSessionType (SessionType type)
++{
++    switch (type)
++    {
++	case SessionType2D:
++	    unloadPlugins (reducedFunctionalityUnload);
++	    break;
++	case SessionType3DNoARB:
++	    unloadPlugins (noARBUnload);
++	    break;
++	case SessionType3DNoComplex:
++	    unloadPlugins (noComplexUnload);
++	    break;
++	case SessionType3DFull:
++	default:
++	    break;
++    }
++}
++
++/*
++ * BailerScreen::handleCompizEvent
++ *
++ * Checks the compiz event screen if some plugin is screaming for help
++ *
++ */
++void
++BailerScreen::handleCompizEvent (const char *plugin, const char *event,
++				 CompOption::Vector &options)
++{
++    if (strcmp (plugin, "composite") == 0)
++    {
++	if (strcmp (event, "poor_performance") == 0)
++	{
++	    mPoorPerformanceCount++;
++	    if (mPoorPerformanceCount > optionGetBadPerformanceThreshold ())
++		doPerformanceFallback ();
++	}
++    }
++
++    if (strcmp (event, "fatal_fallback") == 0)
++	doFatalFallback ();
++
++    if (strcmp (event, "ensure_shell") == 0)
++	ensureShell ();
++
++    screen->handleCompizEvent (plugin, event, options);
++}
++
++BailerScreen::BailerScreen (CompScreen *s) :
++    PluginClassHandler <BailerScreen, CompScreen> (s),
++    mPoorPerformanceCount (0)
++{
++    ScreenInterface::setHandler (s);
++}
++
++bool
++BailerPluginVTable::init ()
++{
++    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
++	return false;
++
++    return true;
++}
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.h	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,86 @@
++/**
++ * Compiz bailer plugin
++ *
++ * bailer.h
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should be thought of as a "manager" plugin for compiz
++ * it handles signals by various other plugins (eg handleCompizEvent)
++ * and then takes decisive action on those signals when appropriate
++ * based on the configuration.
++ *
++ * For example, it will handle signals from plugins that someone is
++ * doing something stupid and terminate the offending plugin,
++ * or handle signals that performance is poor, wait a little while
++ * and then take decisive action to restore the user experience.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@ubuntu.com>
++ * 	    Sam Spilsbury <sam.spilsbury@canonical.com>
++ */
++
++#include <core/core.h>
++#include <core/pluginclasshandler.h>
++#include <core/timer.h>
++
++#include "bailer_options.h"
++
++class BailerScreen :
++    public PluginClassHandler <BailerScreen, CompScreen>,
++    public ScreenInterface,
++    public BailerOptions
++{
++    public:
++
++	BailerScreen (CompScreen *);
++
++	void
++	handleCompizEvent (const char *, const char *,
++			   CompOption::Vector &options);
++
++    private:
++
++        typedef enum
++	{
++	    SessionType2D = 0,
++	    SessionType3DNoARB,
++	    SessionType3DNoComplex,
++	    SessionType3DFull
++	} SessionType;
++
++	int mPoorPerformanceCount;
++	CompTimer mSafeUnloadTimer;
++
++	CompString detectFallbackWM ();
++	void ensureShell ();
++
++	void doFatalFallback ();
++	void doPerformanceFallback ();
++
++	void changeSessionType (SessionType);
++
++	void unloadPlugins (CompString *);
++	void unloadPlugins (std::vector <CompString> );
++	bool doUnload (std::vector <CompString>);
++};
++
++#define BAILER_SCREEN(s)					       \
++    BailerScreen *bs = BailerScreen::get (s);
++
++class BailerPluginVTable :
++    public CompPlugin::VTableForScreen <BailerScreen>
++{
++    public:
++
++	bool init ();
++};
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/CMakeLists.txt	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,5 @@
++find_package (Compiz REQUIRED)
++
++include (CompizPlugin)
++
++compiz_plugin (detection)
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/detection.xml.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/detection.xml.in	2011-01-25 13:31:48.239567002 +0100
+@@ -0,0 +1,28 @@
++<compiz>
++    <plugin name="detection" useBcop="true">
++    <_short>Detection</_short>
++    <_long>Do a bit more clever hardware etc detection</_long>
++    <deps>
++	<relation type="before">
++	    <plugin>composite</plugin>
++	    <plugin>opengl</plugin>
++	</relation>
++	<relation type="after">
++	    <plugin>bailer</plugin>
++	</relation>
++    </deps>
++    <category>Utility</category>
++    <options>
++	<option name="detect_bad_pci" type="bool">
++	    <_short>Detect known bad PCI ids</_short>
++	    <_long>Fallback when known bad PCI ids are detected</_long>
++	    <default>true</default>
++	</option>
++	<option name="detect_bad_drivers" type="bool">
++	    <_short>Detect known bad drivers</_short>
++	    <_long>Fallback when known bad drivers are detected</_long>
++	    <default>true</default>
++	</option>
++    </options>
++    </plugin>
++</compiz>
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.cpp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.cpp	2011-01-25 13:31:48.239567002 +0100
+@@ -0,0 +1,74 @@
++/**
++ * Compiz detection plugin
++ *
++ * detection.cpp
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should does some quick extra checks to make sure we
++ * are not running on quirky hardware or drivers.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@ubuntu.com>
++ * 	    Sam Spilsbury <sam.spilsbury@canonical.com>
++ */
++
++#include "detection.h"
++
++COMPIZ_PLUGIN_20090315 (detection, DetectionPluginVTable);
++
++static CompString HW_accell_blacklisted[] = {
++    "8086:3577", /* Intel 830MG, 845G (LP: #259385) */
++    "8086:2562"
++};
++
++bool
++DetectionScreen::doDetection ()
++{
++    CompOption::Vector o (0);
++
++    /* first, take care about the blacklisted cards */
++    for (unsigned int i = 0; i < 2; i++)
++    {
++	CompString cmd = "lspci -n | grep -q " + HW_accell_blacklisted[i];
++
++	if (system (cmd.c_str ()) == 0 && optionGetDetectBadPci ())
++	{
++	    compLogMessage ("detection",
++			    CompLogLevelFatal,
++			    "Accelerated blacklisted PCI ID %s detected",
++			    HW_accell_blacklisted[i].c_str ());
++
++	    screen->handleCompizEvent ("detection", "fatal_fallback", o);
++	}
++    }
++
++    return false;
++}
++
++DetectionScreen::DetectionScreen (CompScreen *s) :
++    PluginClassHandler <DetectionScreen, CompScreen> (s)
++{
++    CompTimer::CallBack cb = boost::bind (&DetectionScreen::doDetection,
++					  this);
++
++    mDetectionTimer.start (cb, 0, 0);
++}
++
++bool
++DetectionPluginVTable::init ()
++{
++    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
++	return false;
++
++    return true;
++}
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.h	2011-01-25 13:31:48.239567002 +0100
+@@ -0,0 +1,52 @@
++/**
++ * Compiz detection plugin
++ *
++ * detection.h
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should does some quick extra checks to make sure we
++ * are not running on quirky hardware or drivers.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the


Reply to: