Merge lp:~thumper/unity/regional-damage-sru into lp:unity/5.0

Proposed by Tim Penhey
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
Merged at revision: 2394
Proposed branch: lp:~thumper/unity/regional-damage-sru
Merge into: lp:unity/5.0
Diff against target: 784 lines (+353/-117)
12 files modified
manual-tests/Dash.txt (+15/-0)
manual-tests/Launcher.txt (+15/-0)
manual-tests/Panel.txt (+17/-0)
manual-tests/WindowManagement.txt (+20/-0)
plugins/unityshell/src/AbstractLauncherIcon.h (+1/-0)
plugins/unityshell/src/Launcher.cpp (+11/-0)
plugins/unityshell/src/Launcher.h (+4/-0)
plugins/unityshell/src/LauncherIcon.cpp (+3/-0)
plugins/unityshell/src/PanelController.cpp (+15/-0)
plugins/unityshell/src/PanelController.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+239/-110)
plugins/unityshell/src/unityshell.h (+12/-7)
To merge this branch: bzr merge lp:~thumper/unity/regional-damage-sru
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Marco Trevisan (Treviño) Approve
Daniel van Vugt Approve
Review via email: mp+116796@code.launchpad.net

Commit message

Backport the fixes for regional damage, and the regressions that were introduced by it.
Fixes lots of bugs.

Description of the change

This branch backports the fixes for regional damage, and the regression that were introduced by it.

Fixes lots of bugs.

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

Please note: This proposal has two external prerequisite fixes:
  bug 1012956 (already fixed in lp:compiz-core/0.9.7)
  bug 1014610 (already fixed in lp:nux/2.0)

It appears neither of these fixes have hit ubuntu yet.

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

Looks OK but keeps crashing when I run it on nvidia-295.49. The crash does not happen with lp:unity/5.0 !?

(gdb) bt
#0 0x00007fb402b65e1e in ?? () from /usr/lib/nvidia-current-updates/libnvidia-glcore.so.295.49
#1 0x00007fb402c09da1 in ?? () from /usr/lib/nvidia-current-updates/libnvidia-glcore.so.295.49
#2 0x00007fb402e0ada1 in ?? () from /usr/lib/nvidia-current-updates/libnvidia-glcore.so.295.49
#3 0x00007fb402e081f3 in ?? () from /usr/lib/nvidia-current-updates/libnvidia-glcore.so.295.49
#4 0x00007fb3ff4df22a in nux::GraphicsEngine::QRP_GLSL_1Tex(int, int, int, int, nux::ObjectPtr<nux::IOpenGLBaseTexture>, nux::TexCoordXForm&, nux::color::Color const&) ()
   from /usr/lib/libnux-graphics-2.0.so.0
#5 0x00007fb3ff4c98e9 in nux::GraphicsEngine::QRP_1Tex(int, int, int, int, nux::ObjectPtr<nux::IOpenGLBaseTexture>, nux::TexCoordXForm&, nux::color::Color const&) ()
   from /usr/lib/libnux-graphics-2.0.so.0
#6 0x00007fb3ff822891 in nux::WindowCompositor::PresentBufferToScreen(nux::ObjectPtr<nux::IOpenGLBaseTexture>, int, int, bool, bool, float, bool) () from /usr/lib/libnux-2.0.so.0
#7 0x00007fb3ff825990 in nux::WindowCompositor::RenderTopViews(bool, std::list<nux::ObjectWeakPtr<nux::BaseWindow>, std::allocator<nux::ObjectWeakPtr<nux::BaseWindow> > >&, bool) ()
   from /usr/lib/libnux-2.0.so.0
#8 0x00007fb3ff825cca in nux::WindowCompositor::Draw(bool, bool) () from /usr/lib/libnux-2.0.so.0
#9 0x00007fb3ff82ccb1 in nux::WindowThread::RenderInterfaceFromForeignCmd(nux::Rect*) () from /usr/lib/libnux-2.0.so.0
#10 0x00007fb4003e8cc4 in unity::UnityScreen::paintDisplay (this=0x1f07220, region=..., transform=..., mask=65536) at /home/dan/bzr/unity/tim/plugins/unityshell/src/unityshell.cpp:829

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

And yes I did try compiling the latest lp:nux/2.0 as well. But when I use it, I get NO readable stacktrace of the crash.

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

Uninstalled nvidia-295.49 and tested with nouveau. Now it works well.

Can anyone else confirm the nvidia crash?

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

Verified; works on intel too. Why is only nvidia broken?!

Revision history for this message
Brenton Hall (brent-hall-27) wrote :

Compiled it. Running fine on ATI, using the open drivers.

Revision history for this message
Brenton Hall (brent-hall-27) wrote :

Been through the new manual tests for this branch. They all passed for ATI.

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

Tested Unit 6.0 and Nux 3.0 again. They now crash in the same way on nvidia. So it's nothing to do with this branch.

I also upgraded nvidia 295.40 to 295.49 but no difference (other than the stack traces are now completely unreadable).

I suspect the nvidia problem could be related to bug 982485 or bug 980298. When run under valgrind, I get a rubbish stack, but it happens immediately after bug 988880, which might be relevant.

Anyway, this branch seems good but I can't test it on nvidia-current/nvidia-current-updates.

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

Actually, bug 982626 seems to describe the exact crash I'm getting now. Let's make that a separate discussion to this.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I can confirm the crash on a Nvidia GeForce GT 650M, the first time I launched this unity branch it worked and it also seemed to fix the bug #915265, however it hanged and after reloading compiz (one or two times), I can't run it anymore.

Gdb complains issues related to the nvidia bloab, so... It's not helpful at all.

The same happens with trunk with this change enabled.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I would probably like to have this fixed before releasing this as an SRU. I know we have the same bug in trunk and quantal, but Precise is a LTS, so we probably shouldn't release anything that has any known ill side-effects. So fixing bug #982626 becomes rather a priority here.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

FYI this is the stacktrace of the crash that I'm getting http://paste.ubuntu.com/1121725/

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

A weird thing about this crash is that if I replace an unity sesssion, from unity it will always crash.
If I replace it after a tty switch, then there's no crash...

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Using a bad workaround like this, seems to bypass the crash... http://paste.ubuntu.com/1122495/
Checking something better.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ok, thanks to the Sam's tip, I got the proper fix for the crash that was affecting the nvidia cards (using the nvidia driver).

I've made a branch that fixes this, and that uses this one as prerequisite: lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash-5.0/+merge/117553

So, at this point I can approve this branch too.

review: Approve
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Since I already tested the branch, along with Alan and the Nice guys, I think it's safe to apply as the nvidia bug is getting handled as well.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'manual-tests/Dash.txt'
--- manual-tests/Dash.txt 2012-06-21 16:10:54 +0000
+++ manual-tests/Dash.txt 2012-07-26 05:12:23 +0000
@@ -203,6 +203,21 @@
203Outcome:203Outcome:
204 The Dash should close and the music file should open up in Firefox.204 The Dash should close and the music file should open up in Firefox.
205205
206
207DnD stacking
208------------
209
210Setup:
211#. Open the Dash (Super).
212
213Action:
214#. Drag any icon from the dash and wave it over the dash and launcher area.
215
216Outcome:
217 The icon being dragged is drawn on top of the dash and launcher. Never
218 below it.
219
220
206Lens Tests221Lens Tests
207============222============
208223
209224
=== modified file 'manual-tests/Launcher.txt'
--- manual-tests/Launcher.txt 2012-07-13 15:19:42 +0000
+++ manual-tests/Launcher.txt 2012-07-26 05:12:23 +0000
@@ -40,6 +40,21 @@
40 in the last used workspace.40 in the last used workspace.
4141
4242
43Test Alt+F1 KeyNavMode Rendering
44--------------------------------
45This test shows that the launcher is redrawing correctly during Alt+F1
46KeyNav mode.
47
48Action:
49#. Press Alt+F1 to enter keynav mode.
50#. Keep pressing the down arrow key until the highlighted launcher icon is the
51 bottom one (usually Trash).
52
53Outcome:
54 For every Down keypress, the next launcher icon down should be highlighted.
55 Verify each icon gets highlighted from top to bottom.
56
57
43Test Alt+F1 KeyNavMode Mouse Works58Test Alt+F1 KeyNavMode Mouse Works
44-------------------------------59-------------------------------
45This test shows that the mouse still works normally while keynav mode is active.60This test shows that the mouse still works normally while keynav mode is active.
4661
=== modified file 'manual-tests/Panel.txt'
--- manual-tests/Panel.txt 2012-04-05 22:21:55 +0000
+++ manual-tests/Panel.txt 2012-07-26 05:12:23 +0000
@@ -69,3 +69,20 @@
69Expected Result:69Expected Result:
70 The panel should stay translucent70 The panel should stay translucent
7171
72
73Panel (and Launcher) blinking/flickering
74-----------------------------------------
75Setup:
76#. Optionally install "emacs23"
77
78Actions:
79#. Open LibreOffice Impress.
80#. Click on "Click to add title" and "Click to add text" a few times.
81#. Optionally: Run emacs23
82#. Optionally: Open a large file in emacs23.
83#. Optionally: Scroll to the bottom of the file using Page Down.
84
85Outcome:
86 At no point during the actions should the panel (or launcher) blink or
87 flicker out of existence.
88
7289
=== modified file 'manual-tests/WindowManagement.txt'
--- manual-tests/WindowManagement.txt 2012-03-23 15:14:42 +0000
+++ manual-tests/WindowManagement.txt 2012-07-26 05:12:23 +0000
@@ -49,3 +49,23 @@
4949
50Outcome:50Outcome:
51 The window should be in the maximized state.51 The window should be in the maximized state.
52
53
54Fullscreen windows
55--------------------
56Tests rendering of fullscreen windows.
57
58Action:
59#. Set a window to full screen. e.g. F11 in a web browser.
60#. Verify you can scroll the window.
61#. Tap the Super key.
62#. Verify you can still scroll the window.
63
64Outcome:
65 The fullscreen window should never look corrupt and always be scrollable.
66
67Recovery (in case of failure):
68#. Tap the Super key again.
69#. Tap F11 to leave full screen.
70#. Press Super+S twice to force a full screen redraw.
71
5272
=== modified file 'plugins/unityshell/src/AbstractLauncherIcon.h'
--- plugins/unityshell/src/AbstractLauncherIcon.h 2012-07-16 11:03:18 +0000
+++ plugins/unityshell/src/AbstractLauncherIcon.h 2012-07-26 05:12:23 +0000
@@ -218,6 +218,7 @@
218218
219 sigc::signal<void, AbstractLauncherIcon::Ptr> needs_redraw;219 sigc::signal<void, AbstractLauncherIcon::Ptr> needs_redraw;
220 sigc::signal<void, AbstractLauncherIcon::Ptr> remove;220 sigc::signal<void, AbstractLauncherIcon::Ptr> remove;
221 sigc::signal<void, nux::ObjectPtr<nux::View>> tooltip_visible;
221 sigc::signal<void> visibility_changed;222 sigc::signal<void> visibility_changed;
222223
223 sigc::connection needs_redraw_connection;224 sigc::connection needs_redraw_connection;
224225
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-07-17 16:20:53 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-07-26 05:12:23 +0000
@@ -1655,6 +1655,11 @@
1655 }1655 }
1656}1656}
16571657
1658nux::ObjectPtr<nux::View> Launcher::GetActiveTooltip() const
1659{
1660 return _active_tooltip;
1661}
1662
1658void1663void
1659Launcher::SetActionState(LauncherActionState actionstate)1664Launcher::SetActionState(LauncherActionState actionstate)
1660{1665{
@@ -1815,6 +1820,7 @@
1815 EnsureAnimation();1820 EnsureAnimation();
18161821
1817 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));1822 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
1823 icon->tooltip_visible.connect(sigc::mem_fun(this, &Launcher::OnTooltipVisible));
1818}1824}
18191825
1820void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)1826void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)
@@ -1891,6 +1897,11 @@
1891 EnsureAnimation();1897 EnsureAnimation();
1892}1898}
18931899
1900void Launcher::OnTooltipVisible(nux::ObjectPtr<nux::View> view)
1901{
1902 _active_tooltip = view;
1903}
1904
1894void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)1905void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
1895{1906{
18961907
18971908
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2012-04-17 05:29:12 +0000
+++ plugins/unityshell/src/Launcher.h 2012-07-26 05:12:23 +0000
@@ -99,6 +99,8 @@
99 return _parent;99 return _parent;
100 };100 };
101101
102 nux::ObjectPtr<nux::View> GetActiveTooltip() const; // nullptr = no tooltip
103
102 virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);104 virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
103 virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);105 virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
104 virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);106 virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
@@ -276,6 +278,7 @@
276 void OnOrderChanged();278 void OnOrderChanged();
277279
278 void OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon);280 void OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon);
281 void OnTooltipVisible(nux::ObjectPtr<nux::View> view);
279282
280 void OnOverlayHidden(GVariant* data);283 void OnOverlayHidden(GVariant* data);
281 void OnOverlayShown(GVariant* data);284 void OnOverlayShown(GVariant* data);
@@ -314,6 +317,7 @@
314317
315 void DndReset();318 void DndReset();
316 void DndHoveredIconReset();319 void DndHoveredIconReset();
320 nux::ObjectPtr<nux::View> _active_tooltip;
317321
318 nux::HLayout* m_Layout;322 nux::HLayout* m_Layout;
319323
320324
=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
--- plugins/unityshell/src/LauncherIcon.cpp 2012-07-16 11:03:18 +0000
+++ plugins/unityshell/src/LauncherIcon.cpp 2012-07-26 05:12:23 +0000
@@ -524,6 +524,7 @@
524 LoadTooltip();524 LoadTooltip();
525 _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);525 _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
526 _tooltip->ShowWindow(!tooltip_text().empty());526 _tooltip->ShowWindow(!tooltip_text().empty());
527 tooltip_visible.emit(_tooltip);
527}528}
528529
529void530void
@@ -545,6 +546,7 @@
545546
546 if (_tooltip)547 if (_tooltip)
547 _tooltip->ShowWindow(false);548 _tooltip->ShowWindow(false);
549 tooltip_visible.emit(nux::ObjectPtr<nux::View>(nullptr));
548}550}
549551
550bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor)552bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor)
@@ -663,6 +665,7 @@
663{665{
664 if (_tooltip)666 if (_tooltip)
665 _tooltip->ShowWindow(false);667 _tooltip->ShowWindow(false);
668 tooltip_visible.emit(nux::ObjectPtr<nux::View>(nullptr));
666}669}
667670
668gboolean671gboolean
669672
=== modified file 'plugins/unityshell/src/PanelController.cpp'
--- plugins/unityshell/src/PanelController.cpp 2012-04-04 20:21:45 +0000
+++ plugins/unityshell/src/PanelController.cpp 2012-07-26 05:12:23 +0000
@@ -48,6 +48,7 @@
48 void QueueRedraw();48 void QueueRedraw();
4949
50 std::vector<Window> GetTrayXids() const;50 std::vector<Window> GetTrayXids() const;
51 std::vector<nux::View*> GetPanelViews() const;
51 std::vector<nux::Geometry> GetGeometries() const;52 std::vector<nux::Geometry> GetGeometries() const;
5253
53 // NOTE: nux::Property maybe?54 // NOTE: nux::Property maybe?
@@ -111,6 +112,15 @@
111 return xids;112 return xids;
112}113}
113114
115std::vector<nux::View*> Controller::Impl::GetPanelViews() const
116{
117 std::vector<nux::View*> views;
118 views.reserve(windows_.size());
119 for (auto window: windows_)
120 views.push_back(ViewForWindow(window));
121 return views;
122}
123
114std::vector<nux::Geometry> Controller::Impl::GetGeometries() const124std::vector<nux::Geometry> Controller::Impl::GetGeometries() const
115{125{
116 std::vector<nux::Geometry> geometries;126 std::vector<nux::Geometry> geometries;
@@ -337,6 +347,11 @@
337 return pimpl->GetTrayXids();347 return pimpl->GetTrayXids();
338}348}
339349
350std::vector<nux::View*> Controller::GetPanelViews() const
351{
352 return pimpl->GetPanelViews();
353}
354
340std::vector<nux::Geometry> Controller::GetGeometries() const355std::vector<nux::Geometry> Controller::GetGeometries() const
341{356{
342 return pimpl->GetGeometries();357 return pimpl->GetGeometries();
343358
=== modified file 'plugins/unityshell/src/PanelController.h'
--- plugins/unityshell/src/PanelController.h 2012-04-02 14:02:29 +0000
+++ plugins/unityshell/src/PanelController.h 2012-07-26 05:12:23 +0000
@@ -41,6 +41,7 @@
41 void QueueRedraw();41 void QueueRedraw();
4242
43 std::vector<Window> GetTrayXids() const;43 std::vector<Window> GetTrayXids() const;
44 std::vector<nux::View*> GetPanelViews() const;
44 std::vector<nux::Geometry> GetGeometries() const;45 std::vector<nux::Geometry> GetGeometries() const;
4546
46 // NOTE: nux::Property maybe?47 // NOTE: nux::Property maybe?
4748
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-07-13 17:56:23 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-07-26 05:12:23 +0000
@@ -115,8 +115,8 @@
115 , _redraw_handle(0)115 , _redraw_handle(0)
116 , newFocusedWindow(nullptr)116 , newFocusedWindow(nullptr)
117 , doShellRepaint(false)117 , doShellRepaint(false)
118 , didShellRepaint(false)
118 , allowWindowPaint(false)119 , allowWindowPaint(false)
119 , damaged(false)
120 , _key_nav_mode_requested(false)120 , _key_nav_mode_requested(false)
121 , _last_output(nullptr)121 , _last_output(nullptr)
122#ifndef USE_GLES122#ifndef USE_GLES
@@ -911,13 +911,14 @@
911 }911 }
912912
913 doShellRepaint = false;913 doShellRepaint = false;
914 damaged = false;914 didShellRepaint = true;
915}915}
916916
917bool UnityScreen::forcePaintOnTop ()917bool UnityScreen::forcePaintOnTop ()
918{918{
919 return !allowWindowPaint ||919 return !allowWindowPaint ||
920 ((switcher_controller_->Visible() || launcher_controller_->IsOverlayOpen())920 ((switcher_controller_->Visible() ||
921 PluginAdapter::Default()->IsExpoActive())
921 && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL))));922 && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL))));
922}923}
923924
@@ -1204,6 +1205,42 @@
1204 }1205 }
1205}1206}
12061207
1208bool UnityScreen::shellCouldBeHidden(CompOutput const& output)
1209{
1210 std::vector<Window> const& nuxwins(nux::XInputWindow::NativeHandleList());
1211
1212 // Loop through windows from front to back
1213 CompWindowList const& wins = screen->windows();
1214 for ( CompWindowList::const_reverse_iterator r = wins.rbegin()
1215 ; r != wins.rend()
1216 ; r++
1217 )
1218 {
1219 CompWindow* w = *r;
1220
1221 /*
1222 * The shell is hidden if there exists any window that fully covers
1223 * the output and is in front of all Nux windows on that output.
1224 */
1225 if (w->isMapped() &&
1226 !(w->state () & CompWindowStateHiddenMask) &&
1227 w->geometry().contains(output))
1228 {
1229 return true;
1230 }
1231 else
1232 {
1233 for (Window n : nuxwins)
1234 {
1235 if (w->id() == n && output.intersects(w->geometry()))
1236 return false;
1237 }
1238 }
1239 }
1240
1241 return false;
1242}
1243
1207/* called whenever we need to repaint parts of the screen */1244/* called whenever we need to repaint parts of the screen */
1208bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib,1245bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib,
1209 const GLMatrix& transform,1246 const GLMatrix& transform,
@@ -1213,7 +1250,20 @@
1213{1250{
1214 bool ret;1251 bool ret;
12151252
1216 doShellRepaint = true;1253 /*
1254 * Very important!
1255 * Don't waste GPU and CPU rendering the shell on every frame if you don't
1256 * need to. Doing so on every frame causes Nux to hog the GPU and slow down
1257 * ALL rendering. (LP: #988079)
1258 */
1259 bool force = forcePaintOnTop();
1260 doShellRepaint = force ||
1261 ( !region.isEmpty() &&
1262 ( !wt->GetDrawList().empty() ||
1263 (mask & PAINT_SCREEN_FULL_MASK)
1264 )
1265 );
1266
1217 allowWindowPaint = true;1267 allowWindowPaint = true;
1218 _last_output = output;1268 _last_output = output;
1219 paint_panel_ = false;1269 paint_panel_ = false;
@@ -1228,14 +1278,27 @@
1228 * once an fbo is bound any further1278 * once an fbo is bound any further
1229 * attempts to bind it will only increment1279 * attempts to bind it will only increment
1230 * its bind reference so make sure that1280 * its bind reference so make sure that
1231 * you always unbind as much as you bind */1281 * you always unbind as much as you bind
1232 _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));1282 *
1283 * But NOTE: It is only safe to bind the FBO if !shellCouldBeHidden.
1284 * Otherwise it's possible painting won't occur and that would
1285 * confuse the state of the FBO.
1286 */
1287 if (doShellRepaint && !shellCouldBeHidden(*output))
1288 _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));
1233#endif1289#endif
12341290
1291 // CompRegion has no clear() method. So this is the fastest alternative.
1292 fullscreenRegion = CompRegion();
1293 nuxRegion = CompRegion();
1294
1235 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */1295 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
1236 ret = gScreen->glPaintOutput(attrib, transform, region, output, mask);1296 ret = gScreen->glPaintOutput(attrib, transform, region, output, mask);
12371297
1238#ifndef USE_GLES1298#ifndef USE_GLES
1299 if (doShellRepaint && !force && fullscreenRegion.contains(*output))
1300 doShellRepaint = false;
1301
1239 if (doShellRepaint)1302 if (doShellRepaint)
1240 paintDisplay(region, transform, mask);1303 paintDisplay(region, transform, mask);
1241#endif1304#endif
@@ -1288,16 +1351,26 @@
1288 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)1351 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)
1289 wi->HandleAnimations (ms);1352 wi->HandleAnimations (ms);
12901353
1291 if (damaged)1354 compizDamageNux(cScreen->currentDamage());
1292 {
1293 damaged = false;
1294 damageNuxRegions();
1295 }
12961355
1356 didShellRepaint = false;
1357 firstWindowAboveShell = NULL;
1297}1358}
12981359
1299void UnityScreen::donePaint()1360void UnityScreen::donePaint()
1300{1361{
1362 /*
1363 * It's only safe to clear the draw list if drawing actually occurred
1364 * (i.e. the shell was not obscured behind a fullscreen window).
1365 * If you clear the draw list and drawing has not occured then you'd be
1366 * left with all your views thinking they're queued for drawing still and
1367 * would refuse to redraw when you return from fullscreen.
1368 * I think this is a Nux bug. ClearDrawList should ideally also mark all
1369 * the queued views as draw_cmd_queued_=false.
1370 */
1371 if (didShellRepaint)
1372 wt->ClearDrawList();
1373
1301 std::list <ShowdesktopHandlerWindowInterface *> remove_windows;1374 std::list <ShowdesktopHandlerWindowInterface *> remove_windows;
13021375
1303 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)1376 for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)
@@ -1318,35 +1391,116 @@
1318 cScreen->donePaint ();1391 cScreen->donePaint ();
1319}1392}
13201393
1394void UnityScreen::compizDamageNux(CompRegion const& damage)
1395{
1396 if (!launcher_controller_)
1397 return;
1398
1399 /*
1400 * Prioritise user interaction over active blur updates. So the general
1401 * slowness of the active blur doesn't affect the UI interaction performance.
1402 *
1403 * Also, BackgroundEffectHelper::ProcessDamage() is causing a feedback loop
1404 * while the dash is open. Calling it results in the NEXT frame (and the
1405 * current one?) to get some damage. This GetDrawList().empty() check avoids
1406 * that feedback loop and allows us to idle correctly.
1407 */
1408 if (wt->GetDrawList().empty())
1409 {
1410 CompRect::vector const& rects(damage.rects());
1411 for (CompRect const& r : rects)
1412 {
1413 nux::Geometry geo(r.x(), r.y(), r.width(), r.height());
1414 BackgroundEffectHelper::ProcessDamage(geo);
1415 }
1416 }
1417
1418 auto launchers = launcher_controller_->launchers();
1419 for (auto launcher : launchers)
1420 {
1421 if (!launcher->Hidden())
1422 {
1423 nux::Geometry geo = launcher->GetAbsoluteGeometry();
1424 CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height);
1425 if (damage.intersects(launcher_region))
1426 launcher->QueueDraw();
1427 nux::ObjectPtr<nux::View> tooltip = launcher->GetActiveTooltip();
1428 if (!tooltip.IsNull())
1429 {
1430 nux::Geometry tip = tooltip->GetAbsoluteGeometry();
1431 CompRegion tip_region(tip.x, tip.y, tip.width, tip.height);
1432 if (damage.intersects(tip_region))
1433 tooltip->QueueDraw();
1434 }
1435 }
1436 }
1437
1438 std::vector<nux::View*> const& panels(panel_controller_->GetPanelViews());
1439 for (nux::View* view : panels)
1440 {
1441 nux::Geometry geo = view->GetAbsoluteGeometry();
1442 CompRegion panel_region(geo.x, geo.y, geo.width, geo.height);
1443 if (damage.intersects(panel_region))
1444 view->QueueDraw();
1445 }
1446
1447 QuicklistManager* qm = QuicklistManager::Default();
1448 if (qm)
1449 {
1450 QuicklistView* view = qm->Current();
1451 if (view)
1452 {
1453 nux::Geometry geo = view->GetAbsoluteGeometry();
1454 CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height);
1455 if (damage.intersects(quicklist_region))
1456 view->QueueDraw();
1457 }
1458 }
1459}
1460
1321/* Grab changed nux regions and add damage rects for them */1461/* Grab changed nux regions and add damage rects for them */
1322void UnityScreen::damageNuxRegions()1462void UnityScreen::nuxDamageCompiz()
1323{1463{
1464 /*
1465 * WARNING: Nux bug LP: #1014610 (unbounded DrawList growth) will cause
1466 * this code to be called far too often in some cases and
1467 * Unity will appear to freeze for a while. Please ensure you
1468 * have Nux 3.0+ with the fix for LP: #1014610.
1469 */
1470
1471 if (!launcher_controller_ || !dash_controller_)
1472 return;
1473
1324 CompRegion nux_damage;1474 CompRegion nux_damage;
13251475
1326 if (damaged)1476 std::vector<nux::Geometry> const& dirty = wt->GetDrawList();
1327 return;1477 for (auto geo : dirty)
13281478 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
1329 std::vector<nux::Geometry> dirty = wt->GetDrawList();1479
1330 damaged = true;1480 if (launcher_controller_->IsOverlayOpen())
13311481 {
1332 for (std::vector<nux::Geometry>::iterator it = dirty.begin(), end = dirty.end();1482 nux::BaseWindow* dash_window = dash_controller_->window();
1333 it != end; ++it)1483 nux::Geometry const& geo = dash_window->GetAbsoluteGeometry();
1334 {1484 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
1335 nux::Geometry const& geo = *it;1485 }
1336 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);1486
1337 }1487 auto launchers = launcher_controller_->launchers();
13381488 for (auto launcher : launchers)
1339 nux::Geometry geo = wt->GetWindowCompositor().GetTooltipMainWindowGeometry();1489 {
1340 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);1490 if (!launcher->Hidden())
13411491 {
1342 geo = lastTooltipArea;1492 nux::ObjectPtr<nux::View> tooltip = launcher->GetActiveTooltip();
1343 nux_damage += CompRegion(lastTooltipArea.x, lastTooltipArea.y,1493 if (!tooltip.IsNull())
1344 lastTooltipArea.width, lastTooltipArea.height);1494 {
1495 nux::Geometry const& g = tooltip->GetAbsoluteGeometry();
1496 nux_damage += CompRegion(g.x, g.y, g.width, g.height);
1497 }
1498 }
1499 }
1500
1501 cScreen->damageRegionSetEnabled(this, false);
1345 cScreen->damageRegion(nux_damage);1502 cScreen->damageRegion(nux_damage);
13461503 cScreen->damageRegionSetEnabled(this, true);
1347 wt->ClearDrawList();
1348
1349 lastTooltipArea = geo;
1350}1504}
13511505
1352/* handle X Events */1506/* handle X Events */
@@ -1502,44 +1656,12 @@
1502 {1656 {
1503 wt->ProcessForeignEvent(event, NULL);1657 wt->ProcessForeignEvent(event, NULL);
1504 }1658 }
15051659}
1506 if (event->type == cScreen->damageEvent() + XDamageNotify)1660
1507 {1661void UnityScreen::damageRegion(const CompRegion &region)
1508 XDamageNotifyEvent *de = (XDamageNotifyEvent *) event;1662{
1509 CompWindow* w = screen->findWindow (de->drawable);1663 compizDamageNux(region);
1510 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();1664 cScreen->damageRegion(region);
1511 CompWindow* lastNWindow = screen->findWindow (xwns.back ());
1512 bool processDamage = true;
1513
1514 if (w)
1515 {
1516 if (!w->overrideRedirect () &&
1517 w->isViewable () &&
1518 !w->invisible ())
1519 {
1520
1521 for (; lastNWindow != NULL; lastNWindow = lastNWindow->next)
1522 {
1523 if (lastNWindow == w)
1524 {
1525 processDamage = false;
1526 break;
1527 }
1528 }
1529
1530 if (processDamage)
1531 {
1532 nux::Geometry damage (de->area.x, de->area.y, de->area.width, de->area.height);
1533
1534 const CompWindow::Geometry &geom = w->geometry ();
1535 damage.x += geom.x () + geom.border ();
1536 damage.y += geom.y () + geom.border ();
1537
1538 BackgroundEffectHelper::ProcessDamage(damage);
1539 }
1540 }
1541 }
1542 }
1543}1665}
15441666
1545void UnityScreen::handleCompizEvent(const char* plugin,1667void UnityScreen::handleCompizEvent(const char* plugin,
@@ -2195,14 +2317,6 @@
2195 return false;2317 return false;
2196}2318}
21972319
2198const CompWindowList& UnityScreen::getWindowPaintList()
2199{
2200 CompWindowList& pl = _withRemovedNuxWindows = cScreen->getWindowPaintList();
2201 pl.remove_if(isNuxWindow);
2202
2203 return pl;
2204}
2205
2206void UnityScreen::RaiseInputWindows()2320void UnityScreen::RaiseInputWindows()
2207{2321{
2208 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();2322 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
@@ -2227,6 +2341,42 @@
2227 const CompRegion& region,2341 const CompRegion& region,
2228 unsigned int mask)2342 unsigned int mask)
2229{2343{
2344 /*
2345 * The occlusion pass tests windows from TOP to BOTTOM. That's opposite to
2346 * the actual painting loop.
2347 *
2348 * Detect uScreen->fullscreenRegion here. That represents the region which
2349 * fully covers the shell on its output. It does not include regular windows
2350 * stacked above the shell like DnD icons or Onboard etc.
2351 */
2352 if (isNuxWindow(window))
2353 {
2354 if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
2355 {
2356 uScreen->nuxRegion += window->geometry();
2357 uScreen->nuxRegion -= uScreen->fullscreenRegion;
2358 }
2359 return false; // Ensure nux windows are never painted by compiz
2360 }
2361 else if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
2362 {
2363 static const unsigned int nonOcclusionBits =
2364 PAINT_WINDOW_TRANSLUCENT_MASK |
2365 PAINT_WINDOW_TRANSFORMED_MASK |
2366 PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
2367 if (!(mask & nonOcclusionBits) &&
2368 (window->state() & CompWindowStateFullscreenMask))
2369 // And I've been advised to test other things, but they don't work:
2370 // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw
2371 // && !window->alpha() <-- Doesn't work; Opaque windows often have alpha
2372 {
2373 uScreen->fullscreenRegion += window->geometry();
2374 uScreen->fullscreenRegion -= uScreen->nuxRegion;
2375 }
2376 if (uScreen->nuxRegion.isEmpty())
2377 uScreen->firstWindowAboveShell = window;
2378 }
2379
2230 GLWindowPaintAttrib wAttrib = attrib;2380 GLWindowPaintAttrib wAttrib = attrib;
22312381
2232 if (mMinimizeHandler)2382 if (mMinimizeHandler)
@@ -2285,28 +2435,17 @@
2285 }2435 }
2286 }2436 }
22872437
2288 if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop ())2438 if (uScreen->doShellRepaint &&
2439 !uScreen->forcePaintOnTop () &&
2440 window == uScreen->firstWindowAboveShell &&
2441 !uScreen->fullscreenRegion.contains(window->geometry())
2442 )
2289 {2443 {
2290 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
2291 unsigned int size = xwns.size();
2292
2293 for (CompWindow* w = window; w && uScreen->doShellRepaint; w = w->prev)
2294 {
2295 auto id = w->id();
2296
2297 for (unsigned int i = 0; i < size; ++i)
2298 {
2299 if (xwns[i] == id)
2300 {
2301#ifdef USE_GLES2444#ifdef USE_GLES
2302 uScreen->paintDisplay();2445 uScreen->paintDisplay();
2303#else2446#else
2304 uScreen->paintDisplay(region, matrix, mask);2447 uScreen->paintDisplay(region, matrix, mask);
2305#endif2448#endif
2306 break;
2307 }
2308 }
2309 }
2310 }2449 }
23112450
2312 if (window->type() == CompWindowTypeDesktopMask)2451 if (window->type() == CompWindowTypeDesktopMask)
@@ -2611,17 +2750,7 @@
26112750
2612void UnityScreen::onRedrawRequested()2751void UnityScreen::onRedrawRequested()
2613{2752{
2614 // disable blur updates so we dont waste perf. This can stall the blur during animations2753 nuxDamageCompiz();
2615 // but ensures a smooth animation.
2616 if (_in_paint)
2617 {
2618 if (!_redraw_handle)
2619 _redraw_handle = g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::OnRedrawTimeout, this, NULL);
2620 }
2621 else
2622 {
2623 damageNuxRegions();
2624 }
2625}2754}
26262755
2627/* Handle option changes and plug that into nux windows */2756/* Handle option changes and plug that into nux windows */
26282757
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-06-27 01:19:32 +0000
+++ plugins/unityshell/src/unityshell.h 2012-07-26 05:12:23 +0000
@@ -111,6 +111,9 @@
111 const char *eventName,111 const char *eventName,
112 CompOption::Vector &o);112 CompOption::Vector &o);
113113
114 void damageRegion(const CompRegion &region);
115
116 bool shellCouldBeHidden(CompOutput const& output);
114117
115 /* paint on top of all windows if we could not find a window118 /* paint on top of all windows if we could not find a window
116 * to paint underneath */119 * to paint underneath */
@@ -132,9 +135,6 @@
132 CompOutput*,135 CompOutput*,
133 unsigned int);136 unsigned int);
134137
135 /* Pop our InputOutput windows from the paint list */
136 const CompWindowList& getWindowPaintList();
137
138 /* handle X11 events */138 /* handle X11 events */
139 void handleEvent(XEvent*);139 void handleEvent(XEvent*);
140140
@@ -211,7 +211,10 @@
211211
212 static gboolean initPluginActions(gpointer data);212 static gboolean initPluginActions(gpointer data);
213 void initLauncher();213 void initLauncher();
214 void damageNuxRegions();214
215 void compizDamageNux(CompRegion const& region);
216 void nuxDamageCompiz();
217
215 void onRedrawRequested();218 void onRedrawRequested();
216 void Relayout();219 void Relayout();
217220
@@ -261,7 +264,6 @@
261 bool enable_shortcut_overlay_;264 bool enable_shortcut_overlay_;
262265
263 std::unique_ptr<GestureEngine> gesture_engine_;266 std::unique_ptr<GestureEngine> gesture_engine_;
264 nux::Geometry lastTooltipArea;
265 bool needsRelayout;267 bool needsRelayout;
266 bool _in_paint;268 bool _in_paint;
267 guint32 relayoutSourceId;269 guint32 relayoutSourceId;
@@ -280,11 +282,14 @@
280282
281 /* handle paint order */283 /* handle paint order */
282 bool doShellRepaint;284 bool doShellRepaint;
285 bool didShellRepaint;
283 bool allowWindowPaint;286 bool allowWindowPaint;
284 bool damaged;
285 bool _key_nav_mode_requested;287 bool _key_nav_mode_requested;
286 CompOutput* _last_output;288 CompOutput* _last_output;
287 CompWindowList _withRemovedNuxWindows;289
290 CompRegion nuxRegion;
291 CompRegion fullscreenRegion;
292 CompWindow* firstWindowAboveShell;
288293
289 nux::Property<nux::Geometry> primary_monitor_;294 nux::Property<nux::Geometry> primary_monitor_;
290295

Subscribers

People subscribed via source and target branches

to all changes: