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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_MESA_DISPLAY_H_
20 #define MIR_GRAPHICS_MESA_DISPLAY_H_
21 
22 #include "mir/graphics/display.h"
25 #include "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 class GLConfig;
45 
46 namespace mesa
47 {
48 
49 class Platform;
50 class DisplayBuffer;
51 class KMSOutput;
52 class Cursor;
53 
54 class Display : public graphics::Display
55 {
56 public:
57  Display(std::shared_ptr<Platform> const& platform,
58  std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
59  std::shared_ptr<GLConfig> const& gl_config,
60  std::shared_ptr<DisplayReport> const& listener);
61  ~Display();
62 
65  std::function<void(graphics::DisplayBuffer&)> const& f) override;
66 
67  std::unique_ptr<DisplayConfiguration> configuration() const override;
68  void configure(DisplayConfiguration const& conf) override;
69 
71  EventHandlerRegister& handlers,
72  DisplayConfigurationChangeHandler const& conf_change_handler) override;
73 
75  EventHandlerRegister& handlers,
76  DisplayPauseHandler const& pause_handler,
77  DisplayResumeHandler const& resume_handler) override;
78 
79  void pause() override;
80  void resume() override;
81 
82  std::shared_ptr<graphics::Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) override;
83  std::unique_ptr<GLContext> create_gl_context() override;
84 
85 private:
86  void clear_connected_unused_outputs();
87 
88  mutable std::mutex configuration_mutex;
89  std::shared_ptr<Platform> const platform;
90  std::shared_ptr<DisplayReport> const listener;
91  mir::udev::Monitor monitor;
92  helpers::EGLHelper shared_egl;
93  std::vector<std::unique_ptr<DisplayBuffer>> display_buffers;
94  RealKMSOutputContainer output_container;
95  mutable RealKMSDisplayConfiguration current_display_configuration;
96 
97  std::weak_ptr<Cursor> cursor;
98  std::shared_ptr<GLConfig> const gl_config;
99 };
100 
101 }
102 }
103 }
104 
105 #endif /* MIR_GRAPHICS_MESA_DISPLAY_H_ */
All things Mir.
Definition: buffer_stream.h:37
void register_pause_resume_handlers(EventHandlerRegister &handlers, DisplayPauseHandler const &pause_handler, DisplayResumeHandler const &resume_handler) override
Registers handlers for pausing and resuming the display subsystem.
Definition: display.cpp:268
Definition: wrapper.h:119
Interface to an output framebuffer.
Definition: display_buffer.h:38
void configure(DisplayConfiguration const &conf) override
Sets a new output configuration.
Definition: display.cpp:136
Definition: real_kms_display_configuration.h:33
std::unique_ptr< GLContext > create_gl_context() override
Creates a GLContext object that shares resources with the Display's GL context.
Definition: display.cpp:354
std::unique_ptr< DisplayConfiguration > configuration() const override
Gets a copy of the current output configuration.
Definition: display.cpp:125
void for_each_display_buffer(std::function< void(graphics::DisplayBuffer &)> const &f) override
Definition: display.cpp:116
~Display()
Definition: display.cpp:112
std::function< bool()> DisplayResumeHandler
Definition: display.h:39
void pause() override
Pauses the display.
Definition: display.cpp:276
Definition: display_helpers.h:95
Definition: real_kms_output_container.h:34
std::function< bool()> DisplayPauseHandler
Definition: display.h:36
Definition: rectangle.h:33
Definition: display.h:54
void register_configuration_change_handler(EventHandlerRegister &handlers, DisplayConfigurationChangeHandler const &conf_change_handler) override
Registers a handler for display configuration changes.
Definition: display.cpp:251
geometry::Rectangle view_area() const
Interface to the display subsystem.
Definition: display.h:45
std::function< void()> DisplayConfigurationChangeHandler
Definition: display.h:40
void resume() override
Resumes the display.
Definition: display.cpp:290
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:159
std::shared_ptr< graphics::Cursor > create_hardware_cursor(std::shared_ptr< CursorImage > const &initial_image) override
Create a hardware cursor object.
Definition: event_handler_register.h:31

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015