From 40363f54d8a10012a0303a22985ca22790cfe1a8 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 31 Oct 2023 13:47:22 -0600 Subject: [PATCH] WebContent: Use the accelerated_graphics CMake helper Instead of relying on AK_OS_LINUX, actually use the more accurate HAS_ACCELERATED_GRAPHICS define to figure out if we should try to use the generic LibAccelGfx GPU painter. --- Ladybird/WebContent/CMakeLists.txt | 8 +++++++- Userland/Services/WebContent/CMakeLists.txt | 7 +++++++ Userland/Services/WebContent/PageHost.cpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Ladybird/WebContent/CMakeLists.txt b/Ladybird/WebContent/CMakeLists.txt index a400238108..2ac635007a 100644 --- a/Ladybird/WebContent/CMakeLists.txt +++ b/Ladybird/WebContent/CMakeLists.txt @@ -1,3 +1,4 @@ +include(accelerated_graphics) set(WEBCONTENT_SOURCE_DIR ${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/) set(WEBCONTENT_SOURCES @@ -77,6 +78,11 @@ if (HAVE_PULSEAUDIO) endif() endif() -if (LINUX) +if (HAS_ACCELERATED_GRAPHICS) + target_compile_definitions(WebContent PRIVATE HAS_ACCELERATED_GRAPHICS) target_link_libraries(WebContent PRIVATE LibAccelGfx) + if (TARGET webcontent) + target_compile_definitions(webcontent PRIVATE HAS_ACCELERATED_GRAPHICS) + target_link_libraries(webcontent PRIVATE LibAccelGfx) + endif() endif() diff --git a/Userland/Services/WebContent/CMakeLists.txt b/Userland/Services/WebContent/CMakeLists.txt index 88095dc73b..02d8729284 100644 --- a/Userland/Services/WebContent/CMakeLists.txt +++ b/Userland/Services/WebContent/CMakeLists.txt @@ -1,3 +1,5 @@ +include(accelerated_graphics) + serenity_component( WebContent TARGETS WebContent @@ -30,3 +32,8 @@ set(GENERATED_SOURCES serenity_bin(WebContent) target_link_libraries(WebContent PRIVATE LibCore LibFileSystem LibIPC LibGfx LibAudio LibImageDecoderClient LibJS LibWebView LibWeb LibLocale LibMain) link_with_locale_data(WebContent) + +if (HAS_ACCELERATED_GRAPHICS) + target_compile_definitions(WebContent PRIVATE HAS_ACCELERATED_GRAPHICS) + target_link_libraries(WebContent PRIVATE LibAccelGfx) +endif() diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index b33b3cf684..16fe226a90 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -157,7 +157,7 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ document->paintable()->paint_all_phases(context); if (s_use_gpu_painter) { -#ifdef AK_OS_LINUX +#ifdef HAS_ACCELERATED_GRAPHICS Web::Painting::PaintingCommandExecutorGPU painting_command_executor(target); recording_painter.execute(painting_command_executor); #endif