From: Vitaliy Tomin Date: Fri, 27 May 2022 16:57:40 +0000 (+0800) Subject: Split mali gpu makefiles per GPU arch X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fec49ec23bce53b8e17f4e019d810282faa6743e;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git Split mali gpu makefiles per GPU arch * use TARGET_AMLOGIC_GPU_ARCH flag set to bifrost, midgard or utgard to select proper mali module to build Change-Id: I1b32483fc32e2709688013a2941baa877484dee5 --- diff --git a/Android.mk b/Android.mk index 36c5a13..fd43b36 100644 --- a/Android.mk +++ b/Android.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2021 The LineageOS Project +# Copyright (C) 2021-2022 The LineageOS Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,40 +14,7 @@ # limitations under the License. # -LOCAL_PATH := $(call my-dir) - -ifeq ($(TARGET_PREBUILT_KERNEL),) -MALI_GPU_VARIANT ?= bifrost -MALI_DRV_VERSION ?= r32p1 -MALI_PATH := $(abspath $(call my-dir)) -GPU_PATH := $(MALI_GPU_VARIANT)/$(MALI_DRV_VERSION)/kernel/drivers/gpu/arm/midgard -GPU_CONFIGS := CONFIG_MALI_MIDGARD=m CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y CONFIG_MALI_BACKEND=gpu - -include $(CLEAR_VARS) - -LOCAL_MODULE := mali -LOCAL_MODULE_SUFFIX := .ko -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules -LOCAL_CFLAGS := -Wno-error -Wno-pointer-sign -Wno-error=frame-larger-than= -LOCAL_C_INCLUDES := \ - $(MALI_PATH)/$(GPU_PATH)/backend/gpu \ - $(MALI_PATH)/$(GPU_PATH)/platform/devicetree \ - $(MALI_PATH)/$(GPU_PATH)/ipa \ - $(MALI_PATH)/$(GPU_PATH) \ - $(MALI_PATH)/dvalin/kernel/include - -_mali_intermediates := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE)) -_mali_ko := $(_mali_intermediates)/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX) -KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ -GPU_CFLAGS := $(LOCAL_CFLAGS) $(addprefix -I,$(LOCAL_C_INCLUDES)) -DCONFIG_MALI_PLATFORM_DEVICETREE -DCONFIG_MALI_MIDGARD_DVFS -DCONFIG_MALI_BACKEND=gpu -DCONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=1 -DCONFIG_MALI_DMA_BUF_LEGACY_COMPAT=0 - -$(_mali_ko): $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME) - @mkdir -p $(dir $@) - @cp -R $(MALI_PATH)/* $(dir $@)/ - $(hide) +$(KERNEL_MAKE_CMD) $(PATH_OVERRIDE) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_OUT) M=$(abspath $(_mali_intermediates))/$(GPU_PATH) ARCH=$(TARGET_KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) EXTRA_CFLAGS="$(GPU_CFLAGS)" $(GPU_CONFIGS) modules - $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $(dir $@)/$(GPU_PATH)/mali_kbase.ko; \ - cp $(dir $@)/$(GPU_PATH)/mali_kbase.ko $@; - -include $(BUILD_SYSTEM)/base_rules.mk +ifneq ($(filter bifrost midgard utgard,$(TARGET_AMLOGIC_GPU_ARCH)),) +MALI_PATH := $(abspath $(call my-dir)) +include $(abspath $(call my-dir))/$(TARGET_AMLOGIC_GPU_ARCH)/Android.mk endif diff --git a/bifrost/Android.mk b/bifrost/Android.mk new file mode 100644 index 0000000..321b224 --- /dev/null +++ b/bifrost/Android.mk @@ -0,0 +1,53 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + +ifeq ($(TARGET_PREBUILT_KERNEL),) +MALI_GPU_VARIANT ?= bifrost +MALI_DRV_VERSION ?= r32p1 +#MALI_PATH := $(abspath $(call my-dir)) +GPU_PATH := $(MALI_GPU_VARIANT)/$(MALI_DRV_VERSION)/kernel/drivers/gpu/arm/midgard +GPU_CONFIGS := CONFIG_MALI_MIDGARD=m CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y CONFIG_MALI_BACKEND=gpu + +include $(CLEAR_VARS) + +LOCAL_MODULE := mali +LOCAL_MODULE_SUFFIX := .ko +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules +LOCAL_CFLAGS := -Wno-error -Wno-pointer-sign -Wno-error=frame-larger-than= +LOCAL_C_INCLUDES := \ + $(MALI_PATH)/$(GPU_PATH)/backend/gpu \ + $(MALI_PATH)/$(GPU_PATH)/platform/devicetree \ + $(MALI_PATH)/$(GPU_PATH)/ipa \ + $(MALI_PATH)/$(GPU_PATH) \ + $(MALI_PATH)/dvalin/kernel/include + +_mali_intermediates := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE)) +_mali_ko := $(_mali_intermediates)/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX) +KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ +GPU_CFLAGS := $(LOCAL_CFLAGS) $(addprefix -I,$(LOCAL_C_INCLUDES)) -DCONFIG_MALI_PLATFORM_DEVICETREE -DCONFIG_MALI_MIDGARD_DVFS -DCONFIG_MALI_BACKEND=gpu -DCONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=1 -DCONFIG_MALI_DMA_BUF_LEGACY_COMPAT=0 + +$(_mali_ko): $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME) + @mkdir -p $(dir $@) + @cp -R $(MALI_PATH)/* $(dir $@)/ + $(hide) +$(KERNEL_MAKE_CMD) $(PATH_OVERRIDE) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_OUT) M=$(abspath $(_mali_intermediates))/$(GPU_PATH) ARCH=$(TARGET_KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) EXTRA_CFLAGS="$(GPU_CFLAGS)" $(GPU_CONFIGS) modules + $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $(dir $@)/$(GPU_PATH)/mali_kbase.ko; \ + cp $(dir $@)/$(GPU_PATH)/mali_kbase.ko $@; + +include $(BUILD_SYSTEM)/base_rules.mk +endif diff --git a/midgard/Android.mk b/midgard/Android.mk new file mode 100644 index 0000000..cc78036 --- /dev/null +++ b/midgard/Android.mk @@ -0,0 +1,54 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + +ifeq ($(TARGET_PREBUILT_KERNEL),) + +MALI_GPU_VARIANT ?= midgard +MALI_DRV_VERSION ?= r28p0 +#MALI_PATH := $(abspath $(call my-dir)) +GPU_PATH := $(MALI_GPU_VARIANT)/$(MALI_DRV_VERSION)/kernel/drivers/gpu/arm/midgard +GPU_CONFIGS := CONFIG_MALI_MIDGARD=m CONFIG_MALI_PLATFORM_DEVICETREE=y CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_BACKEND=gpu + +include $(CLEAR_VARS) + +LOCAL_MODULE := mali +LOCAL_MODULE_SUFFIX := .ko +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules +LOCAL_CFLAGS := -Wno-error -Wno-pointer-sign -Wno-error=frame-larger-than= +LOCAL_C_INCLUDES := \ + $(MALI_PATH)/$(GPU_PATH)/backend/gpu \ + $(MALI_PATH)/$(GPU_PATH)/platform/devicetree \ + $(MALI_PATH)/$(GPU_PATH)/ipa \ + $(MALI_PATH)/$(GPU_PATH) \ + $(MALI_PATH)/dvalin/kernel/include + +_mali_intermediates := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE)) +_mali_ko := $(_mali_intermediates)/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX) +KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ +GPU_CFLAGS := $(LOCAL_CFLAGS) $(addprefix -I,$(LOCAL_C_INCLUDES)) -DCONFIG_MALI_PLATFORM_DEVICETREE -DCONFIG_MALI_MIDGARD_DVFS -DCONFIG_MALI_BACKEND=gpu + +$(_mali_ko): $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME) + @mkdir -p $(dir $@) + @cp -R $(MALI_PATH)/* $(dir $@)/ + $(hide) +$(KERNEL_MAKE_CMD) $(PATH_OVERRIDE) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_OUT) M=$(abspath $(_mali_intermediates))/$(GPU_PATH) ARCH=$(TARGET_KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) EXTRA_CFLAGS="$(GPU_CFLAGS)" $(GPU_CONFIGS) modules + $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $(dir $@)/$(GPU_PATH)/mali_kbase.ko; \ + cp $(dir $@)/$(GPU_PATH)/mali_kbase.ko $@; + +include $(BUILD_SYSTEM)/base_rules.mk +endif diff --git a/utgard/Android.mk b/utgard/Android.mk new file mode 100644 index 0000000..37c4d6a --- /dev/null +++ b/utgard/Android.mk @@ -0,0 +1,55 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + +ifeq ($(TARGET_PREBUILT_KERNEL),) +MALI_GPU_VARIANT ?= utgard +#MALI_DRV_VERSION ?= r10p0 +MALI_DRV_VERSION ?= r8p0 +#MALI_PATH := $(abspath $(call my-dir)) +GPU_PATH := $(MALI_GPU_VARIANT)/$(MALI_DRV_VERSION) +GPU_CONFIGS := CONFIG_MALI400=m CONFIG_MALI450=m CONFIG_AM_VDEC_H264_4K2K=y + +include $(CLEAR_VARS) + +LOCAL_MODULE := mali +LOCAL_MODULE_SUFFIX := .ko +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules +LOCAL_CFLAGS := -Wno-error -Wno-pointer-sign -Wno-error=frame-larger-than= +LOCAL_C_INCLUDES := \ + $(MALI_PATH)/$(GPU_PATH)/backend/gpu \ + $(MALI_PATH)/$(GPU_PATH)/platform/devicetree \ + $(MALI_PATH)/$(GPU_PATH)/ipa \ + $(MALI_PATH)/$(GPU_PATH) \ + $(MALI_PATH)/dvalin/kernel/include + +_mali_intermediates := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE)) +_mali_ko := $(_mali_intermediates)/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX) +KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ +GPU_CFLAGS := $(LOCAL_CFLAGS) $(addprefix -I,$(LOCAL_C_INCLUDES)) -DCONFIG_MALI400=m -DCONFIG_MALI450=m + +$(_mali_ko): $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME) + @mkdir -p $(dir $@) + @cp -R $(MALI_PATH)/* $(dir $@)/ + @cp -R $(MALI_PATH)/$(MALI_GPU_VARIANT)/platform $(dir $@)/$(GPU_PATH) + $(hide) +$(KERNEL_MAKE_CMD) $(PATH_OVERRIDE) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_OUT) M=$(abspath $(_mali_intermediates))/$(GPU_PATH) ARCH=$(TARGET_KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) EXTRA_CFLAGS="$(GPU_CFLAGS)" $(GPU_CONFIGS) modules + $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $(dir $@)/$(GPU_PATH)/mali.ko; \ + cp $(dir $@)/$(GPU_PATH)/mali.ko $@; + +include $(BUILD_SYSTEM)/base_rules.mk +endif