Mir
display.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 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_H_
20 #define MIR_GRAPHICS_ANDROID_DISPLAY_H_
21 
22 #include "mir/graphics/display.h"
23 #include "gl_context.h"
24 #include "display_group.h"
25 #include "hwc_configuration.h"
26 #include "display_configuration.h"
27 #include "overlay_optimization.h"
28 
29 #include <memory>
30 #include <mutex>
31 #include <array>
32 
33 namespace mir
34 {
35 namespace gl { class ProgramFactory; }
36 namespace graphics
37 {
38 
39 class DisplayReport;
40 class GLConfig;
41 
42 namespace android
43 {
44 class DisplayComponentFactory;
45 class DisplaySupportProvider;
46 class ConfigurableDisplayBuffer;
47 class DisplayChangePipe;
48 class DisplayDevice;
49 
50 class Display : public graphics::Display
51 {
52 public:
53  explicit Display(
54  std::shared_ptr<DisplayComponentFactory> const& display_buffer_builder,
55  std::shared_ptr<gl::ProgramFactory> const& gl_program_factory,
56  std::shared_ptr<GLConfig> const& gl_config,
57  std::shared_ptr<DisplayReport> const& display_report,
58  OverlayOptimization overlay_option);
59  ~Display() noexcept;
60 
61  void for_each_display_sync_group(std::function<void(graphics::DisplaySyncGroup&)> const& f) override;
62 
63  std::unique_ptr<graphics::DisplayConfiguration> configuration() const override;
64  void configure(graphics::DisplayConfiguration const&) override;
65 
66  void register_configuration_change_handler(
67  EventHandlerRegister& handlers,
68  DisplayConfigurationChangeHandler const& conf_change_handler) override;
69 
70  void register_pause_resume_handlers(
71  EventHandlerRegister& handlers,
72  DisplayPauseHandler const& pause_handler,
73  DisplayResumeHandler const& resume_handler) override;
74 
75  void pause() override;
76  void resume() override;
77 
78  std::shared_ptr<Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) override;
79  std::unique_ptr<graphics::GLContext> create_gl_context() override;
80  std::unique_ptr<VirtualOutput> create_virtual_output(int width, int height) override;
81 
82 private:
83  void on_hotplug();
84  void on_vsync(DisplayName) const;
85 
86  geometry::Point const origin{0,0};
87  std::shared_ptr<DisplayReport> const display_report;
88  std::shared_ptr<DisplayComponentFactory> const display_buffer_builder;
89  std::mutex mutable configuration_mutex;
90  bool mutable configuration_dirty{false};
91  std::unique_ptr<HwcConfiguration> const hwc_config;
92  ConfigChangeSubscription const hotplug_subscription;
93  DisplayConfiguration mutable config;
94  PbufferGLContext gl_context;
95  std::shared_ptr<DisplayDevice> display_device;
96  std::unique_ptr<DisplayChangePipe> display_change_pipe;
97  std::shared_ptr<gl::ProgramFactory> const gl_program_factory;
98  DisplayGroup mutable displays;
99  OverlayOptimization const overlay_option;
100 
101  void update_configuration(std::lock_guard<decltype(configuration_mutex)> const&) const;
102 };
103 
104 }
105 }
106 }
107 #endif /* MIR_GRAPHICS_ANDROID_DISPLAY_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: point.h:30
DisplaySyncGroup represents a group of displays that need to be output in unison as a single post() c...
Definition: display.h:55
std::shared_ptr< void > ConfigChangeSubscription
Definition: hwc_configuration.h:35
OverlayOptimization
Definition: overlay_optimization.h:28
DisplayName
Definition: display_name.h:32
std::function< bool()> DisplayResumeHandler
Definition: display.h:41
Definition: gl_context.h:64
unsigned int width
Definition: touchspot_image.c:4
std::function< bool()> DisplayPauseHandler
Definition: display.h:38
Definition: display.h:50
Definition: display_configuration.h:31
unsigned int height
Definition: touchspot_image.c:5
Definition: android_input_receiver.h:36
Definition: display_group.h:38
Interface to the display subsystem.
Definition: display.h:88
std::function< void()> DisplayConfigurationChangeHandler
Definition: display.h:42
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:167
Definition: event_handler_register.h:32

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016