~alan-griffiths/mir/fix-1654023

« back to all changes in this revision

Viewing changes to src/platforms/eglstream-kms/server/kms_display_configuration.h

  • Committer: Daniel van Vugt
  • Date: 2016-07-18 07:38:38 UTC
  • mfrom: (3595 development-branch)
  • mto: This revision was merged to the branch mainline in revision 3748.
  • Revision ID: daniel.van.vugt@canonical.com-20160718073838-tclt9c441h505wck
Merge latest trunk.  No conflicts in 7+ weeks?!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_KMS_DISPLAY_CONFIGURATION_H_
 
20
#define MIR_PLATFORMS_EGLSTREAM_KMS_KMS_DISPLAY_CONFIGURATION_H_
 
21
 
 
22
#include "egl_output.h"
 
23
 
 
24
#include "mir/graphics/display_configuration.h"
 
25
 
 
26
 
 
27
#include <xf86drmMode.h>
 
28
 
 
29
namespace mir
 
30
{
 
31
namespace graphics
 
32
{
 
33
namespace eglstream
 
34
{
 
35
 
 
36
class KMSDisplayConfiguration : public DisplayConfiguration
 
37
{
 
38
public:
 
39
    KMSDisplayConfiguration(int drm_fd, EGLDisplay dpy);
 
40
    KMSDisplayConfiguration(KMSDisplayConfiguration const& conf);
 
41
 
 
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;
 
46
 
 
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;
 
49
    void update();
 
50
 
 
51
    void for_each_output(std::function<void(kms::EGLOutput const&)> const& f) const;
 
52
 
 
53
private:
 
54
    void update_output(
 
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;
 
60
 
 
61
    int drm_fd;
 
62
    DisplayConfigurationCard const card;
 
63
    std::vector<std::shared_ptr<kms::EGLOutput>> outputs;
 
64
};
 
65
 
 
66
}
 
67
}
 
68
}
 
69
 
 
70
#endif // MIR_PLATFORMS_EGLSTREAM_KMS_KMS_DISPLAY_CONFIGURATION_H_