Merge lp:~hikiko/unity/unity.multimonitor-speed-up into lp:unity

Proposed by Eleni Maria Stea on 2016-07-02
Status: Merged
Approved by: Andrea Azzarone on 2016-07-04
Approved revision: 4136
Merged at revision: 4145
Proposed branch: lp:~hikiko/unity/unity.multimonitor-speed-up
Merge into: lp:unity
Diff against target: 80 lines (+11/-11)
2 files modified
plugins/unityshell/src/unityshell.cpp (+10/-10)
plugins/unityshell/src/unityshell.h (+1/-1)
To merge this branch: bzr merge lp:~hikiko/unity/unity.multimonitor-speed-up
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) 2016-07-02 Approve on 2016-07-04
PS Jenkins bot continuous-integration Pending
Marco Trevisan (Treviño) 2016-07-02 Pending
Review via email: mp+298981@code.launchpad.net

Commit message

UnityScreen: only redraw parts of the screen visible in each output

We draw only the parts of the screen that are visible in each output (monitor) because compiz draws things per output anyway. Speeds up the drawing by about N times, where N is the number of monitors because:

We used to draw all monitors' content when 1 monitor was rendered (=> we rendered N times the N monitors' content). Now, we draw only the current monitor's content (we render 1 time each of the N monitors' content).

Description of the change

Fix for multi-monitor:
We draw only the parts of the screen that are visible in each output (monitor) because compiz draws things per output anyway. Speeds up the drawing by about N times, where N is the number of monitors because:

We used to draw all monitors' content when 1 monitor was rendered (=> we rendered N times the N monitors' content). Now, we draw only the current monitor's content (we render 1 time each of the N monitors' content).

To post a comment you must log in.
Andrea Azzarone (azzar1) wrote :

Works fine here.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2016-06-21 01:28:26 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2016-07-02 17:13:04 +0000
4@@ -863,7 +863,7 @@
5 cScreen->damageRegion(CompRegionFromNuxGeo(blur_update));
6 }
7
8-void UnityScreen::paintDisplay()
9+void UnityScreen::paintOutput()
10 {
11 CompOutput *output = last_output_;
12
13@@ -884,7 +884,7 @@
14 current_draw_binding = old_read_binding;
15 #endif
16
17- BackgroundEffectHelper::monitor_rect_.Set(0, 0, screen->width(), screen->height());
18+ BackgroundEffectHelper::monitor_rect_.Set(0, 0, output->width(), output->height());
19
20 // If we have dirty helpers re-copy the backbuffer into a texture
21 if (dirty_helpers_on_this_frame_)
22@@ -909,10 +909,10 @@
23
24 for (CompRect const& rect : blur_region.rects())
25 {
26- int x = nux::Clamp<int>(rect.x(), 0, screen->width());
27- int y = nux::Clamp<int>(screen->height() - rect.y2(), 0, screen->height());
28- int width = std::min<int>(screen->width() - rect.x(), rect.width());
29- int height = std::min<int>(screen->height() - y, rect.height());
30+ int x = nux::Clamp<int>(rect.x(), 0, output->width());
31+ int y = nux::Clamp<int>(output->height() - rect.y2(), 0, output->height());
32+ int width = std::min<int>(output->width() - rect.x(), rect.width());
33+ int height = std::min<int>(output->height() - y, rect.height());
34
35 CHECKGL(glCopyTexSubImage2D(surface_target, 0, x, y, x, y, width, height));
36 }
37@@ -1504,7 +1504,7 @@
38 doShellRepaint = false;
39
40 if (doShellRepaint)
41- paintDisplay();
42+ paintOutput();
43
44 return ret;
45 }
46@@ -3094,18 +3094,18 @@
47
48 if (uScreen->doShellRepaint && window == uScreen->onboard_)
49 {
50- uScreen->paintDisplay();
51+ uScreen->paintOutput();
52 }
53 else if (uScreen->doShellRepaint &&
54 window == uScreen->firstWindowAboveShell &&
55 !uScreen->forcePaintOnTop() &&
56 !uScreen->fullscreenRegion.contains(window->geometry()))
57 {
58- uScreen->paintDisplay();
59+ uScreen->paintOutput();
60 }
61 else if (locked && CanBypassLockScreen())
62 {
63- uScreen->paintDisplay();
64+ uScreen->paintOutput();
65 }
66
67 enum class DrawPanelShadow
68
69=== modified file 'plugins/unityshell/src/unityshell.h'
70--- plugins/unityshell/src/unityshell.h 2016-06-06 14:05:18 +0000
71+++ plugins/unityshell/src/unityshell.h 2016-07-02 17:13:04 +0000
72@@ -179,7 +179,7 @@
73 void nuxEpilogue();
74
75 /* nux draw wrapper */
76- void paintDisplay();
77+ void paintOutput();
78 void paintPanelShadow(CompRegion const& clip);
79 void setPanelShadowMatrix(const GLMatrix& matrix);
80 void updateBlurDamage();