Skip to content

Commit

Permalink
Merge pull request #3085 from MirServer/prefer-eglstream-buffer-alloc…
Browse files Browse the repository at this point in the history
…ator

Hold the rendering platforms in description->name order
  • Loading branch information
Saviq authored Oct 20, 2023
2 parents 182bf7c + d1c0d09 commit 9404475
Showing 1 changed file with 12 additions and 3 deletions.
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

0 comments on commit 9404475

Please sign in to comment.