1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

Ladybird+WebContent: Add option to use GPU painter

Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
This commit is contained in:
Aliaksandr Kalenik 2023-10-27 17:28:18 +02:00 committed by Andreas Kling
parent 7d26cbf523
commit b6732b0234
17 changed files with 63 additions and 17 deletions

View file

@ -41,11 +41,12 @@ static QIcon const& app_icon()
return icon;
}
BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar& cookie_jar, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking)
BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar& cookie_jar, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking, WebView::EnableGPUPainting use_gpu_painting)
: m_cookie_jar(cookie_jar)
, m_webdriver_content_ipc_path(webdriver_content_ipc_path)
, m_enable_callgrind_profiling(enable_callgrind_profiling)
, m_use_lagom_networking(use_lagom_networking)
, m_use_gpu_painting(use_gpu_painting)
{
setWindowIcon(app_icon());
m_tabs_container = new QTabWidget(this);
@ -462,7 +463,7 @@ Tab& BrowserWindow::new_tab(StringView html, Web::HTML::ActivateTab activate_tab
Tab& BrowserWindow::create_new_tab(Web::HTML::ActivateTab activate_tab)
{
auto tab = make<Tab>(this, m_webdriver_content_ipc_path, m_enable_callgrind_profiling, m_use_lagom_networking);
auto tab = make<Tab>(this, m_webdriver_content_ipc_path, m_enable_callgrind_profiling, m_use_lagom_networking, m_use_gpu_painting);
auto tab_ptr = tab.ptr();
m_tabs.append(std::move(tab));

View file

@ -25,7 +25,7 @@ class WebContentView;
class BrowserWindow : public QMainWindow {
Q_OBJECT
public:
explicit BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar&, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling, UseLagomNetworking);
explicit BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar&, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling, UseLagomNetworking, WebView::EnableGPUPainting);
WebContentView& view() const { return m_current_tab->view(); }
@ -121,6 +121,7 @@ private:
StringView m_webdriver_content_ipc_path;
WebView::EnableCallgrindProfiling m_enable_callgrind_profiling;
UseLagomNetworking m_use_lagom_networking;
WebView::EnableGPUPainting m_use_gpu_painting;
};
}

View file

@ -25,7 +25,7 @@ ConsoleWidget::ConsoleWidget(WebContentView& content_view)
{
setLayout(new QVBoxLayout);
m_output_view = new WebContentView({}, WebView::EnableCallgrindProfiling::No, UseLagomNetworking::No);
m_output_view = new WebContentView({}, WebView::EnableCallgrindProfiling::No, UseLagomNetworking::No, WebView::EnableGPUPainting::No);
if (is_using_dark_system_theme(*this))
m_output_view->update_palette(WebContentView::PaletteMode::Dark);

View file

@ -51,7 +51,7 @@ static QIcon create_tvg_icon_with_theme_colors(QString name, QPalette const& pal
return QIcon(icon_engine);
}
Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking)
Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking, WebView::EnableGPUPainting enable_gpu_painting)
: QWidget(window)
, m_window(window)
{
@ -59,7 +59,7 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
m_layout->setSpacing(0);
m_layout->setContentsMargins(0, 0, 0, 0);
m_view = new WebContentView(webdriver_content_ipc_path, enable_callgrind_profiling, use_lagom_networking);
m_view = new WebContentView(webdriver_content_ipc_path, enable_callgrind_profiling, use_lagom_networking, enable_gpu_painting);
m_toolbar = new QToolBar(this);
m_location_edit = new LocationEdit(this);

View file

@ -28,7 +28,7 @@ class InspectorWidget;
class Tab final : public QWidget {
Q_OBJECT
public:
Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling, UseLagomNetworking);
Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling, UseLagomNetworking, WebView::EnableGPUPainting);
virtual ~Tab() override;
WebContentView& view() { return *m_view; }

View file

@ -52,8 +52,9 @@ namespace Ladybird {
bool is_using_dark_system_theme(QWidget&);
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking)
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking, WebView::EnableGPUPainting enable_gpu_painting)
: m_use_lagom_networking(use_lagom_networking)
, m_use_gpu_painting(enable_gpu_painting)
, m_webdriver_content_ipc_path(webdriver_content_ipc_path)
{
setMouseTracking(true);
@ -601,7 +602,7 @@ void WebContentView::create_client(WebView::EnableCallgrindProfiling enable_call
m_client_state = {};
auto candidate_web_content_paths = get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
auto new_client = launch_web_content_process(*this, candidate_web_content_paths, enable_callgrind_profiling, WebView::IsLayoutTestMode::No, m_use_lagom_networking).release_value_but_fixme_should_propagate_errors();
auto new_client = launch_web_content_process(*this, candidate_web_content_paths, enable_callgrind_profiling, WebView::IsLayoutTestMode::No, m_use_lagom_networking, m_use_gpu_painting).release_value_but_fixme_should_propagate_errors();
m_client_state.client = new_client;
m_client_state.client->on_web_content_process_crash = [this] {

View file

@ -42,7 +42,7 @@ class WebContentView final
, public WebView::ViewImplementation {
Q_OBJECT
public:
explicit WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling, UseLagomNetworking);
explicit WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling, UseLagomNetworking, WebView::EnableGPUPainting);
virtual ~WebContentView() override;
Function<String(const AK::URL&, Web::HTML::ActivateTab)> on_tab_open_request;
@ -93,6 +93,7 @@ private:
qreal m_inverse_pixel_scaling_ratio { 1.0 };
bool m_should_show_line_box_borders { false };
UseLagomNetworking m_use_lagom_networking {};
WebView::EnableGPUPainting m_use_gpu_painting {};
Gfx::IntRect m_viewport_rect;

View file

@ -75,6 +75,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool enable_callgrind_profiling = false;
bool enable_sql_database = false;
bool use_lagom_networking = false;
bool use_gpu_painting = false;
Core::ArgsParser args_parser;
args_parser.set_general_help("The Ladybird web browser :^)");
@ -83,6 +84,7 @@ 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(enable_sql_database, "Enable SQL database", "enable-sql-database", 0);
args_parser.add_option(use_lagom_networking, "Enable Lagom servers for networking", "enable-lagom-networking", 0);
args_parser.add_option(use_gpu_painting, "Enable GPU painting", "enable-gpu-painting", 0);
args_parser.parse(arguments);
RefPtr<WebView::Database> database;
@ -106,7 +108,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
initial_urls.append(MUST(ak_string_from_qstring(new_tab_page)));
}
Ladybird::BrowserWindow window(initial_urls, cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_lagom_networking ? Ladybird::UseLagomNetworking::Yes : Ladybird::UseLagomNetworking::No);
Ladybird::BrowserWindow window(initial_urls, cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_lagom_networking ? Ladybird::UseLagomNetworking::Yes : Ladybird::UseLagomNetworking::No, use_gpu_painting ? WebView::EnableGPUPainting::Yes : WebView::EnableGPUPainting::No);
window.setWindowTitle("Ladybird");
if (Ladybird::Settings::the()->is_maximized()) {