Mir
display.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17  */
18 
19 #ifndef MIR_PLATFORMS_EGLSTREAM_KMS_DISPLAY_H_
20 #define MIR_PLATFORMS_EGLSTREAM_KMS_DISPLAY_H_
21 
22 #include "mir/graphics/display.h"
24 #include "mir/fd.h"
25 
26 namespace mir
27 {
28 namespace graphics
29 {
30 class DisplayConfigurationPolicy;
31 class GLConfig;
32 
33 namespace eglstream
34 {
35 
37 {
38 public:
39  Display(
40  mir::Fd drm_node,
41  EGLDisplay display,
42  std::shared_ptr<DisplayConfigurationPolicy> const& configuration_policy,
43  GLConfig const& gl_conf);
44 
45  void for_each_display_sync_group(const std::function<void(DisplaySyncGroup&)>& f) override;
46 
47  std::unique_ptr<DisplayConfiguration> configuration() const override;
48 
49  void configure(DisplayConfiguration const& conf) override;
50 
52  DisplayConfigurationChangeHandler const& conf_change_handler) override;
53 
55  DisplayPauseHandler const& pause_handler, DisplayResumeHandler const& resume_handler) override;
56 
57  void pause() override;
58 
59  void resume() override;
60 
61  std::shared_ptr<Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) override;
62 
63  std::unique_ptr<GLContext> create_gl_context() override;
64 
65  std::unique_ptr<VirtualOutput> create_virtual_output(int width, int height) override;
66 
67 private:
68  mir::Fd const drm_node;
69  EGLDisplay display;
70  EGLConfig config;
71  EGLContext context;
72  KMSDisplayConfiguration display_configuration;
73  std::vector<std::unique_ptr<DisplaySyncGroup>> active_sync_groups;
74  std::shared_ptr<DisplayConfigurationPolicy> const configuration_policy;
75 };
76 
77 }
78 }
79 
80 }
81 
82 #endif // MIR_PLATFORMS_EGLSTREAM_KMS_DISPLAY_H_
All things Mir.
Definition: atomic_callback.h:25
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:308
void configure(DisplayConfiguration const &conf) override
Sets a new output configuration.
Definition: display.cpp:288
std::unique_ptr< VirtualOutput > create_virtual_output(int width, int height) override
Creates a virtual output.
Definition: display.cpp:360
Definition: fd.h:33
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< Cursor > create_hardware_cursor(std::shared_ptr< CursorImage > const &initial_image) override
Create a hardware cursor object.
Definition: display.cpp:325
std::unique_ptr< GLContext > create_gl_context() override
Creates a GLContext object that shares resources with the Display&#39;s GL context.
Definition: display.cpp:332
Definition: display.h:36
Interface for customizing aspects of the GL config used by the server.
Definition: gl_config.h:30
void register_configuration_change_handler(EventHandlerRegister &handlers, DisplayConfigurationChangeHandler const &conf_change_handler) override
Registers a handler for display configuration changes.
Definition: display.cpp:302
void for_each_display_sync_group(const std::function< void(DisplaySyncGroup &)> &f) override
Executes a functor for each output group.
Definition: display.cpp:275
std::function< bool()> DisplayResumeHandler
Definition: display.h:41
unsigned int width
Definition: touchspot_image.c:4
Definition: kms_display_configuration.h:36
std::function< bool()> DisplayPauseHandler
Definition: display.h:38
unsigned int height
Definition: touchspot_image.c:5
void resume() override
Resumes the display.
Definition: display.cpp:320
void pause() override
Pauses the display.
Definition: display.cpp:315
std::unique_ptr< DisplayConfiguration > configuration() const override
Gets a copy of the current output configuration.
Definition: display.cpp:283
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