From 18ba177d0d2eb7d555d2f87282c7b60191e8f791 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Thu, 19 Oct 2023 14:37:17 +0100 Subject: [PATCH 1/2] Store the rendering platforms in alphabetical order so we prefer eglstream over gbm when choosing a buffer allocator --- src/server/graphics/default_configuration.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/server/graphics/default_configuration.cpp b/src/server/graphics/default_configuration.cpp index 2cd37f0efb8..3a00bbb2391 100644 --- a/src/server/graphics/default_configuration.cpp +++ b/src/server/graphics/default_configuration.cpp @@ -289,6 +289,7 @@ auto mir::DefaultServerConfiguration::the_rendering_platforms() -> { std::stringstream error_report; std::vector>> platform_modules; + std::map> rendering_platform_map; try { @@ -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); @@ -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())); From d1c0d09c28a22b49530e683e3cf1487fc0db3efd Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Thu, 19 Oct 2023 16:13:54 +0100 Subject: [PATCH 2/2] Pick the first rendering platforms (in alphabetical order) so we prefer eglstream over gbm when choosing a buffer allocator --- src/server/graphics/default_configuration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/graphics/default_configuration.cpp b/src/server/graphics/default_configuration.cpp index 3a00bbb2391..ed6f31ceb47 100644 --- a/src/server/graphics/default_configuration.cpp +++ b/src/server/graphics/default_configuration.cpp @@ -432,7 +432,7 @@ mir::DefaultServerConfiguration::the_buffer_allocator() [&]() -> std::shared_ptr { // 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()); }); }