2
* Copyright © 2016 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
19
#ifndef MIR_PLATFORMS_EGLSTREAM_KMS_KMS_DISPLAY_CONFIGURATION_H_
20
#define MIR_PLATFORMS_EGLSTREAM_KMS_KMS_DISPLAY_CONFIGURATION_H_
22
#include "egl_output.h"
24
#include "mir/graphics/display_configuration.h"
27
#include <xf86drmMode.h>
36
class KMSDisplayConfiguration : public DisplayConfiguration
39
KMSDisplayConfiguration(int drm_fd, EGLDisplay dpy);
40
KMSDisplayConfiguration(KMSDisplayConfiguration const& conf);
42
void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const override;
43
void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const override;
44
void for_each_output(std::function<void(UserDisplayConfigurationOutput&)> f) override;
45
std::unique_ptr<DisplayConfiguration> clone() const override;
47
uint32_t get_kms_connector_id(DisplayConfigurationOutputId id) const;
48
size_t get_kms_mode_index(DisplayConfigurationOutputId id, size_t conf_mode_index) const;
51
void for_each_output(std::function<void(kms::EGLOutput const&)> const& f) const;
55
graphics::kms::DRMModeResources const& resources,
56
graphics::kms::DRMModeConnectorUPtr const& connector,
57
kms::EGLOutput& output);
58
std::vector<std::shared_ptr<kms::EGLOutput>>::iterator find_output_with_id(DisplayConfigurationOutputId id);
59
std::vector<std::shared_ptr<kms::EGLOutput>>::const_iterator find_output_with_id(DisplayConfigurationOutputId id) const;
62
DisplayConfigurationCard const card;
63
std::vector<std::shared_ptr<kms::EGLOutput>> outputs;
70
#endif // MIR_PLATFORMS_EGLSTREAM_KMS_KMS_DISPLAY_CONFIGURATION_H_