Mir

Merge lp:~mir-team/mir/compositing-always-finishes into lp:mir

Proposed by Daniel van Vugt
Status: Work in progress
Proposed branch: lp:~mir-team/mir/compositing-always-finishes
Merge into: lp:mir
Diff against target: 39 lines (+9/-6)
1 file modified
src/server/scene/basic_surface.cpp (+9/-6)
To merge this branch: bzr merge lp:~mir-team/mir/compositing-always-finishes
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+285684@code.launchpad.net

Description of the change

Proof of concept.

Tests fail for now. Just demonstrating an idea.

To post a comment you must log in.

Unmerged revisions

3306. By Daniel van Vugt

Proof of concept

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/scene/basic_surface.cpp'
2--- src/server/scene/basic_surface.cpp 2016-01-29 08:18:22 +0000
3+++ src/server/scene/basic_surface.cpp 2016-02-11 08:42:17 +0000
4@@ -786,8 +786,7 @@
5 bool shaped,
6 mg::Renderable::ID id)
7 : underlying_buffer_stream{stream},
8- compositor_buffer{nullptr},
9- compositor_id{compositor_id},
10+ compositor_buffer{underlying_buffer_stream->lock_compositor_buffer(compositor_id)},
11 alpha_{alpha},
12 shaped_{shaped},
13 screen_position_(position),
14@@ -802,8 +801,13 @@
15
16 std::shared_ptr<mg::Buffer> buffer() const override
17 {
18- if (!compositor_buffer)
19- compositor_buffer = underlying_buffer_stream->lock_compositor_buffer(compositor_id);
20+ /*
21+ * It's been pre-acquired, to ensure any frames a compositor chooses
22+ * to not use (e.g. offscreen) don't wake up that compositor
23+ * repeatedly. Fortunately acquiring a compositor buffer is an O(1)
24+ * non-blocking operation with no performance impact. Only putting it
25+ * on screen affects performance :)
26+ */
27 return compositor_buffer;
28 }
29
30@@ -823,8 +827,7 @@
31 { return id_; }
32 private:
33 std::shared_ptr<mc::BufferStream> const underlying_buffer_stream;
34- std::shared_ptr<mg::Buffer> mutable compositor_buffer;
35- void const*const compositor_id;
36+ std::shared_ptr<mg::Buffer> const compositor_buffer;
37 float const alpha_;
38 bool const shaped_;
39 geom::Rectangle const screen_position_;

Subscribers

People subscribed via source and target branches