1/*
2 * Copyright (C) 2020 Arm Limited.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package {
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22soong_config_module_type_import {
23    from: "hardware/google/gchips/gralloc4/Android.bp",
24    module_types: ["gralloc_defaults"],
25}
26
27// Only to be used in pixel_gralloc_mapper because of 'stem'
28gralloc_defaults {
29    name: "gralloc_mapper_defaults",
30    soong_config_variables: {
31        mapper_version: {
32            mapper4: {
33                stem: "android.hardware.graphics.mapper@4.0-impl",
34                defaults: ["gralloc_mapper4_defaults"],
35            },
36            mapper5: {
37                stem: "mapper.pixel",
38                defaults: ["gralloc_mapper5_defaults"],
39            },
40        },
41    },
42}
43
44cc_library_shared {
45    name: "pixel_gralloc_mapper",
46    defaults: ["gralloc_mapper_defaults"],
47}
48
49gralloc_defaults {
50    name: "arm_gralloc_version_defaults",
51    soong_config_variables: {
52        mapper_version: {
53            mapper4: {
54                cflags: [
55                    "-DLOG_TAG=\"gralloc4\"",
56                    "-DGRALLOC_VERSION_MAJOR=4",
57                    "-DHIDL_ALLOCATOR_VERSION_SCALED=400",
58                    "-DHIDL_MAPPER_VERSION_SCALED=400",
59                    "-DHIDL_COMMON_VERSION_SCALED=120",
60                    "-DGRALLOC_MAPPER_4",
61                ],
62            },
63            mapper5: {
64                cflags: [
65                    "-DGRALLOC_VERSION_MAJOR=5",
66                    "-DHIDL_MAPPER_VERSION_SCALED=500",
67                    "-DLOG_TAG=\"gralloc5\"",
68                    "-DGRALLOC_MAPPER_5",
69                ],
70            },
71        },
72    },
73}
74
75gralloc_defaults {
76    name: "arm_gralloc_api_defaults",
77    shared_libs: [
78        "liblog",
79        "libcutils",
80        "libdmabufheap",
81        "libsync",
82        "libutils",
83        "libnativewindow",
84        "libgralloctypes",
85        "libhardware",
86        "android.hardware.graphics.common@1.2",
87    ],
88    static_libs: [
89        "libarect",
90        "libgralloc_core",
91        "libgralloc_allocator",
92        "libgralloc_capabilities",
93        "libdrm",
94    ],
95    header_libs: [
96        "libnativebase_headers",
97    ],
98    soong_config_variables: {
99        mapper_version: {
100            mapper4: {
101                shared_libs: [
102                    "libhidlbase",
103                ],
104            },
105            mapper5: {
106                header_libs: [
107                    "libbase_headers",
108                    "libimapper_stablec",
109                    "libimapper_providerutils",
110                    "pixel-gralloc-headers",
111                ],
112            },
113        },
114    },
115}
116
117cc_library_headers {
118    name: "libgralloc_headers",
119    vendor: true,
120    export_include_dirs: [
121        ".",
122    ],
123    header_libs: [
124        "libsystem_headers",
125        "//hardware/google/graphics/common:pixel-gralloc-headers",
126    ],
127    export_header_lib_headers: [
128        "libsystem_headers",
129    ],
130}
131