Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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);
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);
73 
75  EventHandlerRegister& handlers,
76  DisplayPauseHandler const& pause_handler,
77  DisplayResumeHandler const& resume_handler);
78 
79  void pause();
80  void resume();
81 
82  std::shared_ptr<graphics::Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image);
83  std::unique_ptr<GLContext> create_gl_context();
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: aging_buffer.h:24
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
void pause()
Pauses the display.
Definition: display.cpp:256
Definition: real_kms_display_configuration.h:33
std::unique_ptr< DisplayConfiguration > configuration() const override
Gets a copy of the current output configuration.
Definition: display.cpp:125
~Display()
Definition: display.cpp:112
std::function< bool()> DisplayResumeHandler
Definition: display.h:39
std::shared_ptr< graphics::Cursor > create_hardware_cursor(std::shared_ptr< CursorImage > const &initial_image)
Create a hardware cursor object.
Definition: display_helpers.h:94
void for_each_display_buffer(std::function< void(graphics::DisplayBuffer &)> const &f)
Definition: display.cpp:116
Definition: real_kms_output_container.h:34
std::unique_ptr< GLContext > create_gl_context()
Creates a GLContext object that shares resources with the Display's GL context.
Definition: display.cpp:334
std::function< bool()> DisplayPauseHandler
Definition: display.h:36
void register_configuration_change_handler(EventHandlerRegister &handlers, DisplayConfigurationChangeHandler const &conf_change_handler)
Registers a handler for display configuration changes.
Definition: display.cpp:231
void resume()
Resumes the display.
Definition: display.cpp:270
Definition: rectangle.h:33
Definition: display.h:54
void register_pause_resume_handlers(EventHandlerRegister &handlers, DisplayPauseHandler const &pause_handler, DisplayResumeHandler const &resume_handler)
Registers handlers for pausing and resuming the display subsystem.
Definition: display.cpp:248
geometry::Rectangle view_area() const
Interface to the display subsystem.
Definition: display.h:45
std::function< void()> DisplayConfigurationChangeHandler
Definition: display.h:40
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:159
Definition: event_handler_register.h:31

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014