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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_GRAPHICS_DISPLAY_H_
20 #define MIR_GRAPHICS_DISPLAY_H_
21 
22 #include "mir/graphics/frame.h"
23 #include <memory>
24 #include <functional>
25 #include <chrono>
26 
27 namespace mir
28 {
29 
30 namespace graphics
31 {
32 
33 class DisplayBuffer;
34 class DisplayConfiguration;
35 class Cursor;
36 class CursorImage;
37 class EventHandlerRegister;
39 
40 typedef std::function<bool()> DisplayPauseHandler;
41 typedef std::function<bool()> DisplayResumeHandler;
42 typedef std::function<void()> DisplayConfigurationChangeHandler;
43 
45 {
46 protected:
47  NativeDisplay() = default;
48  virtual ~NativeDisplay() = default;
49  NativeDisplay(NativeDisplay const&) = delete;
50  NativeDisplay operator=(NativeDisplay const&) = delete;
51 };
52 
65 {
66 public:
70  virtual void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f) = 0;
71 
76  virtual void post() = 0;
77 
88  virtual std::chrono::milliseconds recommended_sleep() const = 0;
89 
90  virtual ~DisplaySyncGroup() = default;
91 protected:
92  DisplaySyncGroup() = default;
93  DisplaySyncGroup(DisplaySyncGroup const&) = delete;
95 };
96 
100 class Display
101 {
102 public:
106  virtual void for_each_display_sync_group(std::function<void(DisplaySyncGroup&)> const& f) = 0;
107 
111  virtual std::unique_ptr<DisplayConfiguration> configuration() const = 0;
112 
129  virtual bool apply_if_configuration_preserves_display_buffers(DisplayConfiguration const& conf) = 0;
130 
134  virtual void configure(DisplayConfiguration const& conf) = 0;
135 
145  virtual void register_configuration_change_handler(
146  EventHandlerRegister& handlers,
147  DisplayConfigurationChangeHandler const& conf_change_handler) = 0;
148 
155  virtual void register_pause_resume_handlers(
156  EventHandlerRegister& handlers,
157  DisplayPauseHandler const& pause_handler,
158  DisplayResumeHandler const& resume_handler) = 0;
159 
166  virtual void pause() = 0;
167 
171  virtual void resume() = 0;
172 
176  virtual std::shared_ptr<Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) = 0;
177 
182  virtual std::unique_ptr<VirtualOutput> create_virtual_output(int width, int height) = 0;
183 
190  virtual NativeDisplay* native_display() = 0;
191 
206  virtual Frame last_frame_on(unsigned output_id) const = 0;
207 
208  Display() = default;
209  virtual ~Display() = default;
210 private:
211  Display(Display const&) = delete;
212  Display& operator=(Display const&) = delete;
213 };
214 }
215 }
216 
217 #endif /* MIR_GRAPHICS_DISPLAY_H_ */
Definition: as_render_target.h:27
Interface to an output framebuffer.
Definition: display_buffer.h:47
DisplaySyncGroup represents a group of displays that need to be output in unison as a single post() c...
Definition: display.h:64
unsigned int height
Definition: mir_image.h:27
unsigned int width
Definition: mir_image.h:26
Definition: display.h:44
std::function< bool()> DisplayResumeHandler
Definition: display.h:41
std::function< bool()> DisplayPauseHandler
Definition: display.h:38
Frame is a unique identifier for a frame displayed on an output.
Definition: frame.h:37
virtual ~NativeDisplay()=default
Interface to a virtual output.
Definition: virtual_output.h:31
uint32_t output_id
The id of the output to place the surface in.
Definition: client_types.h:183
Interface to the display subsystem.
Definition: display.h:100
std::function< void()> DisplayConfigurationChangeHandler
Definition: display.h:42
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:185
NativeDisplay operator=(NativeDisplay const &)=delete
Definition: event_handler_register.h:32

Copyright © 2012-2016 Canonical Ltd.
Generated on Wed Oct 11 22:26:23 UTC 2017