Merge lp:~vanvugt/unity/fix-1024911 into lp:unity

Proposed by Daniel van Vugt
Status: Merged
Merged at revision: 2503
Proposed branch: lp:~vanvugt/unity/fix-1024911
Merge into: lp:unity
Diff against target: 103 lines (+65/-2)
3 files modified
manual-tests/WindowManagement.txt (+20/-0)
plugins/unityshell/src/unityshell.cpp (+43/-2)
plugins/unityshell/src/unityshell.h (+2/-0)
To merge this branch: bzr merge lp:~vanvugt/unity/fix-1024911
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Łukasz Zemczak Approve
jenkins (community) continuous-integration Approve
Review via email: mp+115063@code.launchpad.net

Commit message

Don't bind the FBO if it's possible it won't get painted and unbound. That
could lead the the screen freezing while fullscreen windows are open.
(LP: #1024911)

Description of the change

Don't bind the FBO if it's possible it won't get painted and unbound. That
could lead the the screen freezing while fullscreen windows are open.
(LP: #1024911)

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

And yes, I did think of doing a dummy paint/unbind of _fbo to solve this bug. However that would be wasting GPU resources and slow down rendering of fullscreen windows, which would defeat the whole purpose of the regionalDamage change.

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Works for me, Approved!

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Seems to conflict with the fix for bug 1024459

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I take that back the conflict is just a bug in the other proposal. This one was fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/WindowManagement.txt'
2--- manual-tests/WindowManagement.txt 2012-03-23 15:14:42 +0000
3+++ manual-tests/WindowManagement.txt 2012-07-16 05:58:22 +0000
4@@ -49,3 +49,23 @@
5
6 Outcome:
7 The window should be in the maximized state.
8+
9+
10+Fullscreen windows
11+--------------------
12+Tests rendering of fullscreen windows.
13+
14+Action:
15+#. Set a window to full screen. e.g. F11 in a web browser.
16+#. Verify you can scroll the window.
17+#. Tap the Super key.
18+#. Verify you can still scroll the window.
19+
20+Outcome:
21+ The fullscreen window should never look corrupt and always be scrollable.
22+
23+Recovery (in case of failure):
24+#. Tap the Super key again.
25+#. Tap F11 to leave full screen.
26+#. Press Super+S twice to force a full screen redraw.
27+
28
29=== modified file 'plugins/unityshell/src/unityshell.cpp'
30--- plugins/unityshell/src/unityshell.cpp 2012-07-12 23:09:29 +0000
31+++ plugins/unityshell/src/unityshell.cpp 2012-07-16 05:58:22 +0000
32@@ -1202,6 +1202,42 @@
33 }
34 }
35
36+bool UnityScreen::shellCouldBeHidden(CompOutput const& output)
37+{
38+ std::vector<Window> const& nuxwins(nux::XInputWindow::NativeHandleList());
39+
40+ // Loop through windows from front to back
41+ CompWindowList const& wins = screen->windows();
42+ for ( CompWindowList::const_reverse_iterator r = wins.rbegin()
43+ ; r != wins.rend()
44+ ; r++
45+ )
46+ {
47+ CompWindow* w = *r;
48+
49+ /*
50+ * The shell is hidden if there exists any window that fully covers
51+ * the output and is in front of all Nux windows on that output.
52+ */
53+ if (w->isMapped() &&
54+ !(w->state () & CompWindowStateHiddenMask) &&
55+ w->geometry().contains(output))
56+ {
57+ return true;
58+ }
59+ else
60+ {
61+ for (Window n : nuxwins)
62+ {
63+ if (w->id() == n && output.intersects(w->geometry()))
64+ return false;
65+ }
66+ }
67+ }
68+
69+ return false;
70+}
71+
72 /* called whenever we need to repaint parts of the screen */
73 bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib,
74 const GLMatrix& transform,
75@@ -1234,8 +1270,13 @@
76 * once an fbo is bound any further
77 * attempts to bind it will only increment
78 * its bind reference so make sure that
79- * you always unbind as much as you bind */
80- if (doShellRepaint)
81+ * you always unbind as much as you bind
82+ *
83+ * But NOTE: It is only safe to bind the FBO if !shellCouldBeHidden.
84+ * Otherwise it's possible painting won't occur and that would
85+ * confuse the state of the FBO.
86+ */
87+ if (doShellRepaint && !shellCouldBeHidden(*output))
88 _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));
89 #endif
90
91
92=== modified file 'plugins/unityshell/src/unityshell.h'
93--- plugins/unityshell/src/unityshell.h 2012-07-06 13:11:25 +0000
94+++ plugins/unityshell/src/unityshell.h 2012-07-16 05:58:22 +0000
95@@ -113,6 +113,8 @@
96
97 void damageRegion(const CompRegion &region);
98
99+ bool shellCouldBeHidden(CompOutput const& output);
100+
101 /* paint on top of all windows if we could not find a window
102 * to paint underneath */
103 bool glPaintOutput(const GLScreenPaintAttrib&,