/usr/include/mirplatform/mir/graphics/display_configuration.h is in libmirplatform-dev 0.21.0+16.04.20160330-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | /*
* Copyright © 2013 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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
*/
#ifndef MIR_GRAPHICS_DISPLAY_CONFIGURATION_H_
#define MIR_GRAPHICS_DISPLAY_CONFIGURATION_H_
#include "mir/int_wrapper.h"
#include "mir/geometry/size.h"
#include "mir/geometry/rectangle.h"
#include "mir/geometry/point.h"
#include "mir_toolkit/common.h"
#include <functional>
#include <vector>
#include <memory>
namespace mir
{
namespace graphics
{
namespace detail { struct GraphicsConfCardIdTag; struct GraphicsConfOutputIdTag; }
typedef IntWrapper<detail::GraphicsConfCardIdTag> DisplayConfigurationCardId;
typedef IntWrapper<detail::GraphicsConfOutputIdTag> DisplayConfigurationOutputId;
/**
* Configuration information for a display card.
*/
struct DisplayConfigurationCard
{
DisplayConfigurationCardId id;
size_t max_simultaneous_outputs;
};
/**
* The type of a display output.
*/
enum class DisplayConfigurationOutputType
{
unknown,
vga,
dvii,
dvid,
dvia,
composite,
svideo,
lvds,
component,
ninepindin,
displayport,
hdmia,
hdmib,
tv,
edp
};
/**
* Configuration information for a display output mode.
*/
struct DisplayConfigurationMode
{
geometry::Size size;
double vrefresh_hz;
};
/**
* Configuration information for a display output.
*/
struct DisplayConfigurationOutput
{
/** The output's id. */
DisplayConfigurationOutputId id;
/** The id of the card the output is connected to. */
DisplayConfigurationCardId card_id;
/** The type of the output. */
DisplayConfigurationOutputType type;
/** The pixel formats supported by the output */
std::vector<MirPixelFormat> pixel_formats;
/** The modes supported by the output. */
std::vector<DisplayConfigurationMode> modes;
/** The index in the 'modes' vector of the preferred output mode. */
uint32_t preferred_mode_index;
/** The physical size of the output. */
geometry::Size physical_size_mm;
/** Whether the output is connected. */
bool connected;
/** Whether the output is used in the configuration. */
bool used;
/** The top left point of this output in the virtual coordinate space. */
geometry::Point top_left;
/** The index in the 'modes' vector of the current output mode. */
uint32_t current_mode_index;
/** The current output pixel format. A matching entry should be found in the 'pixel_formats' vector*/
MirPixelFormat current_format;
/** Current power mode **/
MirPowerMode power_mode;
MirOrientation orientation;
/** Requested scale factor for this output, for HiDPI support */
float scale;
/** Form factor of this output; phone display, tablet, monitor, TV, projector... */
MirFormFactor form_factor;
/** The logical rectangle occupied by the output, based on its position,
current mode and orientation (rotation) */
geometry::Rectangle extents() const;
bool valid() const;
};
/**
* Mirror of a DisplayConfigurationOutput, with some fields limited to
* being read-only, preventing users from changing things they shouldn't.
*/
struct UserDisplayConfigurationOutput
{
DisplayConfigurationOutputId const& id;
DisplayConfigurationCardId const& card_id;
DisplayConfigurationOutputType const& type;
std::vector<MirPixelFormat> const& pixel_formats;
std::vector<DisplayConfigurationMode> const& modes;
uint32_t const& preferred_mode_index;
geometry::Size const& physical_size_mm;
bool const& connected;
bool& used;
geometry::Point& top_left;
uint32_t& current_mode_index;
MirPixelFormat& current_format;
MirPowerMode& power_mode;
MirOrientation& orientation;
float& scale;
MirFormFactor& form_factor;
UserDisplayConfigurationOutput(DisplayConfigurationOutput& master);
geometry::Rectangle extents() const;
};
std::ostream& operator<<(std::ostream& out, DisplayConfigurationCard const& val);
bool operator==(DisplayConfigurationCard const& val1, DisplayConfigurationCard const& val2);
bool operator!=(DisplayConfigurationCard const& val1, DisplayConfigurationCard const& val2);
std::ostream& operator<<(std::ostream& out, DisplayConfigurationMode const& val);
bool operator==(DisplayConfigurationMode const& val1, DisplayConfigurationMode const& val2);
bool operator!=(DisplayConfigurationMode const& val1, DisplayConfigurationMode const& val2);
std::ostream& operator<<(std::ostream& out, DisplayConfigurationOutput const& val);
bool operator==(DisplayConfigurationOutput const& val1, DisplayConfigurationOutput const& val2);
bool operator!=(DisplayConfigurationOutput const& val1, DisplayConfigurationOutput const& val2);
/**
* Interface to a configuration of display cards and outputs.
*/
class DisplayConfiguration
{
public:
virtual ~DisplayConfiguration() = default;
/** Executes a function object for each card in the configuration. */
virtual void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const = 0;
/** Executes a function object for each output in the configuration. */
virtual void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const = 0;
virtual void for_each_output(std::function<void(UserDisplayConfigurationOutput&)> f) = 0;
virtual std::unique_ptr<DisplayConfiguration> clone() const = 0;
virtual bool valid() const;
protected:
DisplayConfiguration() = default;
DisplayConfiguration(DisplayConfiguration const& c) = delete;
DisplayConfiguration& operator=(DisplayConfiguration const& c) = delete;
};
bool operator==(DisplayConfiguration const& lhs, DisplayConfiguration const& rhs);
bool operator!=(DisplayConfiguration const& lhs, DisplayConfiguration const& rhs);
std::ostream& operator<<(std::ostream& out, DisplayConfiguration const& val);
}
}
#endif /* MIR_GRAPHICS_DISPLAY_CONFIGURATION_H_ */
|