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 145cc_library { 146 name: "libgbm", 147 defaults: ["minigbm_defaults"], 148 host_supported: true, 149 150 srcs: [ 151 ":minigbm_core_files", 152 "gbm.c", 153 "gbm_helpers.c", 154 ], 155 156 target: { 157 host: { 158 // Avoid linking to another host copy of libdrm; this library will cause 159 // binary GPU drivers to be loaded from the host, which might be linked 160 // to a system copy of libdrm, which conflicts with the AOSP one 161 allow_undefined_symbols: true, 162 header_libs: ["libdrm_headers"], 163 }, 164 android: { 165 shared_libs: [ 166 "libcutils", 167 "liblog", 168 ], 169 static_libs: [ 170 "libdrm", 171 ], 172 }, 173 }, 174 apex_available: [ 175 "//apex_available:platform", 176 "//apex_available:anyapex", 177 ], 178 vendor_available: true, 179 product_available: true, 180 181 export_include_dirs: ["."], 182} 183 184// Rust bindings to minigbm, generated in a way compatible with gbm crate. 185rust_bindgen { 186 name: "libgbm_sys", 187 crate_name: "gbm_sys", 188 wrapper_src: "rust/gbm_wrapper.h", 189 source_stem: "bindings", 190 bindgen_flags: [ 191 "--blocklist-type=__BINDGEN_TMP_.*", 192 "--allowlist-type=^gbm_.*$", 193 "--allowlist-function=^gbm_.*$", 194 "--allowlist-var=GBM_.*|gbm_.*$", 195 "--constified-enum-module=^gbm_.*$", 196 ], 197 shared_libs: ["libgbm"], 198 host_supported: true, 199 vendor_available: true, 200 product_available: true, 201 apex_available: [ 202 "//apex_available:anyapex", 203 "//apex_available:platform", 204 ], 205 visibility: [ 206 "//external/rust/crates/gbm", 207 ], 208} 209 210// Generic 211cc_library_shared { 212 name: "libminigbm_gralloc", 213 defaults: ["minigbm_cros_gralloc_library_defaults"], 214 cflags: ["-DHAS_DMABUF_SYSTEM_HEAP"], 215} 216 217cc_library_shared { 218 name: "gralloc.minigbm", 219 defaults: ["minigbm_cros_gralloc0_defaults"], 220 shared_libs: ["libminigbm_gralloc"], 221} 222 223cc_library_headers { 224 name: "libminigbm_gralloc_headers", 225 host_supported: true, 226 vendor_available: true, 227 export_include_dirs: ["cros_gralloc"], 228 visibility: [ 229 "//device/generic/goldfish-opengl/system/hwc3:__subpackages__", 230 ], 231} 232 233// Intel 234cc_library_shared { 235 name: "libminigbm_gralloc_intel", 236 defaults: ["minigbm_cros_gralloc_library_defaults"], 237 cflags: ["-DDRV_I915"], 238 enabled: false, 239 arch: { 240 x86: { 241 enabled: true, 242 }, 243 x86_64: { 244 enabled: true, 245 }, 246 }, 247} 248 249cc_library_shared { 250 name: "gralloc.minigbm_intel", 251 defaults: ["minigbm_cros_gralloc0_defaults"], 252 shared_libs: ["libminigbm_gralloc_intel"], 253 enabled: false, 254 arch: { 255 x86: { 256 enabled: true, 257 }, 258 x86_64: { 259 enabled: true, 260 }, 261 }, 262} 263 264// Meson 265cc_library_shared { 266 name: "libminigbm_gralloc_meson", 267 defaults: ["minigbm_cros_gralloc_library_defaults"], 268 cflags: ["-DDRV_MESON"], 269} 270 271cc_library_shared { 272 name: "gralloc.minigbm_meson", 273 defaults: ["minigbm_cros_gralloc0_defaults"], 274 shared_libs: ["libminigbm_gralloc_meson"], 275} 276 277// MSM 278cc_library_shared { 279 name: "libminigbm_gralloc_msm", 280 defaults: ["minigbm_cros_gralloc_library_defaults"], 281 cflags: [ 282 "-DDRV_MSM", 283 "-DQCOM_DISABLE_COMPRESSED_NV12", 284 "-DHAS_DMABUF_SYSTEM_HEAP", 285 ], 286} 287 288cc_library_shared { 289 name: "gralloc.minigbm_msm", 290 defaults: ["minigbm_cros_gralloc0_defaults"], 291 shared_libs: ["libminigbm_gralloc_msm"], 292} 293 294// ARCVM 295cc_library_shared { 296 name: "libminigbm_gralloc_arcvm", 297 defaults: ["minigbm_cros_gralloc_library_defaults"], 298 cflags: ["-DVIRTIO_GPU_NEXT"], 299} 300 301cc_library_shared { 302 name: "gralloc.minigbm_arcvm", 303 defaults: ["minigbm_cros_gralloc0_defaults"], 304 shared_libs: ["libminigbm_gralloc_arcvm"], 305} 306