xref: /linux/drivers/gpu/drm/amd/display/dc/dml2_0/Makefile (revision 20bed0d6ff62d985fe8222958825504b8aad4e88)
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    ifneq ($(filter y,$(CONFIG_KASAN) $(CONFIG_KCSAN) $(CONFIG_UBSAN)),)
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 := 3072
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
65rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$(2)) $(filter $(subst *,%,$(2)),$d))
66DML2_C_FILES := $(call rwildcard,$(DML2_ABS_PATH)/,*.c)
67
68# FPU flags step 2: Convert to .o and make paths relative to $(AMDDALPATH)/dc/dml2_0/
69DML2_RELATIVE_O_FILES := $(patsubst $(DML2_ABS_PATH)/%,dc/dml2_0/%,$(patsubst %.c,%.o,$(DML2_C_FILES)))
70
71# FPU flags step 3: Apply FPU flags to all .o files from dal/dc/dml2_0 and it's subfolders
72$(foreach obj,$(DML2_RELATIVE_O_FILES),$(eval CFLAGS_$(AMDDALPATH)/$(obj) := $(dml2_ccflags)))
73$(foreach obj,$(DML2_RELATIVE_O_FILES),$(eval CFLAGS_REMOVE_$(AMDDALPATH)/$(obj) := $(dml2_rcflags)))
74
75# FPU flags step 4: Replace CFLAGS per file for files with additional flags beyond dml2_ccflags and dml2_rcflags
76CFLAGS_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_ccflags) $(frame_warn_flag)
77CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_ccflags) $(frame_warn_flag)
78CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_ccflags) $(frame_warn_flag)
79CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_programming.o := $(dml2_ccflags) $(frame_warn_flag)
80CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
81CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o := $(dml2_ccflags) $(frame_warn_flag)
82CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
83
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)
91
92# DML2 library core files
93DML2 = display_mode_core.o display_mode_util.o \
94		dml_display_rq_dlg_calc.o
95DML2 += dml_frl_cap_chk.o
96
97AMD_DAL_DML2 = $(addprefix $(AMDDALPATH)/dc/dml2_0/,$(DML2))
98
99AMD_DISPLAY_FILES += $(AMD_DAL_DML2)
100
101
102DML21 := src/dml2_top/dml2_top_interfaces.o
103DML21 += src/dml2_top/dml2_top_soc15.o
104DML21 += src/dml2_core/dml2_core_dcn4.o
105DML21 += src/dml2_core/dml2_core_utils.o
106DML21 += src/dml2_core/dml2_core_factory.o
107DML21 += src/dml2_core/dml2_core_dcn4_calcs.o
108DML21 += src/dml2_dpmm/dml2_dpmm_dcn4.o
109DML21 += src/dml2_dpmm/dml2_dpmm_factory.o
110DML21 += src/dml2_mcg/dml2_mcg_dcn4.o
111DML21 += src/dml2_mcg/dml2_mcg_dcn42.o
112DML21 += src/dml2_mcg/dml2_mcg_factory.o
113DML21 += src/dml2_pmo/dml2_pmo_dcn3.o
114DML21 += src/dml2_pmo/dml2_pmo_factory.o
115DML21 += src/dml2_pmo/dml2_pmo_dcn4_fams2.o
116DML21 += src/dml2_pmo/dml2_pmo_dcn42.o
117DML21 += src/dml2_standalone_libraries/lib_float_math.o
118DML21 += src/dml2_standalone_libraries/lib_frl_cap_check.o
119DML21 += src/dml2_top/dml2_top_utm.o
120DML21 += src/dml2_core/dml2_core_dcn5_calcs_dchub.o
121DML21 += src/dml2_core/dml2_core_dcn5_calcs_display_pipe.o
122DML21 += src/dml2_core/dml2_core_dcn5_calcs_dsc_latency.o
123DML21 += src/dml2_core/dml2_core_dcn5_funcs_initialize.o
124DML21 += src/dml2_core/dml2_core_dcn5_funcs_mode_programming.o
125DML21 += src/dml2_core/dml2_core_dcn5_funcs_mode_support.o
126DML21 += src/dml2_dpmm/dml2_dpmm_dcn5.o
127DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn5.o
128DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_factory.o
129DML21 += src/dml2_cga/dml2_cga_dcn6.o
130DML21 += src/dml2_cga/dml2_cga_factory.o
131DML21 += src/dml2_core/dml2_core_dcn6_calcs.o
132DML21 += src/dml2_core/dml2_core_dcn6_calcs_dchub.o
133DML21 += src/dml2_core/dml2_core_dcn6_funcs_initialize.o
134DML21 += src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o
135DML21 += src/dml2_core/dml2_core_dcn6_funcs_mode_support.o
136DML21 += src/dml2_pmo/dml2_pmo_dcn5.o
137DML21 += src/dml2_pmo/dml2_pmo_dcn5_stage_optimizers.o
138DML21 += src/dml2_pmo/dml2_pmo_dcn6.o
139DML21 += src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.o
140DML21 += src/dml2_standalone_libraries/alternate_pstate_shared_lib.o
141DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.o
142
143AMD_DAL_DML21 = $(addprefix $(AMDDALPATH)/dc/dml2_0/dml21/,$(DML21))
144
145AMD_DISPLAY_FILES += $(AMD_DAL_DML21)
146