Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hold the rendering platforms in description->name order #3085

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/server/graphics/default_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ auto mir::DefaultServerConfiguration::the_rendering_platforms() ->
{
std::stringstream error_report;
std::vector<std::pair<mg::SupportedDevice, std::shared_ptr<mir::SharedLibrary>>> platform_modules;
std::map<std::string, std::shared_ptr<graphics::RenderingPlatform>> rendering_platform_map;

try
{
Expand Down Expand Up @@ -384,12 +385,12 @@ auto mir::DefaultServerConfiguration::the_rendering_platforms() ->
}

// TODO: Do we want to be able to continue on partial failure here?
rendering_platforms.push_back(
rendering_platform_map[description->name] =
create_rendering_platform(
device,
display_interfaces,
*the_options(),
*the_emergency_cleanup()));
*the_emergency_cleanup());
// Add this module to the list searched by the input stack later
// TODO: Come up with a more principled solution for combined input/rendering/output platforms
platform_libraries.push_back(platform);
Expand All @@ -401,6 +402,14 @@ auto mir::DefaultServerConfiguration::the_rendering_platforms() ->
error_report << "Exception while creating rendering platform" << std::endl;
mir::report_exception(error_report);
}

rendering_platforms.reserve(rendering_platform_map.size());

for (auto const& rp : rendering_platform_map)
{
rendering_platforms.push_back(rp.second);
}

if (rendering_platforms.empty())
{
BOOST_THROW_EXCEPTION(std::runtime_error(error_report.str()));
Expand All @@ -423,7 +432,7 @@ mir::DefaultServerConfiguration::the_buffer_allocator()
[&]() -> std::shared_ptr<graphics::GraphicBufferAllocator>
{
// TODO: More than one BufferAllocator
return the_rendering_platforms().back()->create_buffer_allocator(*the_display());
return the_rendering_platforms().front()->create_buffer_allocator(*the_display());
});
}

Expand Down
Loading