xref: /linux/drivers/gpu/drm/amd/display/dc/dml2_0/Makefile (revision 570f7e331f5febb30f1384817463c7e42b65ca7d)
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/
55subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/inc/bounding_boxes/
56subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_utm_soc_bb/
57subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/src/dml2_cga/
58
59# Add FPU flags to all dml2 files by default, remove NO_FPU flags.
60# FPU flags step 1: Find all .c files in dal/dc/dml2_0 and it's subfolders
61
62THIS_MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
63DML2_ABS_PATH := $(patsubst %/,%,$(dir $(THIS_MAKEFILE_PATH)))
64
65DML2_C_FILES := $(shell find $(DML2_ABS_PATH) -name '*.c')
66
67# FPU flags step 2: Convert to .o and make paths relative to $(AMDDALPATH)/dc/dml2_0/
68DML2_RELATIVE_O_FILES := $(patsubst $(DML2_ABS_PATH)/%,dc/dml2_0/%,$(patsubst %.c,%.o,$(DML2_C_FILES)))
69
70# FPU flags step 3: Apply FPU flags to all .o files from dal/dc/dml2_0 and it's subfolders
71$(foreach obj,$(DML2_RELATIVE_O_FILES),$(eval CFLAGS_$(AMDDALPATH)/$(obj) := $(dml2_ccflags)))
72$(foreach obj,$(DML2_RELATIVE_O_FILES),$(eval CFLAGS_REMOVE_$(AMDDALPATH)/$(obj) := $(dml2_rcflags)))
73
74# FPU flags step 4: Replace CFLAGS per file for files with additional flags beyond dml2_ccflags and dml2_rcflags
75CFLAGS_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_ccflags) $(frame_warn_flag)
76CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_ccflags) $(frame_warn_flag)
77CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_ccflags) $(frame_warn_flag)
78CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_programming.o := $(dml2_ccflags) $(frame_warn_flag)
79CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
80CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o := $(dml2_ccflags) $(frame_warn_flag)
81CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
82CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_rcflags)
83CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_rcflags)
84CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_rcflags)
85CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_rcflags)
86CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_rcflags)
87CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_programming.o := $(dml2_rcflags)
88CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.o := $(dml2_rcflags)
89CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o := $(dml2_rcflags)
90CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.o := $(dml2_rcflags)
91CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_ccflags)
92CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_ccflags)
93
94DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o dml2_wrapper.o \
95		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \
96		dml_display_rq_dlg_calc.o
97DML2 += dml_frl_cap_chk.o
98
99AMD_DAL_DML2 = $(addprefix $(AMDDALPATH)/dc/dml2_0/,$(DML2))
100
101AMD_DISPLAY_FILES += $(AMD_DAL_DML2)
102
103
104DML21 := src/dml2_top/dml2_top_interfaces.o
105DML21 += src/dml2_top/dml2_top_soc15.o
106DML21 += src/dml2_core/dml2_core_dcn4.o
107DML21 += src/dml2_core/dml2_core_utils.o
108DML21 += src/dml2_core/dml2_core_factory.o
109DML21 += src/dml2_core/dml2_core_dcn4_calcs.o
110DML21 += src/dml2_dpmm/dml2_dpmm_dcn4.o
111DML21 += src/dml2_dpmm/dml2_dpmm_factory.o
112DML21 += src/dml2_mcg/dml2_mcg_dcn4.o
113DML21 += src/dml2_mcg/dml2_mcg_dcn42.o
114DML21 += src/dml2_mcg/dml2_mcg_factory.o
115DML21 += src/dml2_pmo/dml2_pmo_dcn3.o
116DML21 += src/dml2_pmo/dml2_pmo_factory.o
117DML21 += src/dml2_pmo/dml2_pmo_dcn4_fams2.o
118DML21 += src/dml2_pmo/dml2_pmo_dcn42.o
119DML21 += src/dml2_standalone_libraries/lib_float_math.o
120DML21 += src/dml2_standalone_libraries/lib_frl_cap_check.o
121DML21 += src/dml2_top/dml2_top_utm.o
122DML21 += src/dml2_core/dml2_core_dcn5_calcs_dchub.o
123DML21 += src/dml2_core/dml2_core_dcn5_calcs_display_pipe.o
124DML21 += src/dml2_core/dml2_core_dcn5_calcs_dsc_latency.o
125DML21 += src/dml2_core/dml2_core_dcn5_funcs_initialize.o
126DML21 += src/dml2_core/dml2_core_dcn5_funcs_mode_programming.o
127DML21 += src/dml2_core/dml2_core_dcn5_funcs_mode_support.o
128DML21 += src/dml2_dpmm/dml2_dpmm_dcn5.o
129DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn5.o
130DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_factory.o
131DML21 += src/dml2_cga/dml2_cga_dcn6.o
132DML21 += src/dml2_cga/dml2_cga_factory.o
133DML21 += src/dml2_core/dml2_core_dcn6_calcs_dchub.o
134DML21 += src/dml2_core/dml2_core_dcn6_funcs_initialize.o
135DML21 += src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o
136DML21 += src/dml2_core/dml2_core_dcn6_funcs_mode_support.o
137DML21 += src/dml2_pmo/dml2_pmo_dcn5.o
138DML21 += src/dml2_pmo/dml2_pmo_dcn5_stage_optimizers.o
139DML21 += src/dml2_pmo/dml2_pmo_dcn6.o
140DML21 += src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.o
141DML21 += src/dml2_standalone_libraries/alternate_pstate_shared_lib.o
142DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.o
143DML21 += dml21_translation_helper.o
144DML21 += dml21_wrapper.o
145DML21 += dml21_wrapper_fpu.o
146DML21 += dml21_utils.o
147
148AMD_DAL_DML21 = $(addprefix $(AMDDALPATH)/dc/dml2_0/dml21/,$(DML21))
149
150AMD_DISPLAY_FILES += $(AMD_DAL_DML21)
151