1#
2# Copyright (C) 2016-2018 ARM Limited. All rights reserved.
3#
4# Copyright (C) 2008 The Android Open Source Project
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#      http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18TOP_LOCAL_PATH := $(call my-dir)
19MALI_GRALLOC_API_TESTS?=0
20
21ifdef GRALLOC_USE_GRALLOC1_API
22    ifdef GRALLOC_API_VERSION
23        $(warning GRALLOC_API_VERSION flag is not compatible with GRALLOC_USE_GRALLOC1_API)
24    endif
25endif
26
27include $(TOP_LOCAL_PATH)/gralloc.version.mk
28
29# Place and access VPU library from /vendor directory in unit testing as default
30# /system is not in the linker permitted paths
31ifeq ($(MALI_GRALLOC_API_TESTS), 1)
32MALI_GRALLOC_VPU_LIBRARY_PATH := \"/vendor/lib/\"
33endif
34
35#Build allocator for 2.x and gralloc libhardware HAL for all previous versions
36GRALLOC_MAPPER := 0
37ifeq ($(shell expr $(GRALLOC_VERSION_MAJOR) \>= 2), 1)
38    $(info Build Gralloc allocator for 2.x)
39else ifeq ($(shell expr $(GRALLOC_VERSION_MAJOR) \>= 1), 1)
40    $(info Build Gralloc 1.x libhardware HAL)
41else
42    $(info Build Gralloc 0.x libhardware HAL)
43endif
44include $(TOP_LOCAL_PATH)/src/Android.mk
45
46# Build gralloc mapper for 2.x
47ifeq ($(shell expr $(GRALLOC_VERSION_MAJOR) \>= 2), 1)
48   GRALLOC_MAPPER := 1
49   $(info Build Gralloc mapper for 2.x)
50   include $(TOP_LOCAL_PATH)/src/Android.mk
51endif
52
53# Build gralloc api tests.
54ifeq ($(MALI_GRALLOC_API_TESTS), 1)
55$(info Build gralloc API tests.)
56include $(TOP_LOCAL_PATH)/api_tests/Android.mk
57endif
58
59####################################################################################################
60
61include $(CLEAR_VARS)
62include $(TOP_LOCAL_PATH)/gralloc.version.mk
63
64LOCAL_SHARED_LIBRARIES := \
65    liblog \
66    libcutils \
67    libutils \
68    android.hardware.graphics.mapper@2.0 \
69    libsync \
70    libhardware \
71    libhidlbase \
72    libhidltransport \
73    libnativewindow \
74    libion_google \
75    libdmabufheap
76
77LOCAL_STATIC_LIBRARIES := libarect
78LOCAL_HEADER_LIBRARIES := libnativebase_headers
79
80LOCAL_C_INCLUDES := \
81    $(TOP)/hardware/google/gchips/include \
82    $(TOP)/hardware/google/gchips/gralloc3/include \
83    $(TARGET_BOARD_KERNEL_HEADERS)
84
85LOCAL_SRC_FILES := \
86    gralloc_vendor_interface.cpp \
87    mali_gralloc_ion.cpp \
88    gralloc_buffer_priv.cpp \
89    format_info.cpp \
90    mali_gralloc_bufferallocation.cpp \
91    mali_gralloc_formats.cpp \
92    mali_gralloc_debug.cpp
93
94# TODO(find out why setting this to $(HIDL_MAPPER_VERSION_SCALED) doesn't work)
95LOCAL_CFLAGS := -DHIDL_MAPPER_VERSION_SCALED=200
96LOCAL_CFLAGS += -DGRALLOC_VERSION_MAJOR=$(GRALLOC_VERSION_MAJOR)
97LOCAL_CFLAGS += -DGRALLOC_HFR_BATCH_SIZE=8
98
99LOCAL_CFLAGS += -DMALI_GRALLOC_GPU_LIBRARY_PATH1=$(MALI_GRALLOC_GPU_LIBRARY_64_PATH1)
100LOCAL_CFLAGS += -DMALI_GRALLOC_GPU_LIBRARY_PATH2=$(MALI_GRALLOC_GPU_LIBRARY_64_PATH2)
101
102ifeq ($(BOARD_EXYNOS_S10B_FORMAT_ALIGN), 64)
103LOCAL_CFLAGS += -DBOARD_EXYNOS_S10B_FORMAT_ALIGN=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
104else
105LOCAL_CFLAGS += -DBOARD_EXYNOS_S10B_FORMAT_ALIGN=16
106endif
107
108LOCAL_CFLAGS += -DGRALLOC_LIBRARY_BUILD=1
109
110ifeq ($(BOARD_USES_VENDORIMAGE), true)
111LOCAL_PROPRIETARY_MODULE := true
112endif
113LOCAL_MODULE := libGrallocWrapper
114LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
115LOCAL_LICENSE_CONDITIONS := notice
116
117include $(BUILD_SHARED_LIBRARY)
118