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
1=== modified file 'src/server/compositor/multi_threaded_compositor.cpp'
2--- src/server/compositor/multi_threaded_compositor.cpp 2017-01-20 12:32:45 +0000
3+++ src/server/compositor/multi_threaded_compositor.cpp 2017-03-09 09:52:49 +0000
4@@ -32,6 +32,7 @@
5 #include "mir/unwind_helpers.h"
6 #include "mir/thread_name.h"
7
8+#include <shared_mutex>
9 #include <thread>
10 #include <chrono>
11 #include <condition_variable>
12@@ -48,6 +49,8 @@
13 namespace compositor
14 {
15
16+extern std::shared_timed_mutex gpu_load_balance;
17+
18 class CompositingFunctor
19 {
20 public:
21@@ -113,6 +116,7 @@
22 try
23 {
24 std::unique_lock<std::mutex> lock{run_mutex};
25+ std::shared_lock<std::shared_timed_mutex> throttle(gpu_load_balance);
26 while (running)
27 {
28 /* Wait until compositing has been scheduled or we are stopped */
29@@ -140,6 +144,11 @@
30 auto& compositor = std::get<1>(tuple);
31 compositor->composite(scene->scene_elements_for(compositor.get()));
32 }
33+
34+ // Only allow unthrottled clients to saturate the GPU during
35+ // page flipping where we're basically idle waiting for
36+ // vblank...
37+ throttle.unlock();
38 group.post();
39
40 /*
41@@ -153,6 +162,7 @@
42 force_sleep : group.recommended_sleep();
43 std::this_thread::sleep_for(delay);
44
45+ throttle.lock();
46 lock.lock();
47
48 /*
49
50=== modified file 'src/server/compositor/stream.cpp'
51--- src/server/compositor/stream.cpp 2017-03-08 19:29:37 +0000
52+++ src/server/compositor/stream.cpp 2017-03-09 09:52:49 +0000
53@@ -26,6 +26,7 @@
54 #include "mir/compositor/frame_dropping_policy_factory.h"
55 #include "mir/compositor/frame_dropping_policy.h"
56 #include <boost/throw_exception.hpp>
57+#include <shared_mutex>
58
59 namespace mc = mir::compositor;
60 namespace geom = mir::geometry;
61@@ -33,6 +34,10 @@
62 namespace ms = mir::scene;
63 namespace geom = mir::geometry;
64
65+namespace mir { namespace compositor {
66+ std::shared_timed_mutex gpu_load_balance;
67+} } // namespace mir::compositor
68+
69 enum class mc::Stream::ScheduleMode {
70 Queueing,
71 Dropping
72@@ -109,7 +114,9 @@
73 // IO. Holding it locked blocks the compositor thread(s) from rendering.
74 if (deferred_io.valid())
75 {
76- // TODO: Throttling of GPU hogs goes here (LP: #1211700, LP: #1665802)
77+ // Throttle GPU hogs such that they can only saturate the GPU while
78+ // no compositors are needing it (LP: #1211700, LP: #1665802)
79+ { std::unique_lock<std::shared_timed_mutex> lock(gpu_load_balance); }
80 deferred_io.wait();
81 }
82 }

Subscribers

People subscribed via source and target branches