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
=== modified file 'src/server/scene/basic_surface.cpp'
--- src/server/scene/basic_surface.cpp 2016-01-29 08:18:22 +0000
+++ src/server/scene/basic_surface.cpp 2016-02-11 08:42:17 +0000
@@ -786,8 +786,7 @@
786 bool shaped,786 bool shaped,
787 mg::Renderable::ID id)787 mg::Renderable::ID id)
788 : underlying_buffer_stream{stream},788 : underlying_buffer_stream{stream},
789 compositor_buffer{nullptr},789 compositor_buffer{underlying_buffer_stream->lock_compositor_buffer(compositor_id)},
790 compositor_id{compositor_id},
791 alpha_{alpha},790 alpha_{alpha},
792 shaped_{shaped},791 shaped_{shaped},
793 screen_position_(position),792 screen_position_(position),
@@ -802,8 +801,13 @@
802 801
803 std::shared_ptr<mg::Buffer> buffer() const override802 std::shared_ptr<mg::Buffer> buffer() const override
804 {803 {
805 if (!compositor_buffer)804 /*
806 compositor_buffer = underlying_buffer_stream->lock_compositor_buffer(compositor_id);805 * It's been pre-acquired, to ensure any frames a compositor chooses
806 * to not use (e.g. offscreen) don't wake up that compositor
807 * repeatedly. Fortunately acquiring a compositor buffer is an O(1)
808 * non-blocking operation with no performance impact. Only putting it
809 * on screen affects performance :)
810 */
807 return compositor_buffer;811 return compositor_buffer;
808 }812 }
809813
@@ -823,8 +827,7 @@
823 { return id_; }827 { return id_; }
824private:828private:
825 std::shared_ptr<mc::BufferStream> const underlying_buffer_stream;829 std::shared_ptr<mc::BufferStream> const underlying_buffer_stream;
826 std::shared_ptr<mg::Buffer> mutable compositor_buffer;830 std::shared_ptr<mg::Buffer> const compositor_buffer;
827 void const*const compositor_id;
828 float const alpha_;831 float const alpha_;
829 bool const shaped_;832 bool const shaped_;
830 geom::Rectangle const screen_position_;833 geom::Rectangle const screen_position_;

Subscribers

People subscribed via source and target branches