/usr/include/mirplatform/mir/graphics/platform.h is in libmirplatform-dev 0.26.3+16.04.20170605-0ubuntu1.1.
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 197 198 199 200 201 202 | /*
* Copyright © 2012 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:
* Thomas Guest <thomas.guest@canonical.com>
*/
#ifndef MIR_GRAPHICS_PLATFORM_H_
#define MIR_GRAPHICS_PLATFORM_H_
#include <boost/program_options/options_description.hpp>
#include "mir/module_properties.h"
#include "mir/module_deleter.h"
namespace mir
{
class EmergencyCleanupRegistry;
namespace logging { class Logger; }
namespace frontend
{
class Surface;
}
namespace options
{
class Option;
class ProgramOption;
}
/// Graphics subsystem. Mediates interaction between core system and
/// the graphics environment.
namespace graphics
{
class Buffer;
class Display;
class DisplayReport;
class DisplayConfigurationPolicy;
class GraphicBufferAllocator;
class GLConfig;
class PlatformIpcOperations;
class NestedContext;
/**
* \defgroup platform_enablement Mir platform enablement
*
* Classes and functions that need to be implemented to add support for a graphics platform.
*/
/**
* Interface to platform specific support for graphics operations.
* \ingroup platform_enablement
*/
class Platform
{
public:
Platform() = default;
Platform(const Platform& p) = delete;
Platform& operator=(const Platform& p) = delete;
virtual ~Platform() = default;
/**
* Creates the buffer allocator subsystem.
*/
virtual UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() = 0;
/**
* Creates the display subsystem.
*/
virtual UniqueModulePtr<Display> create_display(
std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
std::shared_ptr<GLConfig> const& gl_config) = 0;
/**
* Creates an object capable of doing platform specific processing of buffers
* before they are sent or after they are recieved accross IPC
*/
virtual UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const = 0;
};
/**
* A measure of how well a platform supports a device
*
* \note This is compared as an integer; best + 1 is a valid PlatformPriority that
* will be used in preference to a module that reports best.
* Platform modules distributed with Mir will never use a priority higher
* than best.
*/
enum PlatformPriority : uint32_t
{
unsupported = 0, /**< Unable to function at all on this device */
dummy = 1, /**< Used only for dummy or stub platforms.
*/
supported = 128, /**< Capable of providing a functioning Platform on this device,
* possibly with degraded performance or features.
*/
best = 256 /**< Capable of providing a Platform with the best features and
* performance this device is capable of.
*/
};
typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateHostPlatform)(
std::shared_ptr<mir::options::Option> const& options,
std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
std::shared_ptr<mir::graphics::DisplayReport> const& report,
std::shared_ptr<mir::logging::Logger> const& logger);
typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateGuestPlatform)(
std::shared_ptr<mir::graphics::DisplayReport> const& report,
std::shared_ptr<mir::graphics::NestedContext> const& nested_context);
typedef void(*AddPlatformOptions)(
boost::program_options::options_description& config);
typedef mir::graphics::PlatformPriority(*PlatformProbe)(mir::options::ProgramOption const& options);
typedef mir::ModuleProperties const*(*DescribeModule)();
}
}
extern "C"
{
#if defined(__clang__)
#pragma clang diagnostic push
// These functions are given "C" linkage to avoid name-mangling, not for C compatibility.
// (We don't want a warning for doing this intentionally.)
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
#endif
/**
* Function prototype used to return a new host graphics platform. The host graphics platform
* is the system entity that owns the physical display and is a mir host server.
*
* \param [in] options options to use for this platform
* \param [in] emergency_cleanup_registry object to register emergency shutdown handlers with
* \param [in] report the object to use to report interesting events from the display subsystem
*
* This factory function needs to be implemented by each platform.
*
* \ingroup platform_enablement
*/
mir::UniqueModulePtr<mir::graphics::Platform> create_host_platform(
std::shared_ptr<mir::options::Option> const& options,
std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
std::shared_ptr<mir::graphics::DisplayReport> const& report,
std::shared_ptr<mir::logging::Logger> const& logger);
/**
* Function prototype used to return a new guest graphics platform. The guest graphics platform
* exists alongside the host platform and do not output or control the physical displays
*
* \param [in] nested_context the object that contains resources needed from the host platform
* \param [in] report the object to use to report interesting events from the display subsystem
*
* This factory function needs to be implemented by each platform.
*
* \ingroup platform_enablement
*/
mir::UniqueModulePtr<mir::graphics::Platform> create_guest_platform(
std::shared_ptr<mir::graphics::DisplayReport> const& report,
std::shared_ptr<mir::graphics::NestedContext> const& nested_context);
/**
* Function prototype used to add platform specific options to the platform-independent server options.
*
* \param [in] config a boost::program_options that can be appended with new options
*
* This factory function needs to be implemented by each platform.
*
* \ingroup platform_enablement
*/
void add_graphics_platform_options(
boost::program_options::options_description& config);
// TODO: We actually need to be more granular here; on a device with more
// than one graphics system we may need a different platform per GPU,
// so we should be associating platforms with graphics devices in some way
mir::graphics::PlatformPriority probe_graphics_platform(mir::options::ProgramOption const& options);
mir::ModuleProperties const* describe_graphics_module();
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}
#endif // MIR_GRAPHICS_PLATFORM_H_
|