Merge lp:~vanvugt/compiz/fix-reredirect-flicker into lp:compiz/0.9.8

Proposed by Daniel van Vugt on 2012-09-20
Status: Merged
Approved by: Sam Spilsbury on 2012-09-20
Approved revision: 3381
Merged at revision: 3381
Proposed branch: lp:~vanvugt/compiz/fix-reredirect-flicker
Merge into: lp:compiz/0.9.8
Diff against target: 94 lines (+26/-0)
4 files modified
plugins/composite/include/composite/composite.h (+1/-0)
plugins/composite/src/privates.h (+1/-0)
plugins/composite/src/screen.cpp (+13/-0)
plugins/opengl/src/screen.cpp (+11/-0)
To merge this branch: bzr merge lp:~vanvugt/compiz/fix-reredirect-flicker
Reviewer Review Type Date Requested Status
Sam Spilsbury 2012-09-20 Approve on 2012-09-20
jenkins (community) continuous-integration Approve on 2012-09-20
Review via email: mp+125443@code.launchpad.net

Commit message

Changes to the composite output window's shape seem to take a full frame to be
realized by GLX/the server. This results in a single frame of flicker when an
unredirected window gets redirected, but the shape change is still not
realized.

To work around this flicker, just skip the one frame where it's going to
occur so you never see it.
(LP: #1046664)

Description of the change

See commit message.

Yes, I did try XSync to force shape changes to be realized before we render but it still doesn't work. Only skipping a frame seems to work.

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Sam Spilsbury (smspillaz) wrote :

This is fine, although ideally we should probably move the unredirection code into paintOutputs and not paintOutputRegion - then we can update the output window and not worry about frame skips. That's nontrivial though, so lets leave it for later.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/composite/include/composite/composite.h'
2--- plugins/composite/include/composite/composite.h 2012-07-02 07:07:32 +0000
3+++ plugins/composite/include/composite/composite.h 2012-09-20 09:46:21 +0000
4@@ -205,6 +205,7 @@
5 void showOutputWindow ();
6 void hideOutputWindow ();
7 void updateOutputWindow ();
8+ bool outputWindowChanged () const;
9
10 Window overlay ();
11 Window output ();
12
13=== modified file 'plugins/composite/src/privates.h'
14--- plugins/composite/src/privates.h 2012-07-02 07:07:32 +0000
15+++ plugins/composite/src/privates.h 2012-09-20 09:46:21 +0000
16@@ -93,6 +93,7 @@
17 CompPoint windowPaintOffset;
18
19 int overlayWindowCount;
20+ bool outputShapeChanged;
21
22 struct timeval lastRedraw;
23 int redrawTime;
24
25=== modified file 'plugins/composite/src/screen.cpp'
26--- plugins/composite/src/screen.cpp 2012-07-30 12:55:44 +0000
27+++ plugins/composite/src/screen.cpp 2012-09-20 09:46:21 +0000
28@@ -281,6 +281,7 @@
29 exposeRects (),
30 windowPaintOffset (0, 0),
31 overlayWindowCount (0),
32+ outputShapeChanged (false),
33 redrawTime (1000 / FALLBACK_REFRESH_RATE),
34 optimalRedrawTime (1000 / FALLBACK_REFRESH_RATE),
35 scheduled (false),
36@@ -543,6 +544,8 @@
37 XFixesDestroyRegion (dpy, region);
38
39 damageScreen ();
40+
41+ priv->outputShapeChanged = true;
42 }
43 }
44
45@@ -591,10 +594,18 @@
46 0, 0, region);
47
48 XFixesDestroyRegion (dpy, region);
49+
50+ priv->outputShapeChanged = true;
51 }
52
53 }
54
55+bool
56+CompositeScreen::outputWindowChanged () const
57+{
58+ return priv->outputShapeChanged;
59+}
60+
61 void
62 PrivateCompositeScreen::makeOutputWindow ()
63 {
64@@ -833,6 +844,8 @@
65
66 donePaint ();
67
68+ priv->outputShapeChanged = false;
69+
70 foreach (CompWindow *w, screen->windows ())
71 {
72 if (w->destroyed ())
73
74=== modified file 'plugins/opengl/src/screen.cpp'
75--- plugins/opengl/src/screen.cpp 2012-09-13 08:35:17 +0000
76+++ plugins/opengl/src/screen.cpp 2012-09-20 09:46:21 +0000
77@@ -2035,6 +2035,17 @@
78 gScreen->glPaintCompositedOutput (screen->region (), scratchFbo, mask);
79 }
80
81+ if (cScreen->outputWindowChanged ())
82+ {
83+ /*
84+ * Changes to the composite output window seem to take a whole frame
85+ * to take effect. So to avoid a visible flicker, we skip this frame
86+ * and do a full redraw next time.
87+ */
88+ cScreen->damageScreen ();
89+ return;
90+ }
91+
92 bool alwaysSwap = optionGetAlwaysSwapBuffers ();
93 bool fullscreen = useFbo ||
94 alwaysSwap ||

Subscribers

People subscribed via source and target branches