1// Use of this source code is governed by a BSD-style license that can be 2// found in the LICENSE file. 3 4package { 5 default_applicable_licenses: ["external_minigbm_license"], 6} 7 8// Added automatically by a large-scale-change that took the approach of 9// 'apply every license found to every target'. While this makes sure we respect 10// every license restriction, it may not be entirely correct. 11// 12// e.g. GPL in an MIT project might only apply to the contrib/ directory. 13// 14// Please consider splitting the single license below into multiple licenses, 15// taking care not to lose any license_kind information, and overriding the 16// default license using the 'licenses: [...]' property on targets as needed. 17// 18// For unused files, consider creating a 'fileGroup' with "//visibility:private" 19// to attach the license to, and including a comment whether the files may be 20// used in the current project. 21// See: http://go/android-license-faq 22license { 23 name: "external_minigbm_license", 24 visibility: [":__subpackages__"], 25 license_kinds: [ 26 "SPDX-license-identifier-Apache-2.0", 27 "SPDX-license-identifier-BSD", 28 "SPDX-license-identifier-MIT", 29 ], 30 license_text: [ 31 "LICENSE", 32 ], 33} 34 35filegroup { 36 name: "minigbm_core_files", 37 38 srcs: [ 39 "amdgpu.c", 40 "backend_mock.c", 41 "drv.c", 42 "drv_array_helpers.c", 43 "drv_helpers.c", 44 "dumb_driver.c", 45 "i915.c", 46 "mediatek.c", 47 "msm.c", 48 "rockchip.c", 49 "vc4.c", 50 "virtgpu.c", 51 "virtgpu_cross_domain.c", 52 "virtgpu_virgl.c", 53 ], 54} 55 56filegroup { 57 name: "minigbm_gralloc_common_files", 58 59 srcs: [ 60 "cros_gralloc/cros_gralloc_buffer.cc", 61 "cros_gralloc/cros_gralloc_helpers.cc", 62 "cros_gralloc/cros_gralloc_driver.cc", 63 ], 64} 65 66filegroup { 67 name: "minigbm_gralloc0_files", 68 srcs: ["cros_gralloc/gralloc0/gralloc0.cc"], 69} 70 71cc_defaults { 72 name: "minigbm_defaults", 73 74 cflags: [ 75 "-D_GNU_SOURCE=1", 76 "-D_FILE_OFFSET_BITS=64", 77 "-Wall", 78 "-Wsign-compare", 79 "-Wpointer-arith", 80 "-Wcast-qual", 81 "-Wcast-align", 82 "-Wno-unused-parameter", 83 ], 84 85 product_variables: { 86 platform_sdk_version: { 87 cflags: ["-DANDROID_API_LEVEL=%d"], 88 }, 89 }, 90} 91 92cc_library_headers { 93 name: "minigbm_headers", 94 host_supported: true, 95 vendor_available: true, 96 export_include_dirs: ["."], 97} 98 99cc_defaults { 100 name: "minigbm_cros_gralloc_defaults", 101 102 defaults: ["minigbm_defaults"], 103 104 header_libs: [ 105 "libhardware_headers", 106 "libnativebase_headers", 107 "libsystem_headers", 108 "minigbm_headers", 109 ], 110 111 static_libs: ["libarect"], 112 113 vendor: true, 114 115 shared_libs: [ 116 "libcutils", 117 "libdmabufheap", 118 "libdrm", 119 "libgralloctypes", 120 "libnativewindow", 121 "libsync", 122 "liblog", 123 ], 124} 125 126cc_defaults { 127 name: "minigbm_cros_gralloc_library_defaults", 128 129 defaults: ["minigbm_cros_gralloc_defaults"], 130 srcs: [ 131 ":minigbm_core_files", 132 ":minigbm_gralloc_common_files", 133 ], 134} 135 136cc_defaults { 137 name: "minigbm_cros_gralloc0_defaults", 138 139 defaults: ["minigbm_cros_gralloc_defaults"], 140 relative_install_path: "hw", 141 142 srcs: [":minigbm_gralloc0_files"], 143} 144 145generic_cflags = ["-DHAS_DMABUF_SYSTEM_HEAP"] 146intel_cflags = ["-DDRV_I915"] 147meson_cflags = ["-DDRV_MESON"] 148msm_cflags = [ 149 "-DDRV_MSM", 150 "-DQCOM_DISABLE_COMPRESSED_NV12", 151 "-DHAS_DMABUF_SYSTEM_HEAP", 152] 153arcvm_cflags = ["-DVIRTIO_GPU_NEXT"] 154 155cc_library { 156 name: "libgbm", 157 defaults: ["minigbm_defaults"], 158 host_supported: true, 159 160 srcs: [ 161 ":minigbm_core_files", 162 "gbm.c", 163 "gbm_helpers.c", 164 "minigbm_helpers.c", 165 ], 166 167 cflags: select(soong_config_variable("minigbm", "platform"), { 168 "generic": generic_cflags, 169 "intel": intel_cflags, 170 "meson": meson_cflags, 171 "msm": msm_cflags, 172 "arcvm": arcvm_cflags, 173 default: [], 174 }), 175 176 target: { 177 host: { 178 // Avoid linking to another host copy of libdrm; this library will cause 179 // binary GPU drivers to be loaded from the host, which might be linked 180 // to a system copy of libdrm, which conflicts with the AOSP one 181 allow_undefined_symbols: true, 182 header_libs: ["libdrm_headers"], 183 }, 184 android: { 185 shared_libs: [ 186 "libcutils", 187 "liblog", 188 ], 189 static_libs: [ 190 "libdrm", 191 ], 192 }, 193 }, 194 apex_available: [ 195 "//apex_available:platform", 196 "//apex_available:anyapex", 197 ], 198 vendor_available: true, 199 product_available: true, 200 201 export_include_dirs: ["."], 202} 203 204// Rust bindings to minigbm, generated in a way compatible with gbm crate. 205rust_bindgen { 206 name: "libgbm_sys", 207 crate_name: "gbm_sys", 208 wrapper_src: "rust/gbm_wrapper.h", 209 source_stem: "bindings", 210 bindgen_flags: [ 211 "--blocklist-type=__BINDGEN_TMP_.*", 212 "--allowlist-type=^gbm_.*$", 213 "--allowlist-function=^gbm_.*$", 214 "--allowlist-var=GBM_.*|gbm_.*$", 215 "--constified-enum-module=^gbm_.*$", 216 ], 217 shared_libs: ["libgbm"], 218 host_supported: true, 219 vendor_available: true, 220 product_available: true, 221 apex_available: [ 222 "//apex_available:anyapex", 223 "//apex_available:platform", 224 ], 225 visibility: [ 226 "//external/rust/android-crates-io/crates/gbm", 227 ], 228} 229 230// Generic 231cc_library_shared { 232 name: "libminigbm_gralloc", 233 defaults: ["minigbm_cros_gralloc_library_defaults"], 234 cflags: generic_cflags, 235} 236 237cc_library_shared { 238 name: "gralloc.minigbm", 239 defaults: ["minigbm_cros_gralloc0_defaults"], 240 shared_libs: ["libminigbm_gralloc"], 241} 242 243cc_library_headers { 244 name: "libminigbm_gralloc_headers", 245 host_supported: true, 246 vendor_available: true, 247 export_include_dirs: ["cros_gralloc"], 248 visibility: [ 249 "//device/generic/goldfish-opengl/system/hwc3:__subpackages__", 250 ], 251} 252 253// Intel 254cc_library_shared { 255 name: "libminigbm_gralloc_intel", 256 defaults: ["minigbm_cros_gralloc_library_defaults"], 257 cflags: intel_cflags, 258 enabled: false, 259 arch: { 260 x86: { 261 enabled: true, 262 }, 263 x86_64: { 264 enabled: true, 265 }, 266 }, 267} 268 269cc_library_shared { 270 name: "gralloc.minigbm_intel", 271 defaults: ["minigbm_cros_gralloc0_defaults"], 272 shared_libs: ["libminigbm_gralloc_intel"], 273 enabled: false, 274 arch: { 275 x86: { 276 enabled: true, 277 }, 278 x86_64: { 279 enabled: true, 280 }, 281 }, 282} 283 284// Meson 285cc_library_shared { 286 name: "libminigbm_gralloc_meson", 287 defaults: ["minigbm_cros_gralloc_library_defaults"], 288 cflags: meson_cflags, 289} 290 291cc_library_shared { 292 name: "gralloc.minigbm_meson", 293 defaults: ["minigbm_cros_gralloc0_defaults"], 294 shared_libs: ["libminigbm_gralloc_meson"], 295} 296 297// MSM 298cc_library_shared { 299 name: "libminigbm_gralloc_msm", 300 defaults: ["minigbm_cros_gralloc_library_defaults"], 301 cflags: msm_cflags, 302} 303 304cc_library_shared { 305 name: "gralloc.minigbm_msm", 306 defaults: ["minigbm_cros_gralloc0_defaults"], 307 shared_libs: ["libminigbm_gralloc_msm"], 308} 309 310// ARCVM 311cc_library_shared { 312 name: "libminigbm_gralloc_arcvm", 313 defaults: ["minigbm_cros_gralloc_library_defaults"], 314 cflags: arcvm_cflags, 315} 316 317cc_library_shared { 318 name: "gralloc.minigbm_arcvm", 319 defaults: ["minigbm_cros_gralloc0_defaults"], 320 shared_libs: ["libminigbm_gralloc_arcvm"], 321} 322