Merge lp:~vanvugt/compiz-core/fix-924691 into lp:compiz-core/0.9.5

Proposed by Daniel van Vugt
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 2977
Merged at revision: 2977
Proposed branch: lp:~vanvugt/compiz-core/fix-924691
Merge into: lp:compiz-core/0.9.5
Diff against target: 112 lines (+22/-26)
4 files modified
include/core/global.h (+2/-0)
src/global.cpp (+1/-0)
src/main.cpp (+16/-19)
src/screen.cpp (+3/-7)
To merge this branch: bzr merge lp:~vanvugt/compiz-core/fix-924691
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
Alan Griffiths Approve
Review via email: mp+91023@code.launchpad.net

Description of the change

Disable XSynchronize by default, and add an option to enable it (LP: #924691)

In testing, this almost halves the CPU usage of compiz and Xorg. But don't get too excited because XSynchronize was correctly disabled in previous compiz versions. We're only fixing a recent regression in lp:compiz-core here.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) :
review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I think this somehow snuck in here from some debugging work I was doing with getting compiz up and running on xig. Been meaning to remove it for a while. Thanks for making it an option though!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/global.h'
2--- include/core/global.h 2011-12-19 07:06:22 +0000
3+++ include/core/global.h 2012-02-01 07:31:17 +0000
4@@ -30,6 +30,8 @@
5 */
6 extern bool debugOutput;
7
8+extern bool synchronousX;
9+
10 extern char *programName;
11 extern char **programArgv;
12 extern int programArgc;
13
14=== modified file 'src/global.cpp'
15--- src/global.cpp 2012-01-23 18:41:06 +0000
16+++ src/global.cpp 2012-02-01 07:31:17 +0000
17@@ -40,6 +40,7 @@
18 bool replaceCurrentWm = false;
19 bool useDesktopHints = false;
20 bool debugOutput = false;
21+bool synchronousX = false;
22
23 std::list <CompString> initialPlugins;
24
25
26=== modified file 'src/main.cpp'
27--- src/main.cpp 2012-01-23 18:41:06 +0000
28+++ src/main.cpp 2012-02-01 07:31:17 +0000
29@@ -37,28 +37,21 @@
30 #include "privatescreen.h"
31 #include "privatestackdebugger.h"
32
33-/*
34- * The extern declaration of useCow
35- * is in plugins/composite/src/privates.h.
36- * It needs to be defined here to
37- * make it visible to the command line parser.
38- */
39-bool useCow = true;
40-
41 void
42 CompManager::usage ()
43 {
44- printf ("Usage: %s "
45- "[--replace] "
46- "[--display DISPLAY]\n "
47- "[--sm-disable] "
48- "[--sm-client-id ID]\n "
49- "[--keep-desktop-hints]\n "
50- "[--debug] "
51- "[--version] "
52- "[--help] "
53- "[PLUGIN]...\n",
54- programName);
55+ printf ("Usage: %s [OPTIONS] [PLUGINS ...]\n"
56+ "Options:\n"
57+ " --replace Replace any existing window managers\n"
58+ " --display DISPLAY Connect to X display DISPLAY (instead of $DISPLAY)\n"
59+ " --sm-disable Disable session management\n"
60+ " --sm-client-id ID Session management client ID\n"
61+ " --keep-desktop-hints Retain existing desktop hints\n"
62+ " --sync Make all X calls synchronous\n"
63+ " --debug Enable debug mode\n"
64+ " --version Show the program version\n"
65+ " --help Show this summary\n"
66+ , programName);
67 }
68
69 static void
70@@ -92,6 +85,10 @@
71 {
72 debugOutput = true;
73 }
74+ else if (!strcmp (argv[i], "--sync"))
75+ {
76+ synchronousX = true;
77+ }
78 else if (!strcmp (argv[i], "--display"))
79 {
80 if (i + 1 < argc)
81
82=== modified file 'src/screen.cpp'
83--- src/screen.cpp 2012-01-29 16:28:45 +0000
84+++ src/screen.cpp 2012-02-01 07:31:17 +0000
85@@ -769,6 +769,8 @@
86 screen->handleEvent (&event);
87 inHandleEvent = false;
88
89+ XFlush (dpy);
90+
91 lastPointerX = pointerX;
92 lastPointerY = pointerY;
93 lastPointerMods = pointerMods;
94@@ -4400,17 +4402,11 @@
95 return false;
96 }
97
98- XSynchronize (dpy, TRUE);
99-
100-// priv->connection = XGetXCBConnection (priv->dpy);
101+ XSynchronize (dpy, synchronousX ? True : False);
102
103 snprintf (priv->displayString, 255, "DISPLAY=%s",
104 DisplayString (dpy));
105
106-#ifdef DEBUG
107- XSynchronize (priv->dpy, true);
108-#endif
109-
110 Atoms::init (priv->dpy);
111
112 XSetErrorHandler (errorHandler);

Subscribers

People subscribed via source and target branches