Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multi_threaded_compositor.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_MULTI_THREADED_COMPOSITOR_H_
20 #define MIR_COMPOSITOR_MULTI_THREADED_COMPOSITOR_H_
21 
23 
24 #include <mutex>
25 #include <memory>
26 #include <vector>
27 #include <thread>
28 
29 namespace mir
30 {
31 namespace graphics
32 {
33 class Display;
34 }
35 namespace compositor
36 {
37 
38 class DisplayBufferCompositorFactory;
39 class CompositingFunctor;
40 class Scene;
41 class CompositorReport;
42 
44 {
45 public:
46  MultiThreadedCompositor(std::shared_ptr<graphics::Display> const& display,
47  std::shared_ptr<Scene> const& scene,
48  std::shared_ptr<DisplayBufferCompositorFactory> const& db_compositor_factory,
49  std::shared_ptr<CompositorReport> const& compositor_report,
50  bool compose_on_start);
52 
53  void start();
54  void stop();
55 
56 private:
57  std::shared_ptr<graphics::Display> const display;
58  std::shared_ptr<Scene> const scene;
59  std::shared_ptr<DisplayBufferCompositorFactory> const display_buffer_compositor_factory;
60  std::shared_ptr<CompositorReport> const report;
61 
62  std::vector<std::unique_ptr<CompositingFunctor>> thread_functors;
63  std::vector<std::thread> threads;
64 
65  std::mutex started_guard;
66  bool started;
67  bool compose_on_start;
68 
69  void schedule_compositing();
70 };
71 
72 }
73 }
74 
75 #endif /* MIR_COMPOSITOR_MULTI_THREADED_COMPOSITOR_H_ */
MultiThreadedCompositor(std::shared_ptr< graphics::Display > const &display, std::shared_ptr< Scene > const &scene, std::shared_ptr< DisplayBufferCompositorFactory > const &db_compositor_factory, std::shared_ptr< CompositorReport > const &compositor_report, bool compose_on_start)
Definition: multi_threaded_compositor.cpp:146
~MultiThreadedCompositor()
Definition: multi_threaded_compositor.cpp:161
void stop()
Definition: multi_threaded_compositor.cpp:211
Definition: multi_threaded_compositor.h:43
void start()
Definition: multi_threaded_compositor.cpp:174
Definition: compositor.h:27

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014