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 18# List of all valid Gralloc versions 19GRALLOC_VALID_VERSIONS := 0.x 1.x 2.x 20 21#Set default Gralloc version 22PLATFORM_SDK_GREATER_THAN_24 := $(shell expr $(PLATFORM_SDK_VERSION) \> 24) 23ifeq ($(PLATFORM_SDK_GREATER_THAN_24), 1) 24 GRALLOC_API_VERSION?=1.x 25else 26 GRALLOC_API_VERSION?=0.x 27endif 28 29ifdef GRALLOC_USE_GRALLOC1_API 30 ifeq ($(GRALLOC_USE_GRALLOC1_API), 1) 31 GRALLOC_API_VERSION := 1.x 32 else 33 ifeq ($(GRALLOC_USE_GRALLOC1_API), 0) 34 GRALLOC_API_VERSION := 0.x 35 endif 36 endif 37endif 38 39# Fail build if GRALLOC_API_VERSION isn't one of the following. 40ifeq ($(filter $(GRALLOC_API_VERSION),$(GRALLOC_VALID_VERSIONS)),) 41 $(error Gralloc version $(GRALLOC_API_VERSION) is not valid. Valid versions are $(GRALLOC_VALID_VERSIONS)) 42endif 43 44# Derive namespaces and associated (internal and scaled) versions for Gralloc 2.x 45# Note: On a given SDK platform, versions of Allocator / Mapper / Common can be 46# changed (somewhat) independently of each other. Scaled internal versions, encapsulating 47# their major and minor versions, provide for building specific combinations 48ifeq ($(GRALLOC_API_VERSION), 2.x) 49 50 ifeq ($(shell expr $(PLATFORM_SDK_VERSION) \> 27), 1) 51 HIDL_IMAPPER_NAMESPACE := V2_1 52 HIDL_IALLOCATOR_NAMESPACE := V2_0 53 HIDL_COMMON_NAMESPACE := V1_1 54 55 #Allocator = 2.0, Mapper = 2.1 and Common = 1.1 56 HIDL_ALLOCATOR_VERSION_SCALED := 200 57 HIDL_MAPPER_VERSION_SCALED := 210 58 HIDL_COMMON_VERSION_SCALED := 110 59 60 else ifeq ($(shell expr $(PLATFORM_SDK_VERSION) \> 25), 1) 61 HIDL_IMAPPER_NAMESPACE := V2_0 62 HIDL_IALLOCATOR_NAMESPACE := V2_0 63 HIDL_COMMON_NAMESPACE := V1_0 64 65 #Allocator = 2.0, Mapper = 2.0 and Common = 1.0 66 HIDL_ALLOCATOR_VERSION_SCALED := 200 67 HIDL_MAPPER_VERSION_SCALED := 200 68 HIDL_COMMON_VERSION_SCALED := 100 69 else 70 $(error Gralloc 2.x is not supported on platform SDK version $(PLATFORM_SDK_VERSION)) 71 endif 72endif 73 74GRALLOC_VERSION_MAJOR := $(shell echo $(GRALLOC_API_VERSION) | cut -d. -f1) 75