Skip to content

Commit

Permalink
A more direct implementation to achieve the same thing
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Nov 10, 2023
1 parent 992f9ac commit 1afa8cf
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/server/graphics/default_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,29 +318,25 @@ auto mir::DefaultServerConfiguration::the_rendering_platforms() ->
{
platform_modules = mir::graphics::rendering_modules_for_device(platforms, display_targets, dynamic_cast<mir::options::ProgramOption&>(*the_options()), the_console_services());

// In the case that we've discovered a best platform (most likely a hardware platform)
// then we abandon any platform that is not best.
// In the case that we have more than one platform, we try and remove mir:egl-generic,
// since it is problematic.
// TODO: Remove me once a multi-rendering-platform paradigm is fully supported, and we
// don't just select the first (or last?) platform and use that everywhere.
bool has_best_support_level = false;
for (auto const& platform : platform_modules)
{
if (platform.first.support_level == mg::probe::best)
{
has_best_support_level = true;
break;
}
}

if (has_best_support_level)
if (platform_modules.size() > 1)
{
auto it = platform_modules.begin();
while (it != platform_modules.end())
{
if (it->first.support_level != mg::probe::best)
it = platform_modules.erase(it);
else
it++;
auto describe_module = it->second->load_function<mg::DescribeModule>(
"describe_graphics_module",
MIR_SERVER_GRAPHICS_PLATFORM_VERSION);

auto description = describe_module();
if (strcmp(description->name, "mir:egl-generic") == 0)
{
platform_modules.erase(it);
break;
}
}
}
}
Expand Down

0 comments on commit 1afa8cf

Please sign in to comment.