Mir

Merge lp:~vanvugt/mir/testfix-1211700 into lp:mir

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~vanvugt/mir/testfix-1211700
Merge into: lp:mir
Diff against target: 82 lines (+18/-1)
2 files modified
src/server/compositor/multi_threaded_compositor.cpp (+10/-0)
src/server/compositor/stream.cpp (+8/-1)
To merge this branch: bzr merge lp:~vanvugt/mir/testfix-1211700
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing
Daniel van Vugt Disapprove
Review via email: mp+319410@code.launchpad.net

Commit message

Experimental test fix to work around drivers that lack adequate GPU
load balancing (LP: #1211700, LP: #1665802)

Description of the change

On radeon at least, this provides 10-400x improvement in compositor
performance (with an interval 0 client hogging the GPU), making the system usable:

radeon:
before: 0.05 FPS - 2 FPS
after: 20 FPS

nouveau:
before: 6 FPS
after: 6 FPS

freedreno (Alberto?):
before: ?
after: ?

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

For testing only.

review: Disapprove
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4078
https://mir-jenkins.ubuntu.com/job/mir-ci/3119/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4187/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4274
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4264
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4264
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4264
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4214/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4214/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4214/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4214/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4214/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4214
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4214/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4214/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3119/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

4078. By Daniel van Vugt

Rewrite the load balancing against latest trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/server/compositor/multi_threaded_compositor.cpp'
--- src/server/compositor/multi_threaded_compositor.cpp 2017-01-20 12:32:45 +0000
+++ src/server/compositor/multi_threaded_compositor.cpp 2017-03-09 09:52:49 +0000
@@ -32,6 +32,7 @@
32#include "mir/unwind_helpers.h"32#include "mir/unwind_helpers.h"
33#include "mir/thread_name.h"33#include "mir/thread_name.h"
3434
35#include <shared_mutex>
35#include <thread>36#include <thread>
36#include <chrono>37#include <chrono>
37#include <condition_variable>38#include <condition_variable>
@@ -48,6 +49,8 @@
48namespace compositor49namespace compositor
49{50{
5051
52extern std::shared_timed_mutex gpu_load_balance;
53
51class CompositingFunctor54class CompositingFunctor
52{55{
53public:56public:
@@ -113,6 +116,7 @@
113 try116 try
114 {117 {
115 std::unique_lock<std::mutex> lock{run_mutex};118 std::unique_lock<std::mutex> lock{run_mutex};
119 std::shared_lock<std::shared_timed_mutex> throttle(gpu_load_balance);
116 while (running)120 while (running)
117 {121 {
118 /* Wait until compositing has been scheduled or we are stopped */122 /* Wait until compositing has been scheduled or we are stopped */
@@ -140,6 +144,11 @@
140 auto& compositor = std::get<1>(tuple);144 auto& compositor = std::get<1>(tuple);
141 compositor->composite(scene->scene_elements_for(compositor.get()));145 compositor->composite(scene->scene_elements_for(compositor.get()));
142 }146 }
147
148 // Only allow unthrottled clients to saturate the GPU during
149 // page flipping where we're basically idle waiting for
150 // vblank...
151 throttle.unlock();
143 group.post();152 group.post();
144153
145 /*154 /*
@@ -153,6 +162,7 @@
153 force_sleep : group.recommended_sleep();162 force_sleep : group.recommended_sleep();
154 std::this_thread::sleep_for(delay);163 std::this_thread::sleep_for(delay);
155164
165 throttle.lock();
156 lock.lock();166 lock.lock();
157167
158 /*168 /*
159169
=== modified file 'src/server/compositor/stream.cpp'
--- src/server/compositor/stream.cpp 2017-03-08 19:29:37 +0000
+++ src/server/compositor/stream.cpp 2017-03-09 09:52:49 +0000
@@ -26,6 +26,7 @@
26#include "mir/compositor/frame_dropping_policy_factory.h"26#include "mir/compositor/frame_dropping_policy_factory.h"
27#include "mir/compositor/frame_dropping_policy.h"27#include "mir/compositor/frame_dropping_policy.h"
28#include <boost/throw_exception.hpp>28#include <boost/throw_exception.hpp>
29#include <shared_mutex>
2930
30namespace mc = mir::compositor;31namespace mc = mir::compositor;
31namespace geom = mir::geometry;32namespace geom = mir::geometry;
@@ -33,6 +34,10 @@
33namespace ms = mir::scene;34namespace ms = mir::scene;
34namespace geom = mir::geometry;35namespace geom = mir::geometry;
3536
37namespace mir { namespace compositor {
38 std::shared_timed_mutex gpu_load_balance;
39} } // namespace mir::compositor
40
36enum class mc::Stream::ScheduleMode {41enum class mc::Stream::ScheduleMode {
37 Queueing,42 Queueing,
38 Dropping43 Dropping
@@ -109,7 +114,9 @@
109 // IO. Holding it locked blocks the compositor thread(s) from rendering.114 // IO. Holding it locked blocks the compositor thread(s) from rendering.
110 if (deferred_io.valid())115 if (deferred_io.valid())
111 {116 {
112 // TODO: Throttling of GPU hogs goes here (LP: #1211700, LP: #1665802)117 // Throttle GPU hogs such that they can only saturate the GPU while
118 // no compositors are needing it (LP: #1211700, LP: #1665802)
119 { std::unique_lock<std::shared_timed_mutex> lock(gpu_load_balance); }
113 deferred_io.wait();120 deferred_io.wait();
114 }121 }
115}122}

Subscribers

People subscribed via source and target branches