mirror of
https://github.com/RGBCube/serenity
synced 2025-08-15 03: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:
parent
7d26cbf523
commit
b6732b0234
17 changed files with 63 additions and 17 deletions
|
@ -25,6 +25,11 @@ enum class EnableCallgrindProfiling {
|
|||
Yes
|
||||
};
|
||||
|
||||
enum class EnableGPUPainting {
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
|
||||
enum class IsLayoutTestMode {
|
||||
No,
|
||||
Yes
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#include <WebContent/WebContentClientEndpoint.h>
|
||||
#include <WebContent/WebDriverConnection.h>
|
||||
|
||||
#ifdef AK_OS_LINUX
|
||||
# include <LibWeb/Painting/PaintingCommandExecutorGPU.h>
|
||||
#endif
|
||||
|
||||
namespace WebContent {
|
||||
|
||||
PageHost::PageHost(ConnectionFromClient& client)
|
||||
|
@ -36,6 +40,13 @@ PageHost::PageHost(ConnectionFromClient& client)
|
|||
|
||||
PageHost::~PageHost() = default;
|
||||
|
||||
static bool s_use_gpu_painter = false;
|
||||
|
||||
void PageHost::set_use_gpu_painter()
|
||||
{
|
||||
s_use_gpu_painter = true;
|
||||
}
|
||||
|
||||
void PageHost::set_has_focus(bool has_focus)
|
||||
{
|
||||
m_has_focus = has_focus;
|
||||
|
@ -145,8 +156,15 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
|
|||
context.set_has_focus(m_has_focus);
|
||||
document->paintable()->paint_all_phases(context);
|
||||
|
||||
Web::Painting::PaintingCommandExecutorCPU painting_command_executor(target);
|
||||
recording_painter.execute(painting_command_executor);
|
||||
if (s_use_gpu_painter) {
|
||||
#ifdef AK_OS_LINUX
|
||||
Web::Painting::PaintingCommandExecutorGPU painting_command_executor(target);
|
||||
recording_painter.execute(painting_command_executor);
|
||||
#endif
|
||||
} else {
|
||||
Web::Painting::PaintingCommandExecutorCPU painting_command_executor(target);
|
||||
recording_painter.execute(painting_command_executor);
|
||||
}
|
||||
}
|
||||
|
||||
void PageHost::set_viewport_rect(Web::DevicePixelRect const& rect)
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
static NonnullOwnPtr<PageHost> create(ConnectionFromClient& client) { return adopt_own(*new PageHost(client)); }
|
||||
virtual ~PageHost();
|
||||
|
||||
static void set_use_gpu_painter();
|
||||
|
||||
virtual Web::Page& page() override { return *m_page; }
|
||||
virtual Web::Page const& page() const override { return *m_page; }
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
(void)is_layout_test_mode;
|
||||
#else
|
||||
auto candidate_web_content_paths = TRY(get_paths_for_helper_process("WebContent"sv));
|
||||
view->m_client_state.client = TRY(launch_web_content_process(*view, candidate_web_content_paths, WebView::EnableCallgrindProfiling::No, is_layout_test_mode, Ladybird::UseLagomNetworking::No));
|
||||
view->m_client_state.client = TRY(launch_web_content_process(*view, candidate_web_content_paths, WebView::EnableCallgrindProfiling::No, is_layout_test_mode, Ladybird::UseLagomNetworking::No, WebView::EnableGPUPainting::No));
|
||||
#endif
|
||||
|
||||
view->client().async_update_system_theme(move(theme));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue