• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_enable_codemerge = false
19  graphic_2d_feature_pgo_path = ""
20  graphic_2d_feature_bootanimation_enable = true
21  graphic_2d_feature_ace_enable_gpu = true
22  graphic_2d_feature_color_gamut_enable = false
23  graphic_2d_feature_rs_enable_eglimage = false
24  graphic_2d_feature_rs_enable_profiler = true
25  graphic_2d_feature_use_texgine = false
26  graphic_2d_feature_rs_enable_uni_render = false
27  graphic_2d_feature_wuji_enable = false
28  graphic_2d_feature_enable_afbc = false
29  graphic_2d_feature_freemem_enable = false
30  graphic_2d_feature_parallel_render_enable = true
31  graphic_2d_feature_enable_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  enable_text_gine = true
37  use_skia_txt = true
38  use_video_processing_engine = false
39  logger_enable_scope = false
40  player_framework_enable = true
41  graphic_2d_feature_drivers_interface_display_enable = true
42  graphic_2d_feature_tp_switch_enbale = false
43  graphic_2d_feature_use_igraphics_extend_hooks = false
44  graphic_2d_feature_use_aps_igameservice_func = false
45  graphic_2d_feature_enable_chipset_vsync = false
46  graphic_2d_feature_enable_rspipeline = true
47  graphic_2d_feature_enable_prefetch = true
48  graphic_2d_feature_bootanimation_ext_enable = "default"
49  graphic_2d_support_access_token = true
50  graphic_2d_feature_overlay_display_enable = false
51  enable_full_screen_recongnize = false
52  graphic_2d_feature_enable_opengl_to_vulkan = false
53  graphic_2d_feature_screenless_enable = false
54  graphic_2d_feature_tv_metadata_enable = false
55  graphic_2d_modifier_ng_enable = true
56  graphic_2d_feature_upgrade_skia = true
57  graphic_2d_feature_enable_rdo = false
58  graphic_2d_feature_enable_memory_info_manager = false
59
60  if (defined(is_arkui_x) && is_arkui_x) {
61    is_cross_platform = true
62  } else {
63    is_cross_platform = false
64  }
65
66  graphic_2d_feature_subtree_parallel_enable = false
67}
68
69declare_args() {
70  graphic_2d_feature_enable_stack_culling = false
71}
72
73if (graphic_2d_feature_product == "phone" ||
74    graphic_2d_feature_product == "pc" ||
75    graphic_2d_feature_product == "tablet" ||
76    graphic_2d_feature_product == "wearable") {
77  graphic_2d_feature_enable_vulkan = true
78  graphic_2d_feature_enable_stack_culling = true
79}
80
81if (graphic_2d_feature_product == "phone" ||
82    graphic_2d_feature_product == "tablet" ||
83    graphic_2d_feature_product == "wearable") {
84  graphic_2d_feature_enable_opinc = true
85}
86
87if (graphic_2d_feature_product == "tablet") {
88  enable_full_screen_recongnize = true
89}
90
91gpu_defines = []
92accessibility_defines = []
93
94if (graphic_2d_feature_screenless_enable) {
95  gpu_defines += ["SCREENLESS_DEVICE"]
96}
97
98if (graphic_2d_feature_ace_enable_gpu) {
99  if (graphic_2d_feature_enable_vulkan) {
100    gpu_defines += [
101      "ACE_ENABLE_VK",
102      "RS_ENABLE_VK",
103    ]
104  }
105  if (graphic_2d_feature_enable_opengl) {
106    gpu_defines += [
107      "ACE_ENABLE_GL",
108      "RS_ENABLE_GL",
109    ]
110  }
111  if (graphic_2d_feature_enable_stack_culling) {
112    gpu_defines += [ "RS_ENABLE_STACK_CULLING" ]
113  }
114
115  if (graphic_2d_feature_enable_opinc) {
116    gpu_defines += [ "DDGR_ENABLE_FEATURE_OPINC" ]
117  }
118
119  if (graphic_2d_feature_rs_enable_profiler) {
120    gpu_defines += [ "SKP_RECORDING_ENABLED" ]
121  }
122
123  ace_enable_gpu = true
124  rs_enable_gpu = true
125  surface_enable_gpu = true
126
127  libvulkan = []
128  if (graphic_2d_feature_enable_vulkan) {
129    libvulkan += [ "vulkan-loader:vulkan_loader" ]
130  }
131} else {
132  gpu_defines += [ "ACE_DISABLE_GL" ]
133  ace_enable_gpu = false
134  rs_enable_gpu = false
135  surface_enable_gpu = false
136  libvulkan = []
137}
138
139if (graphic_2d_feature_subtree_parallel_enable) {
140  gpu_defines += [ "SUBTREE_PARALLEL_ENABLE" ]
141}
142
143if (graphic_2d_feature_rs_enable_eglimage || current_os == "android") {
144  gpu_defines += [
145    "RS_ENABLE_EGLIMAGE",
146    "RS_ENABLE_EGLQUERYSURFACE",
147  ]
148  rs_enable_eglimage = true
149} else {
150  gpu_defines += [ "RS_DISABLE_EGLIMAGE" ]
151  rs_enable_eglimage = false
152}
153
154if (graphic_2d_feature_rs_enable_uni_render) {
155  graphic_2d_feature_enable_dvsync = true
156  graphic_2d_feature_enable_sdf = true
157  if (graphic_2d_feature_product == "phone") {
158    graphic_2d_feature_enable_chipset_vsync = true
159  }
160  gpu_defines += [ "RS_ENABLE_UNI_RENDER" ]
161} else {
162  graphic_2d_feature_enable_dvsync = false
163  graphic_2d_feature_enable_sdf = false
164  graphic_2d_feature_enable_chipset_vsync = false
165}
166
167if (graphic_2d_feature_enable_afbc) {
168  gpu_defines += [ "RS_ENABLE_AFBC" ]
169}
170
171if (graphic_2d_feature_parallel_render_enable) {
172  rs_enable_parallel_render = true
173  gpu_defines += [ "RS_ENABLE_PARALLEL_RENDER" ]
174}
175
176if (graphic_2d_feature_enable_dvsync) {
177  gpu_defines += [ "RS_ENABLE_DVSYNC_2" ]
178}
179if (graphic_2d_feature_enable_chipset_vsync) {
180  gpu_defines += [ "RS_ENABLE_CHIPSET_VSYNC" ]
181}
182
183tp_defines = []
184tp_feature_enable = false
185if (graphic_2d_feature_tp_switch_enbale) {
186  tp_feature_enable = true
187  tp_defines = [ "TP_FEATURE_ENABLE" ]
188}
189
190if (graphic_2d_feature_overlay_display_enable) {
191  gpu_defines += [ "RS_ENABLE_OVERLAY_DISPLAY" ]
192}
193
194if (graphic_2d_feature_tv_metadata_enable) {
195  gpu_defines += [ "RS_ENABLE_TV_PQ_METADATA" ]
196}
197
198check_graphic_ext_file_script = "//build/ohos/file_exists.py"
199
200check_ddgr_ext_file_args = [
201  "--filename",
202  rebase_path("//foundation/graphic/graphic_2d_ext/ddgr/config.gni"),
203]
204check_igraphics_core_file_args = [
205  "--filename",
206  rebase_path(
207      "//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni"),
208]
209check_igameservice_core_file_args = [
210  "--filename",
211  rebase_path(
212      "//vendor/huawei/domains/game/gameservice_server/performance/graphics/report/config.gni"),
213]
214check_aps_core_file_args = [
215  "--filename",
216  rebase_path("//foundation/graphic/graphic_2d_ext/aps_manager/config.gni"),
217]
218check_delegator_ext_file_args = [
219  "--filename",
220  rebase_path("//foundation/graphic/graphic_2d_ext/delegator/config.gni"),
221]
222check_broker_ext_file_args = [
223  "--filename",
224  rebase_path(
225      "//foundation/graphic/graphic_2d_ext/ohcore/build/broker_config.gni"),
226]
227check_math_tools_ext_file_args = [
228  "--filename",
229  rebase_path(
230      "//foundation/graphic/graphic_2d_ext/math_tools/build/math_tools_config.gni"),
231]
232check_hgm_ext_file_args = [
233  "--filename",
234  rebase_path(
235      "//foundation/graphic/graphic_2d_ext/hgm_manager/build/hgm_config.gni"),
236]
237check_modifiers_draw_ext_file_args = [
238  "--filename",
239  rebase_path(
240      "//foundation/graphic/graphic_2d_ext/modifiers_draw/build/modifiers_draw_config.gni"),
241]
242
243check_subtree_ext_file_args = [
244  "--filename",
245  rebase_path(
246    "//foundation/graphic/graphic_2d_ext/subtree/build/subtree_config.gni"),
247]
248
249if (exec_script(check_graphic_ext_file_script,
250                check_ddgr_ext_file_args,
251                "string") == "True") {
252  ddgr_ext_configs = {
253    import("//foundation/graphic/graphic_2d_ext/ddgr/config.gni")
254  }
255  import("//foundation/graphic/graphic_2d_ext/ddgr/config.gni")
256  if (graphic_2d_feature_ace_enable_gpu && graphic_2d_feature_enable_vulkan) {
257    if (defined(graphic_2d_ext_feature_enable_ddgr) &&
258        graphic_2d_ext_feature_enable_ddgr) {
259      gpu_defines += [ "ENABLE_DDGR_OPTIMIZE" ]
260    }
261  }
262}
263if (exec_script(check_graphic_ext_file_script,
264                check_igraphics_core_file_args,
265                "string") == "True") {
266  graphic_2d_feature_use_igraphics_extend_hooks = true
267  import("//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni")
268}
269if (exec_script(check_graphic_ext_file_script,
270                check_aps_core_file_args,
271                "string") == "True" &&
272    exec_script(check_graphic_ext_file_script,
273                check_igameservice_core_file_args,
274                "string") == "True") {
275  graphic_2d_feature_use_aps_igameservice_func = true
276  import("//foundation/graphic/graphic_2d_ext/aps_manager/config.gni")
277  import(
278      "//vendor/huawei/domains/game/gameservice_server/performance/graphics/report/config.gni")
279}
280
281graphic_2d_delegator_configs = {
282}
283if (exec_script(check_graphic_ext_file_script,
284                check_delegator_ext_file_args,
285                "string") == "True") {
286  graphic_2d_delegator_configs = {
287    import("//foundation/graphic/graphic_2d_ext/delegator/config.gni")
288  }
289}
290
291graphic_2d_broker_configs = {
292}
293if (exec_script(check_graphic_ext_file_script,
294                check_broker_ext_file_args,
295                "string") == "True") {
296  graphic_2d_broker_configs = {
297    import("//foundation/graphic/graphic_2d_ext/ohcore/build/broker_config.gni")
298  }
299}
300
301graphic_2d_hgm_configs = {
302}
303if (exec_script(check_graphic_ext_file_script,
304                check_hgm_ext_file_args,
305                "string") == "True") {
306  graphic_2d_hgm_configs = {
307    import(
308        "//foundation/graphic/graphic_2d_ext/hgm_manager/build/hgm_config.gni")
309  }
310}
311
312graphic_2d_math_tools_configs = {
313}
314if (exec_script(check_graphic_ext_file_script,
315                check_math_tools_ext_file_args,
316                "string") == "True") {
317  graphic_2d_math_tools_configs = {
318    import(
319        "//foundation/graphic/graphic_2d_ext/math_tools/build/math_tools_config.gni")
320  }
321}
322
323check_platform_ext_file_args = [
324  "--filename",
325  rebase_path("//foundation/graphic/graphic_2d_ext/platform/config.gni"),
326]
327graphic_2d_platform_configs = {
328}
329if (exec_script(check_graphic_ext_file_script,
330                check_platform_ext_file_args,
331                "string") == "True") {
332  graphic_2d_platform_configs = {
333    import("//foundation/graphic/graphic_2d_ext/platform/config.gni")
334  }
335}
336
337graphic_2d_modifiers_draw_configs = {
338}
339if (exec_script(check_graphic_ext_file_script,
340                check_modifiers_draw_ext_file_args,
341                "string") == "True") {
342  graphic_2d_modifiers_draw_configs = {
343    import(
344        "//foundation/graphic/graphic_2d_ext/modifiers_draw/build/modifiers_draw_config.gni")
345  }
346}
347
348graphic_2d_subtree_config = {}
349
350if (exec_script(check_graphic_ext_file_script,
351                check_subtree_ext_file_args,
352                "string") == "True") {
353  graphic_2d_subtree_config = {
354    import(
355      "//foundation/graphic/graphic_2d_ext/subtree/build/subtree_config/gni")
356  }
357}
358
359flutter_root = "//third_party/flutter"
360ace_flutter_engine_root = "$flutter_root/build"
361graphic_2d_root = "//foundation/graphic/graphic_2d"
362graphic_2d_ext_root = "//foundation/graphic/graphic_2d_ext"
363hilog_root = "//base/hiviewdfx/hilog"
364window_base_path = "//foundation/window/window_manager"
365safwk_base = "//foundation/systemabilitymgr/safwk"
366if (graphic_2d_feature_upgrade_skia) {
367  if (!defined(skia_root_new)) {
368    skia_root_new = "//third_party/skia/m133"
369  }
370} else {
371    if (!defined(skia_root_new)) {
372    skia_root_new = "//third_party/skia"
373  }
374}
375graphic_surface_root = "//foundation/graphic/graphic_surface"
376fuzz_test_output_path = "graphic_2d/graphic_2d"
377video_processing_engine_root = "//foundation/multimedia/video_processing_engine"
378arkui_root = "//foundation/arkui"
379ace_root = "//foundation/arkui/ace_engine"
380bundlefwk_path = "//foundation/bundlemanager/bundle_framework"
381bundlefwk_inner_api_path = "${bundlefwk_path}/interfaces/inner_api"
382mindspore_root = "//third_party/mindspore"
383rosen_root = "//foundation/graphic/graphic_2d/rosen"
384drivers_display_interface = "//drivers/peripheral/display/interfaces"
385
386accessibility_enable = false
387if (defined(global_parts_info) &&
388    defined(global_parts_info.barrierfree_accessibility)) {
389  accessibility_enable = true
390  accessibility_defines = [ "ACCESSIBILITY_ENABLE" ]
391}
392
393if (defined(global_parts_info) &&
394    !defined(global_parts_info.multimedia_player_framework)) {
395  player_framework_enable = false
396}
397
398if (defined(global_parts_info) &&
399    defined(global_parts_info.multimedia_video_processing_engine)) {
400  use_video_processing_engine = true
401}
402
403if (defined(global_parts_info) &&
404    !defined(global_parts_info.hdf_drivers_interface_display)) {
405  graphic_2d_feature_drivers_interface_display_enable = false
406}
407
408use_memmgr_plugin = false
409if (defined(global_parts_info.resourceschedule_memmgr_override)) {
410  use_memmgr_plugin = true
411}
412use_memmgr = false
413if (defined(global_parts_info.resourceschedule_memmgr)) {
414  use_memmgr = true
415}
416
417_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir)
418_graphic_2d_adapter_dir =
419    rebase_path("$graphic_2d_root/adapter", root_build_dir)
420
421if (!ohos_indep_compiler_enable) {
422  if (defined(is_arkui_x) && is_arkui_x) {
423    # In case of arkui-x compilation, copy android and ios adapters from ace_engine
424    exec_script("$graphic_2d_root/utils/build/copy_arkui_adapters.py",
425                [
426                  _ace_adapter_dir,
427                  _graphic_2d_adapter_dir,
428                ])
429  }
430  adapters = exec_script("$ace_root/build/search.py",
431                        [ _graphic_2d_adapter_dir ],
432                        "list lines")
433} else {
434  adapters = ["preview", "ohos"]
435}
436
437if (defined(use_clang_coverage) && use_clang_coverage) {
438  graphic_2d_feature_rs_enable_profiler = false
439}
440
441if (defined(input_ext_feature_magiccursor) && input_ext_feature_magiccursor) {
442  gpu_defines += [ "OHOS_BUILD_ENABLE_MAGICCURSOR" ]
443}
444
445if (defined(graphic_2d_feature_enable_prefetch)) {
446  gpu_defines += [ "RS_ENABLE_PREFETCH" ]
447}
448
449if (defined(global_parts_info) &&
450    !defined(global_parts_info.security_access_token)) {
451  graphic_2d_support_access_token = false
452}
453