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

Proposed by Eleni Maria Stea
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
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) Approve
PS Jenkins bot continuous-integration Pending
Marco Trevisan (Treviño) 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.
Revision history for this message
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
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2016-06-21 01:28:26 +0000
+++ plugins/unityshell/src/unityshell.cpp 2016-07-02 17:13:04 +0000
@@ -863,7 +863,7 @@
863 cScreen->damageRegion(CompRegionFromNuxGeo(blur_update));863 cScreen->damageRegion(CompRegionFromNuxGeo(blur_update));
864}864}
865865
866void UnityScreen::paintDisplay()866void UnityScreen::paintOutput()
867{867{
868 CompOutput *output = last_output_;868 CompOutput *output = last_output_;
869869
@@ -884,7 +884,7 @@
884 current_draw_binding = old_read_binding;884 current_draw_binding = old_read_binding;
885#endif885#endif
886886
887 BackgroundEffectHelper::monitor_rect_.Set(0, 0, screen->width(), screen->height());887 BackgroundEffectHelper::monitor_rect_.Set(0, 0, output->width(), output->height());
888888
889 // If we have dirty helpers re-copy the backbuffer into a texture889 // If we have dirty helpers re-copy the backbuffer into a texture
890 if (dirty_helpers_on_this_frame_)890 if (dirty_helpers_on_this_frame_)
@@ -909,10 +909,10 @@
909909
910 for (CompRect const& rect : blur_region.rects())910 for (CompRect const& rect : blur_region.rects())
911 {911 {
912 int x = nux::Clamp<int>(rect.x(), 0, screen->width());912 int x = nux::Clamp<int>(rect.x(), 0, output->width());
913 int y = nux::Clamp<int>(screen->height() - rect.y2(), 0, screen->height());913 int y = nux::Clamp<int>(output->height() - rect.y2(), 0, output->height());
914 int width = std::min<int>(screen->width() - rect.x(), rect.width());914 int width = std::min<int>(output->width() - rect.x(), rect.width());
915 int height = std::min<int>(screen->height() - y, rect.height());915 int height = std::min<int>(output->height() - y, rect.height());
916916
917 CHECKGL(glCopyTexSubImage2D(surface_target, 0, x, y, x, y, width, height));917 CHECKGL(glCopyTexSubImage2D(surface_target, 0, x, y, x, y, width, height));
918 }918 }
@@ -1504,7 +1504,7 @@
1504 doShellRepaint = false;1504 doShellRepaint = false;
15051505
1506 if (doShellRepaint)1506 if (doShellRepaint)
1507 paintDisplay();1507 paintOutput();
15081508
1509 return ret;1509 return ret;
1510}1510}
@@ -3094,18 +3094,18 @@
30943094
3095 if (uScreen->doShellRepaint && window == uScreen->onboard_)3095 if (uScreen->doShellRepaint && window == uScreen->onboard_)
3096 {3096 {
3097 uScreen->paintDisplay();3097 uScreen->paintOutput();
3098 }3098 }
3099 else if (uScreen->doShellRepaint &&3099 else if (uScreen->doShellRepaint &&
3100 window == uScreen->firstWindowAboveShell &&3100 window == uScreen->firstWindowAboveShell &&
3101 !uScreen->forcePaintOnTop() &&3101 !uScreen->forcePaintOnTop() &&
3102 !uScreen->fullscreenRegion.contains(window->geometry()))3102 !uScreen->fullscreenRegion.contains(window->geometry()))
3103 {3103 {
3104 uScreen->paintDisplay();3104 uScreen->paintOutput();
3105 }3105 }
3106 else if (locked && CanBypassLockScreen())3106 else if (locked && CanBypassLockScreen())
3107 {3107 {
3108 uScreen->paintDisplay();3108 uScreen->paintOutput();
3109 }3109 }
31103110
3111 enum class DrawPanelShadow3111 enum class DrawPanelShadow
31123112
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2016-06-06 14:05:18 +0000
+++ plugins/unityshell/src/unityshell.h 2016-07-02 17:13:04 +0000
@@ -179,7 +179,7 @@
179 void nuxEpilogue();179 void nuxEpilogue();
180180
181 /* nux draw wrapper */181 /* nux draw wrapper */
182 void paintDisplay();182 void paintOutput();
183 void paintPanelShadow(CompRegion const& clip);183 void paintPanelShadow(CompRegion const& clip);
184 void setPanelShadowMatrix(const GLMatrix& matrix);184 void setPanelShadowMatrix(const GLMatrix& matrix);
185 void updateBlurDamage();185 void updateBlurDamage();