1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/config/components/multimodalinput/cursor_config.gni") 15declare_args() { 16 graphic_2d_feature_product = "default" 17 graphic_2d_feature_enable_pgo = false 18 graphic_2d_feature_pgo_path = "" 19 graphic_2d_feature_bootanimation_enable = true 20 graphic_2d_feature_ace_enable_gpu = true 21 graphic_2d_feature_color_gamut_enable = false 22 graphic_2d_feature_rs_enable_eglimage = false 23 graphic_2d_feature_rs_enable_profiler = true 24 graphic_2d_feature_use_texgine = false 25 graphic_2d_feature_rs_enable_uni_render = false 26 graphic_2d_feature_wuji_enable = false 27 graphic_2d_feature_enable_afbc = false 28 graphic_2d_feature_freemem_enable = false 29 graphic_2d_feature_parallel_render_enable = true 30 graphic_2d_feature_enable_vulkan = false 31 graphic_2d_feature_enable_flutter_vulkan = false 32 graphic_2d_feature_enable_opengl = true 33 graphic_2d_feature_enable_sdf = false 34 graphic_2d_feature_enable_opinc = false 35 graphic_2d_feature_enable_filter_cache = true 36 graphic_2d_feature_parallel_upload_enable = true 37 enable_text_gine = true 38 use_texgine = false 39 use_skia_txt = true 40 use_video_processing_engine = false 41 logger_enable_scope = false 42 texgine_enable_debug_log = false 43 player_framework_enable = true 44 graphic_2d_feature_drivers_interface_display_enable = true 45 graphic_2d_feature_tp_switch_enbale = false 46 graphic_2d_feature_use_igraphics_extend_hooks = false 47 graphic_2d_feature_use_aps_igameservice_func = false 48 graphic_2d_feature_enable_chipset_vsync = false 49 graphic_2d_feature_enable_rspipeline = true 50 graphic_2d_feature_enable_prefetch = true 51 graphic_2d_feature_bootanimation_ext_enable = "default" 52 graphic_2d_support_access_token = true 53 graphic_2d_feature_overlay_display_enable = false 54 55 if (defined(is_arkui_x) && is_arkui_x) { 56 is_cross_platform = true 57 } else { 58 is_cross_platform = false 59 } 60} 61 62declare_args() { 63 graphic_2d_feature_enable_stack_culling = false 64 graphic_2d_feature_vkqueue_priority_enable = false 65} 66 67if (graphic_2d_feature_product == "phone" || 68 graphic_2d_feature_product == "pc" || 69 graphic_2d_feature_product == "tablet" || 70 graphic_2d_feature_product == "wearable") { 71 graphic_2d_feature_enable_vulkan = true 72 graphic_2d_feature_enable_stack_culling = true 73} 74 75if (graphic_2d_feature_product == "phone" || 76 graphic_2d_feature_product == "tablet" || 77 graphic_2d_feature_product == "wearable") { 78 graphic_2d_feature_enable_opinc = true 79} 80 81gpu_defines = [] 82accessibility_defines = [] 83if (enable_text_gine) { 84 gpu_defines += [ "USE_GRAPHIC_TEXT_GINE" ] 85} 86if (graphic_2d_feature_ace_enable_gpu) { 87 if (graphic_2d_feature_enable_flutter_vulkan) { 88 gpu_defines += [ "RS_ENABLE_OLD_VK" ] 89 } 90 if (graphic_2d_feature_enable_vulkan) { 91 gpu_defines += [ 92 "ACE_ENABLE_VK", 93 "RS_ENABLE_VK", 94 ] 95 } 96 if (graphic_2d_feature_enable_opengl) { 97 gpu_defines += [ 98 "ACE_ENABLE_GL", 99 "RS_ENABLE_GL", 100 ] 101 } 102 if (graphic_2d_feature_enable_stack_culling) { 103 gpu_defines += [ "RS_ENABLE_STACK_CULLING" ] 104 } 105 106 if (graphic_2d_feature_enable_opinc) { 107 gpu_defines += [ "DDGR_ENABLE_FEATURE_OPINC" ] 108 } 109 110 if (graphic_2d_feature_rs_enable_profiler) { 111 gpu_defines += [ "SKP_RECORDING_ENABLED" ] 112 } 113 114 ace_enable_gpu = true 115 rs_enable_gpu = true 116 surface_enable_gpu = true 117 118 libvulkan = [] 119 if (graphic_2d_feature_enable_vulkan) { 120 libvulkan += [ "//third_party/vulkan-loader:vulkan_loader" ] 121 } 122} else { 123 gpu_defines += [ "ACE_DISABLE_GL" ] 124 ace_enable_gpu = false 125 rs_enable_gpu = false 126 surface_enable_gpu = false 127 libvulkan = [] 128} 129 130if (graphic_2d_feature_enable_vulkan && 131 graphic_2d_feature_vkqueue_priority_enable) { 132 gpu_defines += [ "RS_ENABLE_VKQUEUE_PRIORITY" ] 133} 134 135if (graphic_2d_feature_parallel_upload_enable && 136 graphic_2d_feature_rs_enable_uni_render && 137 graphic_2d_feature_product == "phone") { 138 rs_enable_parallel_upload = true 139 gpu_defines += [ "RS_ENABLE_PARALLEL_UPLOAD" ] 140} else { 141 rs_enable_parallel_upload = false 142} 143 144if (graphic_2d_feature_rs_enable_eglimage || current_os == "android") { 145 gpu_defines += [ 146 "RS_ENABLE_EGLIMAGE", 147 "RS_ENABLE_EGLQUERYSURFACE", 148 ] 149 rs_enable_eglimage = true 150} else { 151 gpu_defines += [ "RS_DISABLE_EGLIMAGE" ] 152 rs_enable_eglimage = false 153} 154 155# use_texgine = graphic_2d_feature_use_texgine 156 157if (graphic_2d_feature_rs_enable_uni_render) { 158 graphic_2d_feature_enable_dvsync = true 159 graphic_2d_feature_enable_sdf = true 160 if (graphic_2d_feature_product == "phone") { 161 graphic_2d_feature_enable_chipset_vsync = true 162 } 163 gpu_defines += [ "RS_ENABLE_UNI_RENDER" ] 164} else { 165 graphic_2d_feature_enable_dvsync = false 166 graphic_2d_feature_enable_sdf = false 167 graphic_2d_feature_enable_chipset_vsync = false 168} 169 170if (graphic_2d_feature_enable_afbc) { 171 gpu_defines += [ "RS_ENABLE_AFBC" ] 172} 173 174if (graphic_2d_feature_parallel_render_enable) { 175 rs_enable_parallel_render = true 176 gpu_defines += [ "RS_ENABLE_PARALLEL_RENDER" ] 177} 178 179if (graphic_2d_feature_enable_dvsync) { 180 gpu_defines += [ "RS_ENABLE_DVSYNC_2" ] 181} 182if (graphic_2d_feature_enable_chipset_vsync) { 183 gpu_defines += [ "RS_ENABLE_CHIPSET_VSYNC" ] 184} 185 186tp_defines = [] 187tp_feature_enable = false 188if (graphic_2d_feature_tp_switch_enbale) { 189 tp_feature_enable = true 190 tp_defines = [ "TP_FEATURE_ENABLE" ] 191} 192 193if (graphic_2d_feature_overlay_display_enable) { 194 gpu_defines += [ "RS_ENABLE_OVERLAY_DISPLAY" ] 195} 196 197check_graphic_ext_file_script = "//build/ohos/file_exists.py" 198 199check_ddgr_ext_file_args = [ 200 "--filename", 201 rebase_path("//foundation/graphic/graphic_2d_ext/ddgr/config.gni"), 202] 203check_igraphics_core_file_args = [ 204 "--filename", 205 rebase_path( 206 "//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni"), 207] 208check_igameservice_core_file_args = [ 209 "--filename", 210 rebase_path( 211 "//vendor/huawei/domains/game/gameservice_server/performance/graphics/report/config.gni"), 212] 213check_aps_core_file_args = [ 214 "--filename", 215 rebase_path("//foundation/graphic/graphic_2d_ext/aps_manager/config.gni"), 216] 217check_delegator_ext_file_args = [ 218 "--filename", 219 rebase_path("//foundation/graphic/graphic_2d_ext/delegator/config.gni"), 220] 221check_broker_ext_file_args = [ 222 "--filename", 223 rebase_path( 224 "//foundation/graphic/graphic_2d_ext/ohcore/build/broker_config.gni"), 225] 226check_math_tools_ext_file_args = [ 227 "--filename", 228 rebase_path( 229 "//foundation/graphic/graphic_2d_ext/math_tools/build/math_tools_config.gni"), 230] 231check_hgm_ext_file_args = [ 232 "--filename", 233 rebase_path( 234 "//foundation/graphic/graphic_2d_ext/hgm_manager/build/hgm_config.gni"), 235] 236 237if (exec_script(check_graphic_ext_file_script, 238 check_ddgr_ext_file_args, 239 "string") == "True") { 240 ddgr_ext_configs = { 241 import("//foundation/graphic/graphic_2d_ext/ddgr/config.gni") 242 } 243 if (graphic_2d_feature_ace_enable_gpu && graphic_2d_feature_enable_vulkan) { 244 import("//foundation/graphic/graphic_2d_ext/ddgr/config.gni") 245 if (defined(graphic_2d_ext_feature_enable_ddgr) && 246 graphic_2d_ext_feature_enable_ddgr) { 247 gpu_defines += [ "ENABLE_DDGR_OPTIMIZE" ] 248 } 249 } 250} 251if (exec_script(check_graphic_ext_file_script, 252 check_igraphics_core_file_args, 253 "string") == "True") { 254 graphic_2d_feature_use_igraphics_extend_hooks = true 255 import("//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni") 256} 257if (exec_script(check_graphic_ext_file_script, 258 check_aps_core_file_args, 259 "string") == "True" && 260 exec_script(check_graphic_ext_file_script, 261 check_igameservice_core_file_args, 262 "string") == "True") { 263 graphic_2d_feature_use_aps_igameservice_func = true 264 import("//foundation/graphic/graphic_2d_ext/aps_manager/config.gni") 265 import( 266 "//vendor/huawei/domains/game/gameservice_server/performance/graphics/report/config.gni") 267} 268 269graphic_2d_delegator_configs = { 270} 271if (exec_script(check_graphic_ext_file_script, 272 check_delegator_ext_file_args, 273 "string") == "True") { 274 graphic_2d_delegator_configs = { 275 import("//foundation/graphic/graphic_2d_ext/delegator/config.gni") 276 } 277} 278 279graphic_2d_broker_configs = { 280} 281if (exec_script(check_graphic_ext_file_script, 282 check_broker_ext_file_args, 283 "string") == "True") { 284 graphic_2d_broker_configs = { 285 import("//foundation/graphic/graphic_2d_ext/ohcore/build/broker_config.gni") 286 } 287} 288 289graphic_2d_hgm_configs = { 290} 291if (exec_script(check_graphic_ext_file_script, 292 check_hgm_ext_file_args, 293 "string") == "True") { 294 graphic_2d_hgm_configs = { 295 import( 296 "//foundation/graphic/graphic_2d_ext/hgm_manager/build/hgm_config.gni") 297 } 298} 299 300graphic_2d_math_tools_configs = { 301} 302if (exec_script(check_graphic_ext_file_script, 303 check_math_tools_ext_file_args, 304 "string") == "True") { 305 graphic_2d_math_tools_configs = { 306 import( 307 "//foundation/graphic/graphic_2d_ext/math_tools/build/math_tools_config.gni") 308 } 309} 310 311check_platform_ext_file_args = [ 312 "--filename", 313 rebase_path("//foundation/graphic/graphic_2d_ext/platform/config.gni"), 314] 315graphic_2d_platform_configs = { 316} 317if (exec_script(check_graphic_ext_file_script, 318 check_platform_ext_file_args, 319 "string") == "True") { 320 graphic_2d_platform_configs = { 321 import("//foundation/graphic/graphic_2d_ext/platform/config.gni") 322 } 323} 324 325flutter_root = "//third_party/flutter" 326ace_flutter_engine_root = "$flutter_root/build" 327graphic_2d_root = "//foundation/graphic/graphic_2d" 328graphic_2d_ext_root = "//foundation/graphic/graphic_2d_ext" 329hilog_root = "//base/hiviewdfx/hilog" 330window_base_path = "//foundation/window/window_manager" 331safwk_base = "//foundation/systemabilitymgr/safwk" 332skia_root_new = "//third_party/skia" 333graphic_surface_root = "//foundation/graphic/graphic_surface" 334memmgr_root = "//foundation/resourceschedule/memmgr" 335memmgr_plugin_root = "//foundation/resourceschedule/memmgr_override" 336fuzz_test_output_path = "graphic_2d/graphic_2d" 337video_processing_engine_root = "//foundation/multimedia/video_processing_engine" 338arkui_root = "//foundation/arkui" 339ace_root = "//foundation/arkui/ace_engine" 340bundlefwk_path = "//foundation/bundlemanager/bundle_framework" 341bundlefwk_inner_api_path = "${bundlefwk_path}/interfaces/inner_api" 342mindspore_root = "//third_party/mindspore" 343 344accessibility_enable = false 345if (defined(global_parts_info) && 346 defined(global_parts_info.barrierfree_accessibility)) { 347 accessibility_enable = true 348 accessibility_defines = [ "ACCESSIBILITY_ENABLE" ] 349} 350 351if (defined(global_parts_info) && 352 !defined(global_parts_info.multimedia_player_framework)) { 353 player_framework_enable = false 354} 355 356if (defined(global_parts_info) && 357 defined(global_parts_info.multimedia_video_processing_engine)) { 358 use_video_processing_engine = true 359} 360 361if (defined(global_parts_info) && 362 !defined(global_parts_info.hdf_drivers_interface_display)) { 363 graphic_2d_feature_drivers_interface_display_enable = false 364} 365 366use_memmgr_plugin = false 367if (defined(global_parts_info.resourceschedule_memmgr_override)) { 368 use_memmgr_plugin = true 369} 370use_memmgr = false 371if (defined(global_parts_info.resourceschedule_memmgr)) { 372 use_memmgr = true 373} 374 375_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir) 376_graphic_2d_adapter_dir = 377 rebase_path("$graphic_2d_root/adapter", root_build_dir) 378 379if (defined(is_arkui_x) && is_arkui_x) { 380 # In case of arkui-x compilation, copy android and ios adapters from ace_engine 381 exec_script("$graphic_2d_root/utils/build/copy_arkui_adapters.py", 382 [ 383 _ace_adapter_dir, 384 _graphic_2d_adapter_dir, 385 ]) 386} 387adapters = exec_script("$ace_root/build/search.py", 388 [ _graphic_2d_adapter_dir ], 389 "list lines") 390if (defined(use_clang_coverage) && use_clang_coverage) { 391 graphic_2d_feature_rs_enable_profiler = false 392} 393 394if (defined(input_ext_feature_magiccursor) && input_ext_feature_magiccursor) { 395 gpu_defines += [ "OHOS_BUILD_ENABLE_MAGICCURSOR" ] 396} 397 398if (defined(graphic_2d_feature_enable_prefetch)) { 399 gpu_defines += [ "RS_ENABLE_PREFETCH" ] 400} 401 402if (defined(global_parts_info) && 403 !defined(global_parts_info.security_access_token)) { 404 graphic_2d_support_access_token = false 405} 406