From 4fbae72139ebc3084112cfc86a7d404f123a363d Mon Sep 17 00:00:00 2001 From: MrLop Date: Fri, 16 Aug 2024 11:49:19 +0800 Subject: [PATCH] Change skia feature Signed-off-by: MrLop --- BUILD.gn | 13 ++++++------- bundle.json | 6 +++++- gn/oh_skia.gni | 17 +++++++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 6f56dd83a2..d67e3f2eeb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -47,18 +47,17 @@ config("skia_wno") { cflags += [ "-flto=thin" ] if (enhanced_opt) { cflags += [ "-fwhole-program-vtables" ] - if (graphic_2d_feature_enable_pgo && - graphic_2d_feature_product != "default") { + if (skia_feature_enable_pgo && skia_feature_product != "default") { cflags += [ - "-fprofile-use=" + rebase_path( - "${graphic_2d_feature_pgo_path}/libskia_canvaskit.profdata", - root_build_dir), + "-fprofile-use=" + + rebase_path("${skia_feature_pgo_path}/libskia_canvaskit.profdata", + root_build_dir), "-Wno-error=backend-plugin", "-Wno-profile-instr-out-of-date", "-Wno-profile-instr-unprofiled", ] } - if (graphic_2d_feature_product == "pc" && target_cpu == "arm64" && + if (skia_feature_product == "pc" && target_cpu == "arm64" && current_cpu == "arm64") { cflags += [ "-moutline-atomics" ] } @@ -1828,7 +1827,7 @@ if (use_oh_skia) { "-Wl,-Bsymbolic", ] - if (graphic_2d_feature_enable_pgo && enable_enhanced_opt) { + if (skia_feature_enable_pgo && enable_enhanced_opt) { ldflags += [ "-Wl,-mllvm,-vectorization-bonus-factor=4", "-Wl,-mllvm,-vectorizer-min-trip-count=4", diff --git a/bundle.json b/bundle.json index 456157d4b3..45e5f9afce 100644 --- a/bundle.json +++ b/bundle.json @@ -14,7 +14,11 @@ "name": "skia", "subsystem": "thirdparty", "syscap": [], - "features": [], + "features": [ + "skia_feature_product", + "skia_feature_enable_pgo", + "skia_feature_pgo_path" + ], "adapted_system_type": [ "standard" ], "rom": "", "ram": "", diff --git a/gn/oh_skia.gni b/gn/oh_skia.gni index c3a5c841e6..01c57037ec 100644 --- a/gn/oh_skia.gni +++ b/gn/oh_skia.gni @@ -14,6 +14,12 @@ import("//build/ohos_var.gni") import("//foundation/graphic/graphic_2d/graphic_config.gni") +declare_args() { + skia_feature_product = "default" + skia_feature_enable_pgo = false + skia_feature_pgo_path = "" +} + skia_common_defines = [ "SK_HAS_ANDROID_CODEC", "SK_CODEC_DECODES_JPEG", @@ -53,18 +59,17 @@ if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) { skia_common_cflags += [ "-flto=thin" ] if (enhanced_opt) { skia_common_cflags += [ "-fwhole-program-vtables" ] - if (graphic_2d_feature_enable_pgo && - graphic_2d_feature_product != "default") { + if (skia_feature_enable_pgo && skia_feature_product != "default") { skia_common_cflags += [ - "-fprofile-use=" + rebase_path( - "${graphic_2d_feature_pgo_path}/libskia_canvaskit.profdata", - root_build_dir), + "-fprofile-use=" + + rebase_path("${skia_feature_pgo_path}/libskia_canvaskit.profdata", + root_build_dir), "-Wno-error=backend-plugin", "-Wno-profile-instr-out-of-date", "-Wno-profile-instr-unprofiled", ] } - if (graphic_2d_feature_product == "pc" && target_cpu == "arm64" && + if (skia_feature_product == "pc" && target_cpu == "arm64" && current_cpu == "arm64") { skia_common_cflags += [ "-moutline-atomics" ] } -- Gitee