Mir
display_group.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_ANDROID_DISPLAY_GROUP_H_
20 #define MIR_GRAPHICS_ANDROID_DISPLAY_GROUP_H_
21 
22 #include "mir_toolkit/common.h"
23 #include "mir/graphics/display.h"
25 #include "display_name.h"
26 #include <map>
27 #include <mutex>
28 
29 namespace mir
30 {
31 namespace graphics
32 {
33 namespace android
34 {
35 class ConfigurableDisplayBuffer;
36 class DisplayDevice;
37 
39 {
40 public:
41  using ExceptionHandler = std::function<void()>;
43  std::shared_ptr<DisplayDevice> const& device,
44  std::unique_ptr<ConfigurableDisplayBuffer> primary_buffer,
45  ExceptionHandler const& handler);
47  std::shared_ptr<DisplayDevice> const& device,
48  std::unique_ptr<ConfigurableDisplayBuffer> primary_buffer);
49 
50  void for_each_display_buffer(std::function<void(graphics::DisplayBuffer&)> const& f) override;
51  void post() override;
52  std::chrono::milliseconds recommended_sleep() const override;
53 
54  void add(DisplayName name, std::unique_ptr<ConfigurableDisplayBuffer> buffer);
55  void remove(DisplayName name);
57  bool display_present(DisplayName name) const;
58 
59 private:
60  std::mutex mutable guard;
61  std::shared_ptr<DisplayDevice> const device;
62  std::map<DisplayName, std::unique_ptr<ConfigurableDisplayBuffer>> dbs;
63  ExceptionHandler const exception_handler;
64 };
65 
66 }
67 }
68 }
69 
70 #endif /* MIR_GRAPHICS_ANDROID_DISPLAY_GROUP_H_ */
DisplayGroup(std::shared_ptr< DisplayDevice > const &device, std::unique_ptr< ConfigurableDisplayBuffer > primary_buffer, ExceptionHandler const &handler)
All things Mir.
Definition: atomic_callback.h:25
Interface to an output framebuffer.
Definition: display_buffer.h:47
DisplaySyncGroup represents a group of displays that need to be output in unison as a single post() c...
Definition: display.h:55
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
void configure(DisplayName name, MirPowerMode, MirOrientation, geometry::Displacement)
Definition: display_group.cpp:77
void post() override
Post the content of the DisplayBuffers associated with this DisplaySyncGroup.
Definition: display_group.cpp:86
DisplayName
Definition: display_name.h:32
void for_each_display_buffer(std::function< void(graphics::DisplayBuffer &)> const &f) override
MirPowerMode
Definition: common.h:101
Definition: displacement.h:32
Definition: android_input_receiver.h:36
std::function< void()> ExceptionHandler
Definition: display_group.h:41
std::chrono::milliseconds recommended_sleep() const override
Returns a recommendation to the compositor as to how long it should wait before sampling the scene fo...
Definition: display_group.cpp:113
bool display_present(DisplayName name) const
Definition: display_group.cpp:71
void add(DisplayName name, std::unique_ptr< ConfigurableDisplayBuffer > buffer)
Definition: display_group.cpp:54
Definition: display_group.h:38

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016