• 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_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_ddgr = 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_enable_recording_dcl = true
47  graphic_2d_feature_use_igraphics_extend_hooks = false
48  graphic_2d_feature_use_aps_igameservice_func = false
49  graphic_2d_feature_enable_chipset_vsync = false
50  graphic_2d_feature_enable_rspipeline = true
51
52  if (defined(is_arkui_x) && is_arkui_x) {
53    use_new_render_context = false
54    is_cross_platform = true
55  } else {
56    is_cross_platform = false
57    use_new_render_context = false
58  }
59}
60
61declare_args() {
62  graphic_2d_feature_enable_stack_culling = false
63}
64
65if (graphic_2d_feature_product == "phone" ||
66    graphic_2d_feature_product == "pc" ||
67    graphic_2d_feature_product == "tablet" ||
68    graphic_2d_feature_product == "wearable") {
69  graphic_2d_feature_enable_vulkan = true
70  graphic_2d_feature_enable_ddgr = false
71  graphic_2d_feature_enable_stack_culling = true
72}
73
74if (graphic_2d_feature_product == "phone" ||
75    graphic_2d_feature_product == "tablet") {
76  graphic_2d_feature_enable_opinc = true
77}
78
79gpu_defines = []
80accessibility_defines = []
81if (enable_text_gine) {
82  gpu_defines += [ "USE_GRAPHIC_TEXT_GINE" ]
83}
84if (graphic_2d_feature_ace_enable_gpu) {
85  if (graphic_2d_feature_enable_flutter_vulkan) {
86    gpu_defines += [ "RS_ENABLE_OLD_VK" ]
87  }
88  if (graphic_2d_feature_enable_vulkan) {
89    gpu_defines += [
90      "ACE_ENABLE_VK",
91      "RS_ENABLE_VK",
92    ]
93    if (graphic_2d_feature_enable_ddgr) {
94      gpu_defines += [ "ENABLE_DDGR_OPTIMIZE" ]
95      import("//foundation/graphic/graphic_2d_ext/ddgr/config.gni")
96    }
97  }
98  if (graphic_2d_feature_enable_opengl) {
99    gpu_defines += [
100      "ACE_ENABLE_GL",
101      "RS_ENABLE_GL",
102    ]
103  }
104  if (graphic_2d_feature_enable_stack_culling) {
105    gpu_defines += [ "RS_ENABLE_STACK_CULLING" ]
106  }
107
108  if (graphic_2d_feature_enable_opinc) {
109    gpu_defines += [ "DDGR_ENABLE_FEATURE_OPINC" ]
110  }
111
112  if (graphic_2d_feature_enable_recording_dcl) {
113    rs_enable_recording_dcl = true
114    gpu_defines += [ "ENABLE_RECORDING_DCL" ]
115  } else {
116    rs_enable_recording_dcl = false
117  }
118  ace_enable_gpu = true
119  rs_enable_gpu = true
120  surface_enable_gpu = true
121
122  libvulkan = []
123  if (graphic_2d_feature_enable_vulkan) {
124    libvulkan += [ "//third_party/vulkan-loader:vulkan_loader" ]
125  }
126} else {
127  gpu_defines = [ "ACE_DISABLE_GL" ]
128  ace_enable_gpu = false
129  rs_enable_gpu = false
130  surface_enable_gpu = false
131  libvulkan = []
132}
133
134if (graphic_2d_feature_parallel_upload_enable &&
135    graphic_2d_feature_rs_enable_uni_render &&
136    graphic_2d_feature_product == "phone") {
137  rs_enable_parallel_upload = true
138  gpu_defines += [ "RS_ENABLE_PARALLEL_UPLOAD" ]
139} else {
140  rs_enable_parallel_upload = false
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
154# use_texgine = graphic_2d_feature_use_texgine
155
156if (graphic_2d_feature_rs_enable_uni_render) {
157  graphic_2d_feature_enable_dvsync = true
158  if (graphic_2d_feature_product == "phone") {
159    graphic_2d_feature_enable_chipset_vsync = true
160  }
161  gpu_defines += [ "RS_ENABLE_UNI_RENDER" ]
162} else {
163  graphic_2d_feature_enable_dvsync = 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}
175if (defined(use_new_render_context) && use_new_render_context) {
176  rs_enable_parallel_render = false
177  gpu_defines -= [ "RS_ENABLE_PARALLEL_RENDER" ]
178}
179
180if (graphic_2d_feature_enable_dvsync) {
181  gpu_defines += [ "RS_ENABLE_DVSYNC" ]
182}
183if (graphic_2d_feature_enable_chipset_vsync) {
184  gpu_defines += [ "RS_ENABLE_CHIPSET_VSYNC" ]
185}
186
187tp_defines = []
188tp_feature_enable = false
189if (graphic_2d_feature_tp_switch_enbale) {
190  tp_feature_enable = true
191  tp_defines = [ "TP_FEATURE_ENABLE" ]
192}
193
194graphic_2d_ext_configs = {
195}
196check_graphic_ext_file_script = "//build/ohos/file_exists.py"
197check_graphic_ext_file_args = [
198  "--filename",
199  rebase_path("//foundation/graphic/graphic_2d_ext/ohcore/build/config.gni"),
200]
201
202check_ddgr_ext_file_args = [
203  "--filename",
204  rebase_path("//foundation/graphic/graphic_2d_ext/ddgr/ddgr_config.gni"),
205]
206check_igraphics_core_file_args = [
207  "--filename",
208  rebase_path(
209      "//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni"),
210]
211check_igameservice_core_file_args = [
212  "--filename",
213  rebase_path(
214      "//vendor/huawei/domains/game/gameservice_server/performance/graphics/report/config.gni"),
215]
216check_aps_core_file_args = [
217  "--filename",
218  rebase_path("//foundation/graphic/graphic_2d_ext/aps_manager/config.gni"),
219]
220check_delegator_ext_file_args = [
221  "--filename",
222  rebase_path("//foundation/graphic/graphic_2d_ext/delegator/config.gni"),
223]
224check_broker_ext_file_args = [
225  "--filename",
226  rebase_path(
227      "//foundation/graphic/graphic_2d_ext/ohcore/build/broker_config.gni"),
228]
229check_hgm_ext_file_args = [
230  "--filename",
231  rebase_path(
232      "//foundation/graphic/graphic_2d_ext/hgm_manager/build/hgm_config.gni"),
233]
234
235if (exec_script(check_graphic_ext_file_script,
236                check_graphic_ext_file_args,
237                "string") == "True" && "${product_name}" == "ohcore") {
238  graphic_2d_ext_configs = {
239    import("//foundation/graphic/graphic_2d_ext/ohcore/build/config.gni")
240  }
241}
242
243if (exec_script(check_graphic_ext_file_script,
244                check_ddgr_ext_file_args,
245                "string") == "True") {
246  ddgr_ext_configs = {
247    import("//foundation/graphic/graphic_2d_ext/ddgr/ddgr_config.gni")
248  }
249}
250if (exec_script(check_graphic_ext_file_script,
251                check_igraphics_core_file_args,
252                "string") == "True") {
253  graphic_2d_feature_use_igraphics_extend_hooks = true
254  import("//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni")
255}
256if (exec_script(check_graphic_ext_file_script,
257                check_aps_core_file_args,
258                "string") == "True" &&
259    exec_script(check_graphic_ext_file_script,
260                check_igameservice_core_file_args,
261                "string") == "True") {
262  graphic_2d_feature_use_aps_igameservice_func = true
263  import("//foundation/graphic/graphic_2d_ext/aps_manager/config.gni")
264  import(
265      "//vendor/huawei/domains/game/gameservice_server/performance/graphics/report/config.gni")
266}
267
268graphic_2d_delegator_configs = {
269}
270if (exec_script(check_graphic_ext_file_script,
271                check_delegator_ext_file_args,
272                "string") == "True") {
273  graphic_2d_delegator_configs = {
274    import("//foundation/graphic/graphic_2d_ext/delegator/config.gni")
275  }
276}
277
278graphic_2d_broker_configs = {
279}
280if (exec_script(check_graphic_ext_file_script,
281                check_broker_ext_file_args,
282                "string") == "True") {
283  graphic_2d_broker_configs = {
284    import("//foundation/graphic/graphic_2d_ext/ohcore/build/broker_config.gni")
285  }
286}
287
288graphic_2d_hgm_configs = {
289}
290if (exec_script(check_graphic_ext_file_script,
291                check_hgm_ext_file_args,
292                "string") == "True") {
293  graphic_2d_hgm_configs = {
294    import(
295        "//foundation/graphic/graphic_2d_ext/hgm_manager/build/hgm_config.gni")
296  }
297}
298
299check_platform_ext_file_args = [
300  "--filename",
301  rebase_path("//foundation/graphic/graphic_2d_ext/platform/config.gni"),
302]
303graphic_2d_platform_configs = {
304}
305if (exec_script(check_graphic_ext_file_script,
306                check_platform_ext_file_args,
307                "string") == "True") {
308  graphic_2d_platform_configs = {
309    import("//foundation/graphic/graphic_2d_ext/platform/config.gni")
310  }
311}
312
313flutter_root = "//third_party/flutter"
314ace_flutter_engine_root = "$flutter_root/build"
315graphic_2d_root = "//foundation/graphic/graphic_2d"
316graphic_2d_ext_root = "//foundation/graphic/graphic_2d_ext"
317hilog_root = "//base/hiviewdfx/hilog"
318window_base_path = "//foundation/window/window_manager"
319safwk_base = "//foundation/systemabilitymgr/safwk"
320skia_root_new = "//third_party/skia"
321graphic_surface_root = "//foundation/graphic/graphic_surface"
322memmgr_root = "//foundation/resourceschedule/memmgr"
323memmgr_plugin_root = "//foundation/resourceschedule/memmgr_override"
324fuzz_test_output_path = "graphic_2d/graphic_2d"
325video_processing_engine_root = "//foundation/multimedia/video_processing_engine"
326arkui_root = "//foundation/arkui"
327ace_root = "//foundation/arkui/ace_engine"
328bundlefwk_path = "//foundation/bundlemanager/bundle_framework"
329bundlefwk_inner_api_path = "${bundlefwk_path}/interfaces/inner_api"
330mindspore_root = "//third_party/mindspore"
331
332accessibility_enable = false
333if (defined(global_parts_info) &&
334    defined(global_parts_info.barrierfree_accessibility)) {
335  accessibility_enable = true
336  accessibility_defines = [ "ACCESSIBILITY_ENABLE" ]
337}
338
339if (defined(global_parts_info) &&
340    !defined(global_parts_info.multimedia_player_framework)) {
341  player_framework_enable = false
342}
343
344if (defined(global_parts_info) &&
345    defined(global_parts_info.multimedia_video_processing_engine)) {
346  use_video_processing_engine = true
347}
348
349if (defined(global_parts_info) &&
350    !defined(global_parts_info.hdf_drivers_interface_display)) {
351  graphic_2d_feature_drivers_interface_display_enable = false
352}
353
354use_memmgr_plugin = false
355if (defined(global_parts_info.resourceschedule_memmgr_override)) {
356  use_memmgr_plugin = true
357}
358use_memmgr = false
359if (defined(global_parts_info.resourceschedule_memmgr)) {
360  use_memmgr = true
361}
362
363_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir)
364_graphic_2d_adapter_dir =
365    rebase_path("$graphic_2d_root/adapter", root_build_dir)
366
367if (defined(is_arkui_x) && is_arkui_x) {
368  # In case of arkui-x compilation, copy android and ios adapters from ace_engine
369  exec_script("$graphic_2d_root/utils/build/copy_arkui_adapters.py",
370              [
371                _ace_adapter_dir,
372                _graphic_2d_adapter_dir,
373              ])
374}
375adapters = exec_script("$ace_root/build/search.py",
376                       [ _graphic_2d_adapter_dir ],
377                       "list lines")
378if (defined(use_clang_coverage) && use_clang_coverage) {
379  graphic_2d_feature_rs_enable_profiler = false
380  graphic_2d_feature_enable_recording_dcl = false
381}
382
383if (defined(input_ext_feature_magiccursor) && input_ext_feature_magiccursor) {
384  gpu_defines += [ "OHOS_BUILD_ENABLE_MAGICCURSOR" ]
385}
386