Merge lp:~dbarth/unity-2d/envvar-jit-flag into lp:unity-2d

Proposed by David Barth
Status: Needs review
Proposed branch: lp:~dbarth/unity-2d/envvar-jit-flag
Merge into: lp:unity-2d
Diff against target: 70 lines (+11/-16)
3 files modified
config.h.in (+0/-6)
data/com.canonical.Unity2d.gschema.xml (+0/-9)
spread/app/spreadview.cpp (+11/-1)
To merge this branch: bzr merge lp:~dbarth/unity-2d/envvar-jit-flag
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Gerry Boland (community) Needs Fixing
Review via email: mp+175480@code.launchpad.net

Commit message

This is a simplified version of the jit-composite feature, using an environment variable in lieu of the dconf binding.

Description of the change

This is a simplified version of the jit-composite feature, using an environment variable in lieu of the dconf binding. Testing showed an issue with using dconf, where the flag is not retrieved properly. Probably due to an early dbus initialization issue with dconf-qt, but since that project has been superseded, it seemed more efficient to fallback to a simpler solution for now.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

To test, use:

UNITY2D_JIT_COMPOSITE=1 ./spread/app/unity-2d-spread

There is a debug statement at the beginning to show which mode the spread runs in.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

If you're not going to use the "jit-composite" dconf key any more, you should remove it from both places in spread/app/spreadview.cpp, and from the schema.

I would also prefer reading UNITY2D_JIT_COMPOSITE in the SpreadView constructor to set a private boolean member of the class, which can be used throughout the lifetime of the spread. Env var can't be changed during runtime, so it avoids useless repeated reads.

qDebug() needed?

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

"buggy dconf binding" <- is there a bug for this?

lp:~dbarth/unity-2d/envvar-jit-flag updated
1159. By David Barth

suppress the dconf key previously added to control the jit flag

1160. By David Barth

read UNITY2D_JIT_COMPOSITE only once

Revision history for this message
David Barth (dbarth) wrote :

Le 07/08/2013 17:45, Gerry Boland a écrit :
> Review: Needs Fixing
>
> If you're not going to use the "jit-composite" dconf key any more, you should remove it from both places in spread/app/spreadview.cpp, and from the schema.
>
> I would also prefer reading UNITY2D_JIT_COMPOSITE in the SpreadView constructor to set a private boolean member of the class, which can be used throughout the lifetime of the spread. Env var can't be changed during runtime, so it avoids useless repeated reads.
>
> qDebug() needed?
Fixed in the last 2 revisions.

David

Revision history for this message
David Barth (dbarth) wrote :

Le 07/08/2013 19:30, Gerry Boland a écrit :
> "buggy dconf binding" <- is there a bug for this?
Nope, the recommendation was just to switch to the newer bindings, which
is why I resorted to using an environment variable in the end. Cost /
opportunity trade-off.

David

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

Sorry, I forgot about this, bad mail filter meant I missed notifications about this. Please make jenkins happy, then I'll review again.

Unmerged revisions

1160. By David Barth

read UNITY2D_JIT_COMPOSITE only once

1159. By David Barth

suppress the dconf key previously added to control the jit flag

1158. By David Barth

use a simple environment variable for the jit-composite flag, in lieu of the buggy dconf binding

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.h.in'
2--- config.h.in 2013-05-02 18:53:53 +0000
3+++ config.h.in 2013-08-08 13:19:13 +0000
4@@ -13,7 +13,6 @@
5 static const char* LAUNCHER2D_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";
6 static const char* PANEL2D_DCONF_SCHEMA = "com.canonical.Unity2d.Panel";
7 static const char* DASH2D_DCONF_SCHEMA = "com.canonical.Unity2d.Dash";
8-static const char* SPREAD2D_DCONF_SCHEMA = "com.canonical.Unity2d.Spread";
9
10 static const char* UNITY_DCONF_SCHEMA = "com.canonical.Unity";
11 static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity.Launcher";
12@@ -39,11 +38,6 @@
13 return configuration;
14 }
15
16-inline QConf& spread2dConfiguration() {
17- static QConf configuration(SPREAD2D_DCONF_SCHEMA);
18- return configuration;
19-}
20-
21 inline QConf& unityConfiguration() {
22 static QConf configuration(UNITY_DCONF_SCHEMA);
23 return configuration;
24
25=== modified file 'data/com.canonical.Unity2d.gschema.xml'
26--- data/com.canonical.Unity2d.gschema.xml 2013-04-15 17:35:36 +0000
27+++ data/com.canonical.Unity2d.gschema.xml 2013-08-08 13:19:13 +0000
28@@ -114,13 +114,4 @@
29 </description>
30 </key>
31 </schema>
32- <schema path="/com/canonical/unity-2d/spread/" id="com.canonical.Unity2d.Spread" gettext-domain="unity-2d">
33- <key type="b" name="jit-composite">
34- <default>false</default>
35- <summary>Use window compositing only when needed</summary>
36- <description>
37- If this option is enabled, Unity will not force all window surfaces to be redirected permanently, but only when window previews are to requested by the Spread feature. This option saves memory in the X server and helps optimizing the rendering pipeline on low-end systems.
38- </description>
39- </key>
40- </schema>
41 </schemalist>
42
43=== modified file 'spread/app/spreadview.cpp'
44--- spread/app/spreadview.cpp 2013-05-02 19:19:45 +0000
45+++ spread/app/spreadview.cpp 2013-08-08 13:19:13 +0000
46@@ -28,13 +28,23 @@
47 #include "config.h"
48 #include "compositorhelper.h"
49
50+static bool getenvBool(const char* name, bool defaultValue)
51+{
52+ QByteArray value = qgetenv(name);
53+ if (value.isEmpty()) {
54+ return defaultValue;
55+ }
56+ return value != "0";
57+}
58+
59 SpreadView::SpreadView(int screen)
60 : Unity2DDeclarativeView()
61 {
62 m_screenInfo = new ScreenInfo(screen, this);
63 connect(m_screenInfo, SIGNAL(panelsFreeGeometryChanged(QRect)), SLOT(fitToAvailableSpace()));
64
65- bool jitComposite = spread2dConfiguration().property("jit-composite").toBool();
66+ static bool jitComposite = getenvBool("UNITY2D_JIT_COMPOSITE", false);
67+
68 if (CompositorHelper::instance()->isCompositeSupported()
69 && ! jitComposite) {
70 CompositorHelper::instance()->activateComposite();

Subscribers

People subscribed via source and target branches