From 6a19cffddec77de3869c893a5f959ec36c2887d3 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Thu, 1 Aug 2024 19:42:31 +0100 Subject: [PATCH] WebDriver: Add a `--force-cpu-painting` option This launches the browser withb the `--force-cpu-backend` option, which forces Skia to use the CPU backend rather than the GPU. --- Ladybird/WebDriver/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Ladybird/WebDriver/main.cpp b/Ladybird/WebDriver/main.cpp index 844efa6d818..9c1843fb5b2 100644 --- a/Ladybird/WebDriver/main.cpp +++ b/Ladybird/WebDriver/main.cpp @@ -32,7 +32,7 @@ static ErrorOr launch_process(StringView application, ReadonlySpan launch_browser(ByteString const& socket_path, bool use_qt_networking) +static ErrorOr launch_browser(ByteString const& socket_path, bool use_qt_networking, bool force_cpu_painting) { auto arguments = Vector { "--webdriver-content-path", @@ -49,6 +49,8 @@ static ErrorOr launch_browser(ByteString const& socket_path, bool use_qt_ arguments.append("--force-new-process"); if (use_qt_networking) arguments.append("--enable-qt-networking"); + if (force_cpu_painting) + arguments.append("--force-cpu-painting"); arguments.append("about:blank"); @@ -75,12 +77,14 @@ ErrorOr serenity_main(Main::Arguments arguments) auto listen_address = "0.0.0.0"sv; int port = 8000; bool enable_qt_networking = false; + bool force_cpu_painting = false; Core::ArgsParser args_parser; args_parser.add_option(listen_address, "IP address to listen on", "listen-address", 'l', "listen_address"); args_parser.add_option(port, "Port to listen on", "port", 'p', "port"); args_parser.add_option(certificates, "Path to a certificate file", "certificate", 'C', "certificate"); args_parser.add_option(enable_qt_networking, "Launch browser with Qt networking enabled", "enable-qt-networking"); + args_parser.add_option(force_cpu_painting, "Launch browser with GPU painting disabled", "force-cpu-painting"); args_parser.parse(arguments); auto ipv4_address = IPv4Address::from_string(listen_address); @@ -117,7 +121,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } auto launch_browser_callback = [&](ByteString const& socket_path) { - return launch_browser(socket_path, enable_qt_networking); + return launch_browser(socket_path, enable_qt_networking, force_cpu_painting); }; auto maybe_client = WebDriver::Client::try_create(maybe_buffered_socket.release_value(), { move(launch_browser_callback), launch_headless_browser }, server);