Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gbm_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 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_GRAPHICS_GBM_GBM_DISPLAY_H_
20 #define MIR_GRAPHICS_GBM_GBM_DISPLAY_H_
21 
22 #include "mir/graphics/display.h"
25 #include "gbm_display_helpers.h"
26 
27 #include <mutex>
28 
29 #include <vector>
30 
31 namespace mir
32 {
33 namespace geometry
34 {
35 struct Rectangle;
36 }
37 namespace graphics
38 {
39 
40 class DisplayReport;
41 class DisplayBuffer;
42 class DisplayConfigurationPolicy;
43 class EventHandlerRegister;
44 
45 namespace gbm
46 {
47 
48 class GBMPlatform;
49 class KMSOutput;
50 class GBMDisplayBuffer;
51 class GBMCursor;
52 class VideoDevices;
53 
54 class GBMDisplay : public Display
55 {
56 public:
57  GBMDisplay(std::shared_ptr<GBMPlatform> const& platform,
58  std::shared_ptr<VideoDevices> const& video_devices,
59  std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
60  std::shared_ptr<DisplayReport> const& listener);
61  ~GBMDisplay();
62 
64  void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f);
65 
66  std::shared_ptr<DisplayConfiguration> configuration();
67  void configure(DisplayConfiguration const& conf);
68 
70  EventHandlerRegister& handlers,
71  DisplayConfigurationChangeHandler const& conf_change_handler);
72 
74  EventHandlerRegister& handlers,
75  DisplayPauseHandler const& pause_handler,
76  DisplayResumeHandler const& resume_handler);
77 
78  void pause();
79  void resume();
80 
81  std::weak_ptr<Cursor> the_cursor();
82  std::unique_ptr<GLContext> create_gl_context();
83 
84 private:
85  void clear_connected_unused_outputs();
86 
87  std::mutex configuration_mutex;
88  std::shared_ptr<GBMPlatform> const platform;
89  std::shared_ptr<VideoDevices> const video_devices;
90  std::shared_ptr<DisplayReport> const listener;
91  helpers::EGLHelper shared_egl;
92  std::vector<std::unique_ptr<GBMDisplayBuffer>> display_buffers;
93  RealKMSOutputContainer output_container;
94  RealKMSDisplayConfiguration current_display_configuration;
95  std::shared_ptr<GBMCursor> cursor;
96 };
97 
98 }
99 }
100 }
101 
102 #endif /* MIR_GRAPHICS_GBM_GBM_DISPLAY_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013