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 class NativeWindowReport;
50 
51 class Display : public graphics::Display
52 {
53 public:
54  explicit Display(
55  std::shared_ptr<DisplayComponentFactory> const& display_buffer_builder,
56  std::shared_ptr<gl::ProgramFactory> const& gl_program_factory,
57  std::shared_ptr<GLConfig> const& gl_config,
58  std::shared_ptr<DisplayReport> const& display_report,
59  std::shared_ptr<NativeWindowReport> const& native_window_report,
60  OverlayOptimization overlay_option);
61  ~Display() noexcept;
62 
63  void for_each_display_sync_group(std::function<void(graphics::DisplaySyncGroup&)> const& f) override;
64 
65  std::unique_ptr<graphics::DisplayConfiguration> configuration() const override;
66  void configure(graphics::DisplayConfiguration const&) override;
67 
68  void register_configuration_change_handler(
69  EventHandlerRegister& handlers,
70  DisplayConfigurationChangeHandler const& conf_change_handler) override;
71 
72  void register_pause_resume_handlers(
73  EventHandlerRegister& handlers,
74  DisplayPauseHandler const& pause_handler,
75  DisplayResumeHandler const& resume_handler) override;
76 
77  void pause() override;
78  void resume() override;
79 
80  std::shared_ptr<Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) override;
81  std::unique_ptr<graphics::GLContext> create_gl_context() override;
82  std::unique_ptr<VirtualOutput> create_virtual_output(int width, int height) override;
83 
84 private:
85  void on_hotplug();
86  void on_vsync(DisplayName) const;
87 
88  geometry::Point const origin{0,0};
89  std::shared_ptr<DisplayReport> const display_report;
90  std::shared_ptr<NativeWindowReport> const native_window_report;
91  std::shared_ptr<DisplayComponentFactory> const display_buffer_builder;
92  std::mutex mutable configuration_mutex;
93  bool mutable configuration_dirty{false};
94  std::unique_ptr<HwcConfiguration> const hwc_config;
95  ConfigChangeSubscription const hotplug_subscription;
96  DisplayConfiguration mutable config;
97  PbufferGLContext gl_context;
98  std::shared_ptr<DisplayDevice> display_device;
99  std::unique_ptr<DisplayChangePipe> display_change_pipe;
100  std::shared_ptr<gl::ProgramFactory> const gl_program_factory;
101  DisplayGroup mutable displays;
102  OverlayOptimization const overlay_option;
103 
104  void update_configuration(std::lock_guard<decltype(configuration_mutex)> const&) const;
105 };
106 
107 }
108 }
109 }
110 #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:51
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:168
Definition: event_handler_register.h:32

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