Ver Fonte

Everywhere: Use Skia painter by default

Skia painter is visibly faster than LibGfx painter and has more complete
CSS transforms support. With this change:
- On Linux, it will try to use Vulkan-backend with fallback to
  CPU-backend
- On macOS it will try to use Metal-backend with fallback to
  CPU-backend
- headless-browser always runs with CPU-backend in layout mode
Aliaksandr Kalenik há 1 ano atrás
pai
commit
3627329bed
44 ficheiros alterados com 7 adições e 28 exclusões
  1. 0 3
      Ladybird/AppKit/main.mm
  2. 0 2
      Ladybird/HelperProcess.cpp
  3. 0 3
      Ladybird/Qt/main.cpp
  4. 0 6
      Ladybird/Types.h
  5. 2 4
      Ladybird/WebContent/main.cpp
  6. BIN
      Tests/LibWeb/Screenshot/images/alt-frame.png
  7. BIN
      Tests/LibWeb/Screenshot/images/border-radius-ref.png
  8. BIN
      Tests/LibWeb/Screenshot/images/canvas-arcs-and-ellipses-ref.png
  9. BIN
      Tests/LibWeb/Screenshot/images/canvas-implict-moves-and-lines-ref.png
  10. BIN
      Tests/LibWeb/Screenshot/images/canvas-text-ref.png
  11. BIN
      Tests/LibWeb/Screenshot/images/clip-path-polygon-ref.png
  12. BIN
      Tests/LibWeb/Screenshot/images/css-background-clip-text.png
  13. BIN
      Tests/LibWeb/Screenshot/images/css-background-position-ref.png
  14. BIN
      Tests/LibWeb/Screenshot/images/css-background-repeat-ref.png
  15. BIN
      Tests/LibWeb/Screenshot/images/css-backgrounds-ref.png
  16. BIN
      Tests/LibWeb/Screenshot/images/css-color-functions-ref.png
  17. BIN
      Tests/LibWeb/Screenshot/images/css-gradients-ref.png
  18. BIN
      Tests/LibWeb/Screenshot/images/css-transform-box-ref.png
  19. BIN
      Tests/LibWeb/Screenshot/images/inline-node-ref.png
  20. BIN
      Tests/LibWeb/Screenshot/images/input-placeholder-ref.png
  21. BIN
      Tests/LibWeb/Screenshot/images/meter-ref.png
  22. BIN
      Tests/LibWeb/Screenshot/images/nested-boxes-with-hidden-overflow-and-border-radius-ref.png
  23. BIN
      Tests/LibWeb/Screenshot/images/object-fit-position.png
  24. BIN
      Tests/LibWeb/Screenshot/images/opacity-stacking-ref.png
  25. BIN
      Tests/LibWeb/Screenshot/images/outer-box-shadow-ref.png
  26. BIN
      Tests/LibWeb/Screenshot/images/svg-axis-aligned-lines-ref.png
  27. BIN
      Tests/LibWeb/Screenshot/images/svg-background-no-natural-size-ref.png
  28. BIN
      Tests/LibWeb/Screenshot/images/svg-clip-path-and-mask-ref.png
  29. BIN
      Tests/LibWeb/Screenshot/images/svg-clip-rule-ref.png
  30. BIN
      Tests/LibWeb/Screenshot/images/svg-foreign-object-mask-ref.png
  31. BIN
      Tests/LibWeb/Screenshot/images/svg-gradient-spreadMethod-ref.png
  32. BIN
      Tests/LibWeb/Screenshot/images/svg-maskContentUnits-ref.png
  33. BIN
      Tests/LibWeb/Screenshot/images/svg-non-local-clip-path-ref.png
  34. BIN
      Tests/LibWeb/Screenshot/images/svg-radialGradient-ref.png
  35. BIN
      Tests/LibWeb/Screenshot/images/svg-simple-clipPath-ref.png
  36. BIN
      Tests/LibWeb/Screenshot/images/svg-stroke-paintstyle-with-opacity-ref.png
  37. BIN
      Tests/LibWeb/Screenshot/images/svg-text-effects-ref.png
  38. BIN
      Tests/LibWeb/Screenshot/images/svg-textPath-ref.png
  39. BIN
      Tests/LibWeb/Screenshot/images/text-decorations.png
  40. BIN
      Tests/LibWeb/Screenshot/images/text-shadow-ref.png
  41. 2 1
      Userland/Libraries/LibWeb/Painting/SVGMaskable.cpp
  42. 1 3
      Userland/Services/WebContent/PageClient.cpp
  43. 0 1
      Userland/Services/WebContent/PageClient.h
  44. 2 5
      Userland/Utilities/headless-browser.cpp

+ 0 - 3
Ladybird/AppKit/main.mm

@@ -83,7 +83,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     Vector<ByteString> raw_urls;
     Vector<ByteString> certificates;
     StringView webdriver_content_ipc_path;
-    bool use_skia_painting = false;
     bool debug_web_content = false;
     bool log_all_js_exceptions = false;
     bool enable_http_cache = false;
@@ -95,7 +94,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     args_parser.set_general_help("The Ladybird web browser");
     args_parser.add_positional_argument(raw_urls, "URLs to open", "url", Core::ArgsParser::Required::No);
     args_parser.add_option(webdriver_content_ipc_path, "Path to WebDriver IPC for WebContent", "webdriver-content-path", 0, "path", Core::ArgsParser::OptionHideMode::CommandLineAndMarkdown);
-    args_parser.add_option(use_skia_painting, "Enable Skia painting", "enable-skia-painting");
     args_parser.add_option(debug_web_content, "Wait for debugger to attach to WebContent", "debug-web-content");
     args_parser.add_option(certificates, "Path to a certificate file", "certificate", 'C', "certificate");
     args_parser.add_option(log_all_js_exceptions, "Log all JavaScript exceptions", "log-all-js-exceptions");
@@ -142,7 +140,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     Ladybird::WebContentOptions web_content_options {
         .command_line = MUST(command_line_builder.to_string()),
         .executable_path = MUST(String::from_byte_string(MUST(Core::System::current_executable_path()))),
-        .enable_skia_painting = use_skia_painting ? Ladybird::EnableSkiaPainting::Yes : Ladybird::EnableSkiaPainting::No,
         .wait_for_debugger = debug_web_content ? Ladybird::WaitForDebugger::Yes : Ladybird::WaitForDebugger::No,
         .log_all_js_exceptions = log_all_js_exceptions ? Ladybird::LogAllJSExceptions::Yes : Ladybird::LogAllJSExceptions::No,
         .enable_http_cache = enable_http_cache ? Ladybird::EnableHTTPCache::Yes : Ladybird::EnableHTTPCache::No,

+ 0 - 2
Ladybird/HelperProcess.cpp

@@ -88,8 +88,6 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
         arguments.append("--layout-test-mode"sv);
     if (web_content_options.use_lagom_networking == Ladybird::UseLagomNetworking::Yes)
         arguments.append("--use-lagom-networking"sv);
-    if (web_content_options.enable_skia_painting == Ladybird::EnableSkiaPainting::Yes)
-        arguments.append("--use-skia-painting"sv);
     if (web_content_options.wait_for_debugger == Ladybird::WaitForDebugger::Yes)
         arguments.append("--wait-for-debugger"sv);
     if (web_content_options.log_all_js_exceptions == Ladybird::LogAllJSExceptions::Yes)

+ 0 - 3
Ladybird/Qt/main.cpp

@@ -93,7 +93,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     bool disable_sql_database = false;
     bool enable_qt_networking = false;
     bool expose_internals_object = false;
-    bool use_skia_painting = false;
     bool debug_web_content = false;
     bool log_all_js_exceptions = false;
     bool enable_idl_tracing = false;
@@ -109,7 +108,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     args_parser.add_option(enable_callgrind_profiling, "Enable Callgrind profiling", "enable-callgrind-profiling", 'P');
     args_parser.add_option(disable_sql_database, "Disable SQL database", "disable-sql-database");
     args_parser.add_option(enable_qt_networking, "Enable Qt as the backend networking service", "enable-qt-networking");
-    args_parser.add_option(use_skia_painting, "Enable Skia painting", "enable-skia-painting");
     args_parser.add_option(debug_web_content, "Wait for debugger to attach to WebContent", "debug-web-content");
     args_parser.add_option(certificates, "Path to a certificate file", "certificate", 'C', "certificate");
     args_parser.add_option(log_all_js_exceptions, "Log all JavaScript exceptions", "log-all-js-exceptions");
@@ -179,7 +177,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
         .executable_path = MUST(String::from_byte_string(MUST(Core::System::current_executable_path()))),
         .config_path = Ladybird::Settings::the()->directory(),
         .enable_callgrind_profiling = enable_callgrind_profiling ? Ladybird::EnableCallgrindProfiling::Yes : Ladybird::EnableCallgrindProfiling::No,
-        .enable_skia_painting = use_skia_painting ? Ladybird::EnableSkiaPainting::Yes : Ladybird::EnableSkiaPainting::No,
         .use_lagom_networking = enable_qt_networking ? Ladybird::UseLagomNetworking::No : Ladybird::UseLagomNetworking::Yes,
         .wait_for_debugger = debug_web_content ? Ladybird::WaitForDebugger::Yes : Ladybird::WaitForDebugger::No,
         .log_all_js_exceptions = log_all_js_exceptions ? Ladybird::LogAllJSExceptions::Yes : Ladybird::LogAllJSExceptions::No,

+ 0 - 6
Ladybird/Types.h

@@ -15,11 +15,6 @@ enum class EnableCallgrindProfiling {
     Yes
 };
 
-enum class EnableSkiaPainting {
-    No,
-    Yes
-};
-
 enum class IsLayoutTestMode {
     No,
     Yes
@@ -60,7 +55,6 @@ struct WebContentOptions {
     String executable_path;
     Optional<ByteString> config_path {};
     EnableCallgrindProfiling enable_callgrind_profiling { EnableCallgrindProfiling::No };
-    EnableSkiaPainting enable_skia_painting { EnableSkiaPainting::No };
     IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };
     UseLagomNetworking use_lagom_networking { UseLagomNetworking::Yes };
     WaitForDebugger wait_for_debugger { WaitForDebugger::No };

+ 2 - 4
Ladybird/WebContent/main.cpp

@@ -136,10 +136,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     Web::set_chrome_process_command_line(command_line);
     Web::set_chrome_process_executable_path(executable_path);
 
-    if (use_skia_painter) {
-        // Always use the CPU backend for layout tests, as the GPU backend is not deterministic
-        WebContent::PageClient::set_use_skia_painter(is_layout_test_mode ? WebContent::PageClient::UseSkiaPainter::CPUBackend : WebContent::PageClient::UseSkiaPainter::GPUBackendIfAvailable);
-    }
+    // Always use the CPU backend for layout tests, as the GPU backend is not deterministic
+    WebContent::PageClient::set_use_skia_painter(is_layout_test_mode ? WebContent::PageClient::UseSkiaPainter::CPUBackend : WebContent::PageClient::UseSkiaPainter::GPUBackendIfAvailable);
 
     if (enable_http_cache) {
         Web::Fetch::Fetching::g_http_cache_enabled = true;

BIN
Tests/LibWeb/Screenshot/images/alt-frame.png


BIN
Tests/LibWeb/Screenshot/images/border-radius-ref.png


BIN
Tests/LibWeb/Screenshot/images/canvas-arcs-and-ellipses-ref.png


BIN
Tests/LibWeb/Screenshot/images/canvas-implict-moves-and-lines-ref.png


BIN
Tests/LibWeb/Screenshot/images/canvas-text-ref.png


BIN
Tests/LibWeb/Screenshot/images/clip-path-polygon-ref.png


BIN
Tests/LibWeb/Screenshot/images/css-background-clip-text.png


BIN
Tests/LibWeb/Screenshot/images/css-background-position-ref.png


BIN
Tests/LibWeb/Screenshot/images/css-background-repeat-ref.png


BIN
Tests/LibWeb/Screenshot/images/css-backgrounds-ref.png


BIN
Tests/LibWeb/Screenshot/images/css-color-functions-ref.png


BIN
Tests/LibWeb/Screenshot/images/css-gradients-ref.png


BIN
Tests/LibWeb/Screenshot/images/css-transform-box-ref.png


BIN
Tests/LibWeb/Screenshot/images/inline-node-ref.png


BIN
Tests/LibWeb/Screenshot/images/input-placeholder-ref.png


BIN
Tests/LibWeb/Screenshot/images/meter-ref.png


BIN
Tests/LibWeb/Screenshot/images/nested-boxes-with-hidden-overflow-and-border-radius-ref.png


BIN
Tests/LibWeb/Screenshot/images/object-fit-position.png


BIN
Tests/LibWeb/Screenshot/images/opacity-stacking-ref.png


BIN
Tests/LibWeb/Screenshot/images/outer-box-shadow-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-axis-aligned-lines-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-background-no-natural-size-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-clip-path-and-mask-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-clip-rule-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-foreign-object-mask-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-gradient-spreadMethod-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-maskContentUnits-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-non-local-clip-path-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-radialGradient-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-simple-clipPath-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-stroke-paintstyle-with-opacity-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-text-effects-ref.png


BIN
Tests/LibWeb/Screenshot/images/svg-textPath-ref.png


BIN
Tests/LibWeb/Screenshot/images/text-decorations.png


BIN
Tests/LibWeb/Screenshot/images/text-shadow-ref.png


+ 2 - 1
Userland/Libraries/LibWeb/Painting/SVGMaskable.cpp

@@ -8,6 +8,7 @@
 #include <LibWeb/Layout/SVGClipBox.h>
 #include <LibWeb/Layout/SVGMaskBox.h>
 #include <LibWeb/Painting/DisplayListPlayerCPU.h>
+#include <LibWeb/Painting/DisplayListPlayerSkia.h>
 #include <LibWeb/Painting/SVGClipPaintable.h>
 #include <LibWeb/Painting/SVGGraphicsPaintable.h>
 #include <LibWeb/Painting/StackingContext.h>
@@ -88,7 +89,7 @@ RefPtr<Gfx::Bitmap> SVGMaskable::calculate_mask_of_svg(PaintContext& context, CS
         paint_context.set_svg_transform(graphics_element.get_transform());
         paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable));
         StackingContext::paint_node_as_stacking_context(paintable, paint_context);
-        DisplayListPlayerCPU executor { *mask_bitmap };
+        DisplayListPlayerSkia executor { *mask_bitmap };
         display_list.execute(executor);
         return mask_bitmap;
     };

+ 1 - 3
Userland/Services/WebContent/PageClient.cpp

@@ -27,7 +27,7 @@
 
 namespace WebContent {
 
-static PageClient::UseSkiaPainter s_use_skia_painter = PageClient::UseSkiaPainter::No;
+static PageClient::UseSkiaPainter s_use_skia_painter = PageClient::UseSkiaPainter::GPUBackendIfAvailable;
 
 JS_DEFINE_ALLOCATOR(PageClient);
 
@@ -733,8 +733,6 @@ void PageClient::did_get_js_console_messages(i32 start_index, Vector<ByteString>
 Web::DisplayListPlayerType PageClient::display_list_player_type() const
 {
     switch (s_use_skia_painter) {
-    case UseSkiaPainter::No:
-        return Web::DisplayListPlayerType::CPU;
     case UseSkiaPainter::GPUBackendIfAvailable:
         return Web::DisplayListPlayerType::SkiaGPUIfAvailable;
     case UseSkiaPainter::CPUBackend:

+ 0 - 1
Userland/Services/WebContent/PageClient.h

@@ -28,7 +28,6 @@ public:
     virtual ~PageClient() override;
 
     enum class UseSkiaPainter {
-        No,
         CPUBackend,
         GPUBackendIfAvailable,
     };

+ 2 - 5
Userland/Utilities/headless-browser.cpp

@@ -64,7 +64,7 @@ static StringView s_current_test_path;
 
 class HeadlessWebContentView final : public WebView::ViewImplementation {
 public:
-    static ErrorOr<NonnullOwnPtr<HeadlessWebContentView>> create(Core::AnonymousBuffer theme, Gfx::IntSize const& window_size, String const& command_line, StringView web_driver_ipc_path, Ladybird::IsLayoutTestMode is_layout_test_mode = Ladybird::IsLayoutTestMode::No, Vector<ByteString> const& certificates = {}, StringView resources_folder = {}, Ladybird::EnableSkiaPainting enable_skia_painting = Ladybird::EnableSkiaPainting::No)
+    static ErrorOr<NonnullOwnPtr<HeadlessWebContentView>> create(Core::AnonymousBuffer theme, Gfx::IntSize const& window_size, String const& command_line, StringView web_driver_ipc_path, Ladybird::IsLayoutTestMode is_layout_test_mode = Ladybird::IsLayoutTestMode::No, Vector<ByteString> const& certificates = {}, StringView resources_folder = {})
     {
         RefPtr<Protocol::RequestClient> request_client;
         RefPtr<ImageDecoderClient::Client> image_decoder_client;
@@ -83,7 +83,6 @@ public:
         Ladybird::WebContentOptions web_content_options {
             .command_line = command_line,
             .executable_path = MUST(String::from_byte_string(MUST(Core::System::current_executable_path()))),
-            .enable_skia_painting = enable_skia_painting,
             .is_layout_test_mode = is_layout_test_mode,
         };
 
@@ -647,7 +646,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     bool dump_text = false;
     bool dump_gc_graph = false;
     bool is_layout_test_mode = false;
-    bool enable_skia_painting = false;
     StringView test_root_path;
     ByteString test_glob;
     Vector<ByteString> certificates;
@@ -668,7 +666,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     args_parser.add_option(web_driver_ipc_path, "Path to the WebDriver IPC socket", "webdriver-ipc-path", 0, "path");
     args_parser.add_option(is_layout_test_mode, "Enable layout test mode", "layout-test-mode");
     args_parser.add_option(certificates, "Path to a certificate file", "certificate", 'C', "certificate");
-    args_parser.add_option(enable_skia_painting, "Enable Skia painting", "enable-skia-painting");
     args_parser.add_positional_argument(raw_url, "URL to open", "url", Core::ArgsParser::Required::No);
     args_parser.parse(arguments);
 
@@ -687,7 +684,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
 
     StringBuilder command_line_builder;
     command_line_builder.join(' ', arguments.strings);
-    auto view = TRY(HeadlessWebContentView::create(move(theme), window_size, MUST(command_line_builder.to_string()), web_driver_ipc_path, is_layout_test_mode ? Ladybird::IsLayoutTestMode::Yes : Ladybird::IsLayoutTestMode::No, certificates, resources_folder, enable_skia_painting ? Ladybird::EnableSkiaPainting::Yes : Ladybird::EnableSkiaPainting::No));
+    auto view = TRY(HeadlessWebContentView::create(move(theme), window_size, MUST(command_line_builder.to_string()), web_driver_ipc_path, is_layout_test_mode ? Ladybird::IsLayoutTestMode::Yes : Ladybird::IsLayoutTestMode::No, certificates, resources_folder));
 
     if (!test_root_path.is_empty()) {
         test_glob = ByteString::formatted("*{}*", test_glob);