Merge lp:~compiz-team/compiz/compiz.fix_1127866 into lp:compiz/0.9.9

Proposed by Sam Spilsbury
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3609
Merged at revision: 3609
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1127866
Merge into: lp:compiz/0.9.9
Diff against target: 272 lines (+207/-6)
7 files modified
debian/changelog (+10/-0)
debian/compiz-plugins-default.install (+1/-0)
debian/compiz-plugins.install (+0/-1)
debian/patches/100_workaround_virtualbox_hang.patch (+176/-0)
debian/patches/series (+1/-0)
debian/profile_upgrades/com.canonical.unity.unity.03.upgrade (+2/-0)
plugins/opengl/DRIVERS (+17/-5)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1127866
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+148927@code.launchpad.net

Commit message

Workaround hangs in glXBindTexImageEXT - we need a server grab for the
external pixmap case, but we can just revert to using copytex if using
VirtualBox for now.

(LP: #1127866)

Description of the change

Workaround hangs in glXBindTexImageEXT - we need a server grab for the
external pixmap case, but we can just revert to using copytex if using
VirtualBox for now.

(LP: #1127866)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

That's ok for now, let's wait the proper patch to go in upstream before reverting this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-02-08 04:01:48 +0000
3+++ debian/changelog 2013-02-17 07:32:24 +0000
4@@ -1,3 +1,13 @@
5+compiz (1:0.9.9~daily13.02.08-0ubuntu2) UNRELEASED; urgency=low
6+
7+ * debian/patches/100_workaround_virtualbox_hang.patch
8+ - VirtualBox uses a shared-memory texture_from_pixmap_implementation
9+ which is not compatible with our server grab usage, so force
10+ a different bind method when running with virtualbox and binding
11+ an externally managed texture
12+
13+ -- Sam Spilsbury <smspillaz@gmail.com> Sun, 17 Feb 2013 10:26:40 +0800
14+
15 compiz (1:0.9.9~daily13.02.08-0ubuntu1) raring; urgency=low
16
17 [ MC Return ]
18
19=== modified file 'debian/compiz-plugins-default.install'
20--- debian/compiz-plugins-default.install 2012-06-19 11:22:48 +0000
21+++ debian/compiz-plugins-default.install 2013-02-17 07:32:24 +0000
22@@ -1,6 +1,7 @@
23 debian/tmp/usr/*/compiz/*animation.*
24 debian/tmp/usr/*/compiz/*compiztoolbox.*
25 debian/tmp/usr/*/compiz/*composite.*
26+debian/tmp/usr/*/compiz/*copytex.*
27 debian/tmp/usr/*/compiz/*decor.*
28 debian/tmp/usr/*/compiz/*expo.*
29 debian/tmp/usr/*/compiz/*ezoom.*
30
31=== modified file 'debian/compiz-plugins.install'
32--- debian/compiz-plugins.install 2013-02-05 12:51:42 +0000
33+++ debian/compiz-plugins.install 2013-02-17 07:32:24 +0000
34@@ -3,7 +3,6 @@
35 debian/tmp/usr/*/compiz/*bench.*
36 debian/tmp/usr/*/compiz/*clone.*
37 debian/tmp/usr/*/compiz/*commands.*
38-debian/tmp/usr/*/compiz/*copytex.*
39 debian/tmp/usr/*/compiz/*crashhandler.*
40 debian/tmp/usr/*/compiz/*cube.*
41 debian/tmp/usr/*/compiz/*cubeaddon.*
42
43=== added file 'debian/patches/100_workaround_virtualbox_hang.patch'
44--- debian/patches/100_workaround_virtualbox_hang.patch 1970-01-01 00:00:00 +0000
45+++ debian/patches/100_workaround_virtualbox_hang.patch 2013-02-17 07:32:24 +0000
46@@ -0,0 +1,176 @@
47+Index: compiz/plugins/opengl/include/opengl/opengl.h
48+===================================================================
49+--- compiz.orig/plugins/opengl/include/opengl/opengl.h 2013-02-17 10:22:08.012876000 +0800
50++++ compiz/plugins/opengl/include/opengl/opengl.h 2013-02-17 10:23:36.643958000 +0800
51+@@ -578,6 +578,17 @@
52+
53+ extern GLScreenPaintAttrib defaultScreenPaintAttrib;
54+
55++namespace compiz
56++{
57++namespace opengl
58++{
59++namespace internal
60++{
61++class DriverWorkaroundQuery;
62++}
63++}
64++}
65++
66+ class GLScreen;
67+ class GLFramebufferObject;
68+ class GLScreenInterface;
69+@@ -770,6 +781,13 @@
70+
71+ bool glInitContext (XVisualInfo *);
72+
73++ /**
74++ * This is only meant to be used internally, here to avoid unnecessarily
75++ * breaking the API and ABI. Fetch any driver workarounds in place
76++ */
77++ const compiz::opengl::internal::DriverWorkaroundQuery &
78++ fetchDriverWorkarounds ();
79++
80+ WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput,
81+ const GLScreenPaintAttrib &, const GLMatrix &,
82+ const CompRegion &, CompOutput *, unsigned int);
83+Index: compiz/plugins/opengl/src/privates.h
84+===================================================================
85+--- compiz.orig/plugins/opengl/src/privates.h 2013-02-17 10:22:08.012876000 +0800
86++++ compiz/plugins/opengl/src/privates.h 2013-02-17 10:23:36.643958000 +0800
87+@@ -46,6 +46,24 @@
88+
89+ extern CompOutput *targetOutput;
90+
91++namespace compiz
92++{
93++namespace opengl
94++{
95++namespace internal
96++{
97++class DriverWorkaroundQuery
98++{
99++ public:
100++
101++ virtual ~DriverWorkaroundQuery () {};
102++
103++ virtual bool unsafeForExternalBinds () const = 0;
104++};
105++}
106++}
107++}
108++
109+ class GLDoubleBuffer :
110+ public compiz::opengl::DoubleBuffer
111+ {
112+@@ -122,6 +140,7 @@
113+ class PrivateGLScreen :
114+ public ScreenInterface,
115+ public compiz::composite::PaintHandler,
116++ public compiz::opengl::internal::DriverWorkaroundQuery,
117+ public OpenglOptions
118+ {
119+ public:
120+@@ -206,6 +225,7 @@
121+ std::vector<GLTexture::BindPixmapProc> bindPixmap;
122+ bool hasCompositing;
123+ bool commonFrontbuffer;
124++ bool sharedMemoryTFP;
125+ bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect
126+ // refresh rate, causing us to miss vblanks
127+
128+@@ -225,6 +245,10 @@
129+
130+ mutable CompString prevRegex;
131+ mutable bool prevBlacklisted;
132++
133++ private:
134++
135++ bool unsafeForExternalBinds () const;
136+ };
137+
138+ class PrivateGLWindow :
139+Index: compiz/plugins/opengl/src/screen.cpp
140+===================================================================
141+--- compiz.orig/plugins/opengl/src/screen.cpp 2013-02-17 10:22:08.012876000 +0800
142++++ compiz/plugins/opengl/src/screen.cpp 2013-02-17 10:23:36.643958000 +0800
143+@@ -67,6 +67,7 @@
144+
145+
146+ using namespace compiz::opengl;
147++namespace cglint = compiz::opengl::internal;
148+
149+ namespace GL {
150+ #ifdef USE_GLES
151+@@ -359,6 +360,18 @@
152+ #endif
153+
154+ bool
155++PrivateGLScreen::unsafeForExternalBinds () const
156++{
157++ return sharedMemoryTFP;
158++}
159++
160++const cglint::DriverWorkaroundQuery &
161++GLScreen::fetchDriverWorkarounds ()
162++{
163++ return *priv;
164++}
165++
166++bool
167+ GLScreen::glInitContext (XVisualInfo *visinfo)
168+ {
169+ #ifndef USE_GLES
170+@@ -660,6 +673,7 @@
171+
172+ priv->commonFrontbuffer = true;
173+ priv->incorrectRefreshRate = false;
174++ priv->sharedMemoryTFP = false;
175+ if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe"))
176+ {
177+ /*
178+@@ -680,6 +694,18 @@
179+ priv->incorrectRefreshRate = true;
180+ }
181+
182++ if (glVendor != NULL && strstr (glVendor, "Humper"))
183++ {
184++ /*
185++ * VirtualBox uses XShm/XCopyArea in order to implement
186++ * texture_from_pixmap. Because of this, they require
187++ * a second X connection to track damage events and
188++ * changes to the pixmap, and this is incompatible with
189++ * taking a server grab on when querying and binding
190++ * externally managed pixmaps */
191++ priv->sharedMemoryTFP = true;
192++ }
193++
194+ if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))
195+ GL::textureNonPowerOfTwo = true;
196+ GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo;
197+Index: compiz/plugins/opengl/src/texture.cpp
198+===================================================================
199+--- compiz.orig/plugins/opengl/src/texture.cpp 2013-02-17 10:22:08.012876000 +0800
200++++ compiz/plugins/opengl/src/texture.cpp 2013-02-17 10:23:36.643958000 +0800
201+@@ -41,6 +41,7 @@
202+ #include "glx-tfp-bind.h"
203+
204+ namespace cgl = compiz::opengl;
205++namespace cglint = compiz::opengl::internal;
206+
207+ #ifdef USE_GLES
208+ std::map<Damage, EglTexture*> boundPixmapTex;
209+@@ -648,6 +649,13 @@
210+ !GL::textureFromPixmap)
211+ return GLTexture::List ();
212+
213++ GLScreen *gs = GLScreen::get (screen);
214++ const cglint::DriverWorkaroundQuery &query (gs->fetchDriverWorkarounds ());
215++
216++ if (query.unsafeForExternalBinds () &&
217++ source == cgl::ExternallyManaged)
218++ return GLTexture::List ();
219++
220+ GLTexture::List rv (1);
221+ TfpTexture *tex = NULL;
222+ unsigned int target = 0;
223
224=== modified file 'debian/patches/series'
225--- debian/patches/series 2012-12-10 03:28:47 +0000
226+++ debian/patches/series 2013-02-17 07:32:24 +0000
227@@ -5,3 +5,4 @@
228 ccsm_disable_unity_checkbox.patch
229 99_valid_ccsm_desktop_file.patch
230 unity_support_test.patch
231+100_workaround_virtualbox_hang.patch
232
233=== added file 'debian/profile_upgrades/com.canonical.unity.unity.03.upgrade'
234--- debian/profile_upgrades/com.canonical.unity.unity.03.upgrade 1970-01-01 00:00:00 +0000
235+++ debian/profile_upgrades/com.canonical.unity.unity.03.upgrade 2013-02-17 07:32:24 +0000
236@@ -0,0 +1,2 @@
237+[core]
238++s0_active_plugins = copytex
239
240=== modified file 'plugins/opengl/DRIVERS'
241--- plugins/opengl/DRIVERS 2012-09-25 07:26:36 +0000
242+++ plugins/opengl/DRIVERS 2013-02-17 07:32:24 +0000
243@@ -53,12 +53,24 @@
244 RESOLVED. WORKAROUND: detect when llvmpipe is active and force the usage
245 of glXSwapBuffers on every frame
246
247+ 2. llvmpipe will crash when a pixmap does not exist on the server
248+ side and glXBindTexImageEXT is used on it.
249+
250+ RESOLVED. WORKAROUND: grab the server, query the server as to
251+ whether or not the pixmap exists, call glXBindTexImageEXT and
252+ then release the server grab. This will ensure we never call
253+ glXBindTexImageEXT on a destroyed pixmap.
254+
255 virtualbox
256 ==========
257
258- 1. vboxdrv may open a new X Server connection on the first call to
259- glXBindTexImageEXT. If compiz has a server grab during this time
260- (see the GLX_EXT_texture_from_pixmap spec s. 5) then compiz
261- will deadlock
262+ 1. vboxdrv requires the usage of a second X Server connection
263+ inside of glXBindTexImageEXT. If compiz requires a server
264+ grab at this time (eg, the pixmap may not have its lifetime
265+ managed by us, see issue #2 in llvmpipe), then the driver
266+ will hang in glXBindTexImageEXT as it must use this connection
267+ in order to listen for any new damage events.
268
269- RESOLVED. WORKAROUND: don't implement this part of the spec for now
270+ RESOLVED. WORKAROUND: force the usage of the copy-to-texture path
271+ when using this driver ("Chromium") and binding an externally
272+ managed pixmap to a texture

Subscribers

People subscribed via source and target branches