• 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/ohos.gni")
15import("//foundation/graphic/graphic_2d/graphic_config.gni")
16
17## Build surface.so {{{
18config("surface_config") {
19  visibility = [ ":*" ]
20
21  include_dirs = [ "include" ]
22
23  cflags = [
24    "-Wall",
25    "-Werror",
26    "-g3",
27  ]
28}
29
30config("surface_public_config") {
31  include_dirs = [
32    "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
33    "$graphic_2d_root/interfaces/inner_api/surface",
34    "$graphic_2d_root/interfaces/inner_api/common",
35    "$graphic_2d_root/utils/frame_report",
36    "$graphic_2d_root/utils/sandbox",
37  ]
38
39  if (defined(graphic_2d_ext_configs.vendor_root)) {
40    include_dirs += graphic_2d_ext_configs.libsurface_ext_include_dirs
41  }
42
43  if (defined(graphic_2d_delegator_configs.vendor_root)) {
44    include_dirs +=
45        graphic_2d_delegator_configs.libsurface_ext_delegator_include_dirs
46  }
47
48  defines = []
49  if (ace_enable_gpu) {
50    defines = [ "ACE_ENABLE_GPU" ]
51  }
52  if (graphic_2d_feature_freemem_enable) {
53    defines += [ "SURFACE_ENABLE_FREEMEM" ]
54  }
55  if (graphic_2d_feature_drivers_interface_display_enable) {
56    defines += [ "DRIVERS_INTERFACE_DISPLAY_ENABLE" ]
57  }
58  defines += gpu_defines
59
60  cflags = [ "-Wno-error=deprecated-declarations" ]
61}
62
63ohos_shared_library("surface") {
64  sources = [
65    "src/buffer_client_producer.cpp",
66    "src/buffer_extra_data_impl.cpp",
67    "src/buffer_queue.cpp",
68    "src/buffer_queue_consumer.cpp",
69    "src/buffer_queue_producer.cpp",
70    "src/buffer_utils.cpp",
71    "src/consumer_surface.cpp",
72    "src/consumer_surface_delegator.cpp",
73    "src/metadata_helper.cpp",
74    "src/native_buffer.cpp",
75    "src/native_window.cpp",
76    "src/producer_surface.cpp",
77    "src/producer_surface_delegator.cpp",
78    "src/surface_buffer_impl.cpp",
79    "src/surface_delegate.cpp",
80    "src/surface_tunnel_handle.cpp",
81    "src/surface_utils.cpp",
82    "src/transact_surface_delegator_proxy.cpp",
83    "src/transact_surface_delegator_stub.cpp",
84  ]
85
86  configs = [ ":surface_config" ]
87
88  public_configs = [
89    ":surface_public_config",
90    "//commonlibrary/c_utils/base:utils_config",
91  ]
92
93  deps = [ "$graphic_2d_root/utils/sync_fence:sync_fence" ]
94
95  public_deps = [
96    "$graphic_2d_root/utils/buffer_handle:buffer_handle",
97    "$graphic_2d_root/utils/frame_report:frame_report",
98    "$graphic_2d_root/utils/sandbox:sandbox_utils",
99    "$graphic_2d_root/utils/scoped_bytrace:scoped_bytrace",
100  ]
101
102  external_deps = [
103    "c_utils:utils",
104    "drivers_interface_display:display_buffer_idl_headers",
105    "hilog:libhilog",
106    "hitrace:hitrace_meter",
107    "init:libbegetutil",
108    "ipc:ipc_single",
109  ]
110
111  if (graphic_2d_feature_drivers_interface_display_enable) {
112    external_deps += [
113      "drivers_interface_display:display_buffer_idl_headers",
114      "drivers_interface_display:display_commontype_idl_headers",
115      "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_1",
116    ]
117  }
118
119  symlink_target_name = [
120    "libnative_buffer.so",
121    "libnative_window.so",
122  ]
123
124  if (defined(graphic_2d_ext_configs.vendor_root)) {
125    sources += graphic_2d_ext_configs.libsurface_ext_sources
126    sources -= graphic_2d_ext_configs.libsurface_ext_sources_del
127
128    public_deps += [ "//foundation/graphic/graphic_2d_ext/ohcore/graphic_compat_layer:libgraphic_compat_layer" ]
129
130    public_deps -= [ "//drivers/peripheral/display/hdi_service/gralloc/client:hdi_gralloc_client" ]
131  }
132
133  if (defined(graphic_2d_delegator_configs.vendor_root)) {
134    sources += graphic_2d_delegator_configs.libsurface_ext_delegator_sources
135    sources -= graphic_2d_delegator_configs.libsurface_ext_delegator_sources_del
136  }
137
138  innerapi_tags = [
139    "chipsetsdk",
140    "platformsdk",
141  ]
142  part_name = "graphic_2d"
143  subsystem_name = "graphic"
144}
145
146## Build surface.so }}}
147
148