1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*
* Copyright © 2016 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
*/
#ifndef MIR_PLATFORMS_EGLSTREAM_KMS_DISPLAY_H_
#define MIR_PLATFORMS_EGLSTREAM_KMS_DISPLAY_H_
#include "mir/graphics/display.h"
#include "kms_display_configuration.h"
#include "mir/fd.h"
#include "mir/renderer/gl/context_source.h"
namespace mir
{
namespace graphics
{
class DisplayConfigurationPolicy;
class GLConfig;
namespace eglstream
{
class Display : public mir::graphics::Display,
public mir::graphics::NativeDisplay,
public mir::renderer::gl::ContextSource
{
public:
Display(
mir::Fd drm_node,
EGLDisplay display,
std::shared_ptr<DisplayConfigurationPolicy> const& configuration_policy,
GLConfig const& gl_conf);
void for_each_display_sync_group(const std::function<void(DisplaySyncGroup&)>& f) override;
std::unique_ptr<DisplayConfiguration> configuration() const override;
bool apply_if_configuration_preserves_display_buffers(DisplayConfiguration const& conf) override;
void configure(DisplayConfiguration const& conf) override;
void register_configuration_change_handler(EventHandlerRegister& handlers,
DisplayConfigurationChangeHandler const& conf_change_handler) override;
void register_pause_resume_handlers(EventHandlerRegister& handlers,
DisplayPauseHandler const& pause_handler, DisplayResumeHandler const& resume_handler) override;
void pause() override;
void resume() override;
std::shared_ptr<Cursor> create_hardware_cursor() override;
std::unique_ptr<VirtualOutput> create_virtual_output(int width, int height) override;
NativeDisplay* native_display() override;
std::unique_ptr<renderer::gl::Context> create_gl_context() override;
Frame last_frame_on(unsigned output_id) const override;
private:
mir::Fd const drm_node;
EGLDisplay display;
EGLConfig config;
EGLContext context;
KMSDisplayConfiguration display_configuration;
std::vector<std::unique_ptr<DisplaySyncGroup>> active_sync_groups;
std::shared_ptr<DisplayConfigurationPolicy> const configuration_policy;
};
}
}
}
#endif // MIR_PLATFORMS_EGLSTREAM_KMS_DISPLAY_H_
|