Split mali gpu makefiles per GPU arch
authorVitaliy Tomin <highwaystar.ru@gmail.com>
Fri, 27 May 2022 16:57:40 +0000 (00:57 +0800)
committerNolen Johnson <johnsonnolen@gmail.com>
Fri, 2 Dec 2022 23:07:15 +0000 (18:07 -0500)
* use TARGET_AMLOGIC_GPU_ARCH flag set to bifrost, midgard or utgard to
  select proper mali module to build

Change-Id: I1b32483fc32e2709688013a2941baa877484dee5

Android.mk
bifrost/Android.mk [new file with mode: 0644]
midgard/Android.mk [new file with mode: 0644]
utgard/Android.mk [new file with mode: 0644]

index 36c5a1364cd7213f9e0ba0fc6c0fff0d4eb2370b..fd43b368de430bbb07fb04339832af71459ed88b 100644 (file)
@@ -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.
 # 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 (file)
index 0000000..321b224
--- /dev/null
@@ -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 (file)
index 0000000..cc78036
--- /dev/null
@@ -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 (file)
index 0000000..37c4d6a
--- /dev/null
@@ -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