• 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
14declare_args() {
15  graphic_2d_feature_product = "default"
16  graphic_2d_feature_enable_pgo = false
17  graphic_2d_feature_pgo_path = ""
18  graphic_2d_feature_bootanimation_enable = true
19  graphic_2d_feature_ace_enable_gpu = true
20  graphic_2d_feature_color_gamut_enable = false
21  graphic_2d_feature_rs_enable_eglimage = false
22  graphic_2d_feature_use_texgine = false
23  graphic_2d_feature_rs_enable_uni_render = false
24  graphic_2d_feature_wuji_enable = false
25  graphic_2d_feature_enable_afbc = false
26  graphic_2d_feature_freemem_enable = false
27  graphic_2d_feature_parallel_render_enable = true
28  graphic_2d_feature_enable_vulkan = false
29  graphic_2d_feature_enable_flutter_vulkan = false
30  graphic_2d_feature_enable_opengl = true
31  graphic_2d_feature_enable_filter_cache = true
32  graphic_2d_feature_parallel_upload_enable = true
33  enable_text_gine = true
34  use_texgine = false
35  use_skia_txt = true
36  use_video_processing_engine = false
37  logger_enable_scope = false
38  texgine_enable_debug_log = false
39  player_framework_enable = true
40  graphic_2d_feature_drivers_interface_display_enable = true
41  graphic_2d_feature_tp_switch_enbale = false
42  graphic_2d_feature_enable_recording_dcl = true
43  graphic_2d_feature_use_igraphics_extend_hooks = false
44
45  if (defined(is_arkui_x) && is_arkui_x) {
46    use_new_render_context = false
47    is_cross_platform = true
48  } else {
49    is_cross_platform = false
50    use_new_render_context = false
51  }
52}
53
54if (graphic_2d_feature_product == "phone") {
55  graphic_2d_feature_enable_vulkan = true
56}
57
58gpu_defines = []
59accessibility_defines = []
60if (enable_text_gine) {
61  gpu_defines += [ "USE_GRAPHIC_TEXT_GINE" ]
62}
63if (graphic_2d_feature_ace_enable_gpu) {
64  if (graphic_2d_feature_enable_flutter_vulkan) {
65    gpu_defines += [ "RS_ENABLE_OLD_VK" ]
66  }
67  if (graphic_2d_feature_enable_vulkan) {
68    gpu_defines += [
69      "ACE_ENABLE_VK",
70      "RS_ENABLE_VK",
71    ]
72  }
73  if (graphic_2d_feature_enable_opengl) {
74    gpu_defines += [
75      "ACE_ENABLE_GL",
76      "RS_ENABLE_GL",
77    ]
78  }
79  if (graphic_2d_feature_enable_recording_dcl) {
80    rs_enable_recording_dcl = true
81    gpu_defines += [ "ENABLE_RECORDING_DCL" ]
82  } else {
83    rs_enable_recording_dcl = false
84  }
85  ace_enable_gpu = true
86  rs_enable_gpu = true
87  surface_enable_gpu = true
88
89  # libgl is a native stub for decoupling system.img and vendor.img
90  # real libgl installed in /vendor/lib/chipsetsdk
91  libgl = [
92    "//foundation/graphic/graphic_2d/frameworks/opengl_wrapper:EGL",
93    "//foundation/graphic/graphic_2d/frameworks/opengl_wrapper:GLESv3",
94  ]
95
96  libvulkan = []
97  if (graphic_2d_feature_enable_vulkan) {
98    libvulkan += [ "//third_party/vulkan-loader:vulkan_loader" ]
99  }
100} else {
101  gpu_defines = [ "ACE_DISABLE_GL" ]
102  ace_enable_gpu = false
103  rs_enable_gpu = false
104  surface_enable_gpu = false
105  libgl = []
106  libvulkan = []
107}
108
109if (graphic_2d_feature_parallel_upload_enable &&
110    graphic_2d_feature_rs_enable_uni_render) {
111  rs_enable_parallel_upload = true
112  gpu_defines += [ "RS_ENABLE_PARALLEL_UPLOAD" ]
113} else {
114  rs_enable_parallel_upload = false
115}
116
117if (graphic_2d_feature_rs_enable_eglimage || current_os == "android") {
118  gpu_defines += [
119    "RS_ENABLE_EGLIMAGE",
120    "RS_ENABLE_EGLQUERYSURFACE",
121  ]
122  rs_enable_eglimage = true
123} else {
124  gpu_defines += [ "RS_DISABLE_EGLIMAGE" ]
125  rs_enable_eglimage = false
126}
127
128# use_texgine = graphic_2d_feature_use_texgine
129
130if (graphic_2d_feature_rs_enable_uni_render) {
131  rs_enable_driven_render = true
132  gpu_defines += [
133    "RS_ENABLE_DRIVEN_RENDER",
134    "RS_ENABLE_UNI_RENDER",
135  ]
136} else {
137  rs_enable_driven_render = false
138}
139
140if (graphic_2d_feature_enable_afbc) {
141  gpu_defines += [ "RS_ENABLE_AFBC" ]
142}
143
144if (graphic_2d_feature_parallel_render_enable) {
145  rs_enable_parallel_render = true
146  gpu_defines += [ "RS_ENABLE_PARALLEL_RENDER" ]
147}
148if (defined(use_new_render_context) && use_new_render_context) {
149  rs_enable_parallel_render = false
150  gpu_defines -= [ "RS_ENABLE_PARALLEL_RENDER" ]
151}
152
153tp_defines = []
154tp_feature_enable = false
155if (graphic_2d_feature_tp_switch_enbale) {
156  tp_feature_enable = true
157  tp_defines = [ "TP_FEATURE_ENABLE" ]
158}
159
160graphic_2d_ext_configs = {
161}
162check_graphic_ext_file_script = "//build/ohos/file_exists.py"
163check_graphic_ext_file_args = [
164  "--filename",
165  rebase_path("//foundation/graphic/graphic_2d_ext/ohcore/build/config.gni"),
166]
167
168check_ddgr_ext_file_args = [
169  "--filename",
170  rebase_path("//foundation/graphic/graphic_2d_ext/ddgr/ddgr_config.gni"),
171]
172check_igraphics_core_file_args = [
173  "--filename",
174  rebase_path(
175      "//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni"),
176]
177check_delegator_ext_file_args = [
178  "--filename",
179  rebase_path("//foundation/graphic/graphic_2d_ext/delegator/config.gni"),
180]
181if (exec_script(check_graphic_ext_file_script,
182                check_graphic_ext_file_args,
183                "string") == "True" && "${product_name}" == "ohcore") {
184  graphic_2d_ext_configs = {
185    import("//foundation/graphic/graphic_2d_ext/ohcore/build/config.gni")
186  }
187}
188
189if (exec_script(check_graphic_ext_file_script,
190                check_ddgr_ext_file_args,
191                "string") == "True") {
192  ddgr_ext_configs = {
193    import("//foundation/graphic/graphic_2d_ext/ddgr/ddgr_config.gni")
194  }
195}
196if (exec_script(check_graphic_ext_file_script,
197                check_igraphics_core_file_args,
198                "string") == "True") {
199  graphic_2d_feature_use_igraphics_extend_hooks = true
200  import("//vendor/huawei/foundation/graphics_game/gpu_turbo_x/EGL/config.gni")
201}
202
203graphic_2d_delegator_configs = {
204}
205if (exec_script(check_graphic_ext_file_script,
206                check_delegator_ext_file_args,
207                "string") == "True") {
208  graphic_2d_delegator_configs = {
209    import("//foundation/graphic/graphic_2d_ext/delegator/config.gni")
210  }
211}
212
213check_platform_ext_file_args = [
214  "--filename",
215  rebase_path("//foundation/graphic/graphic_2d_ext/platform/config.gni"),
216]
217graphic_2d_platform_configs = {
218}
219if (exec_script(check_graphic_ext_file_script,
220                check_platform_ext_file_args,
221                "string") == "True") {
222  graphic_2d_platform_configs = {
223    import("//foundation/graphic/graphic_2d_ext/platform/config.gni")
224  }
225}
226
227flutter_root = "//third_party/flutter"
228ace_flutter_engine_root = "$flutter_root/build"
229graphic_2d_root = "//foundation/graphic/graphic_2d"
230hilog_root = "//base/hiviewdfx/hilog"
231window_base_path = "//foundation/window/window_manager"
232safwk_base = "//foundation/systemabilitymgr/safwk"
233skia_root_new = "//third_party/skia"
234memmgr_root = "//foundation/resourceschedule/memmgr"
235memmgr_plugin_root = "//foundation/resourceschedule/memmgr_plugin"
236fuzz_test_output_path = "graphic_2d/graphic_2d"
237video_processing_engine_root = "//foundation/multimedia/video_processing_engine"
238arkui_root = "//foundation/arkui"
239
240accessibility_enable = false
241if (defined(global_parts_info) &&
242    defined(global_parts_info.barrierfree_accessibility)) {
243  accessibility_enable = true
244  accessibility_defines = [ "ACCESSIBILITY_ENABLE" ]
245}
246
247if (defined(global_parts_info) &&
248    !defined(global_parts_info.multimedia_player_framework)) {
249  player_framework_enable = false
250}
251
252if (defined(global_parts_info) &&
253    defined(global_parts_info.multimedia_video_processing_engine)) {
254  use_video_processing_engine = true
255}
256
257if (defined(global_parts_info) &&
258    !defined(global_parts_info.hdf_drivers_interface_display)) {
259  graphic_2d_feature_drivers_interface_display_enable = false
260}
261
262use_memmgr_plugin = false
263if (defined(global_parts_info.resourceschedule_memmgr_plugin)) {
264  use_memmgr_plugin = true
265}
266use_memmgr = false
267if (defined(global_parts_info.resourceschedule_memmgr)) {
268  use_memmgr = true
269}
270