1# SPDX-License-Identifier: MIT */ 2# 3# Copyright 2023 Advanced Micro Devices, Inc. 4# 5# Permission is hereby granted, free of charge, to any person obtaining a 6# copy of this software and associated documentation files (the "Software"), 7# to deal in the Software without restriction, including without limitation 8# the rights to use, copy, modify, merge, publish, distribute, sublicense, 9# and/or sell copies of the Software, and to permit persons to whom the 10# Software is furnished to do so, subject to the following conditions: 11# 12# The above copyright notice and this permission notice shall be included in 13# all copies or substantial portions of the Software. 14# 15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21# OTHER DEALINGS IN THE SOFTWARE. 22# 23# Authors: AMD 24# 25# Makefile for dml2. 26 27dml2_ccflags := $(CC_FLAGS_FPU) 28dml2_rcflags := $(CC_FLAGS_NO_FPU) 29 30ifneq ($(CONFIG_FRAME_WARN),0) 31 ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) 32 ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) 33 frame_warn_limit := 4096 34 else 35 frame_warn_limit := 3072 36 endif 37 else 38 frame_warn_limit := 2056 39 endif 40 41 ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y) 42 frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit) 43 endif 44endif 45 46subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0 47subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_core 48subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_mcg/ 49subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_dpmm/ 50subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_pmo/ 51subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_standalone_libraries/ 52subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/inc 53subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/inc 54subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/ 55 56# Add FPU flags to all dml2 files by default, remove NO_FPU flags. 57# FPU flags step 1: Find all .c files in dal/dc/dml2_0 and it's subfolders 58DML2_ABS_PATH := $(FULL_AMD_DISPLAY_PATH)/dc/dml2_0 59DML2_C_FILES := $(shell find $(DML2_ABS_PATH) -name '*.c' -type f) 60 61# FPU flags step 2: Convert to .o and make paths relative to $(AMDDALPATH)/dc/dml2_0/ 62DML2_RELATIVE_O_FILES := $(patsubst $(DML2_ABS_PATH)/%,dc/dml2_0/%,$(patsubst %.c,%.o,$(DML2_C_FILES))) 63 64# FPU flags step 3: Apply FPU flags to all .o files from dal/dc/dml2_0 and it's subfolders 65$(foreach obj,$(DML2_RELATIVE_O_FILES),$(eval CFLAGS_$(AMDDALPATH)/$(obj) := $(dml2_ccflags))) 66$(foreach obj,$(DML2_RELATIVE_O_FILES),$(eval CFLAGS_REMOVE_$(AMDDALPATH)/$(obj) := $(dml2_rcflags))) 67 68# FPU flags step 4: Replace CFLAGS per file for files with additional flags beyond dml2_ccflags and dml2_rcflags 69CFLAGS_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_ccflags) $(frame_warn_flag) 70CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_ccflags) $(frame_warn_flag) 71CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_ccflags) $(frame_warn_flag) 72CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_rcflags) 73CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_rcflags) 74CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_rcflags) 75CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_rcflags) 76CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_rcflags) 77CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_ccflags) 78CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_ccflags) 79 80DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o dml2_wrapper.o \ 81 dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \ 82 dml_display_rq_dlg_calc.o 83 84AMD_DAL_DML2 = $(addprefix $(AMDDALPATH)/dc/dml2_0/,$(DML2)) 85 86AMD_DISPLAY_FILES += $(AMD_DAL_DML2) 87 88 89DML21 := src/dml2_top/dml2_top_interfaces.o 90DML21 += src/dml2_top/dml2_top_soc15.o 91DML21 += src/dml2_core/dml2_core_dcn4.o 92DML21 += src/dml2_core/dml2_core_utils.o 93DML21 += src/dml2_core/dml2_core_factory.o 94DML21 += src/dml2_core/dml2_core_dcn4_calcs.o 95DML21 += src/dml2_dpmm/dml2_dpmm_dcn4.o 96DML21 += src/dml2_dpmm/dml2_dpmm_factory.o 97DML21 += src/dml2_mcg/dml2_mcg_dcn4.o 98DML21 += src/dml2_mcg/dml2_mcg_dcn42.o 99DML21 += src/dml2_mcg/dml2_mcg_factory.o 100DML21 += src/dml2_pmo/dml2_pmo_dcn3.o 101DML21 += src/dml2_pmo/dml2_pmo_factory.o 102DML21 += src/dml2_pmo/dml2_pmo_dcn4_fams2.o 103DML21 += src/dml2_pmo/dml2_pmo_dcn42.o 104DML21 += src/dml2_standalone_libraries/lib_float_math.o 105DML21 += dml21_translation_helper.o 106DML21 += dml21_wrapper.o 107DML21 += dml21_wrapper_fpu.o 108DML21 += dml21_utils.o 109 110AMD_DAL_DML21 = $(addprefix $(AMDDALPATH)/dc/dml2_0/dml21/,$(DML21)) 111 112AMD_DISPLAY_FILES += $(AMD_DAL_DML21) 113