xref: /linux/drivers/gpu/drm/amd/display/dc/dml2/Makefile (revision 4b660dbd9ee2059850fd30e0df420ca7a38a1856)
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
27ifdef CONFIG_X86
28dml2_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
29dml2_ccflags := $(dml2_ccflags-y) -msse
30endif
31
32ifdef CONFIG_PPC64
33dml2_ccflags := -mhard-float -maltivec
34endif
35
36ifdef CONFIG_ARM64
37dml2_rcflags := -mgeneral-regs-only
38endif
39
40ifdef CONFIG_LOONGARCH
41dml2_ccflags := -mfpu=64
42dml2_rcflags := -msoft-float
43endif
44
45ifdef CONFIG_CC_IS_GCC
46ifeq ($(call cc-ifversion, -lt, 0701, y), y)
47IS_OLD_GCC = 1
48endif
49endif
50
51ifdef CONFIG_X86
52ifdef IS_OLD_GCC
53# Stack alignment mismatch, proceed with caution.
54# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
55# (8B stack alignment).
56dml2_ccflags += -mpreferred-stack-boundary=4
57else
58dml2_ccflags += -msse2
59endif
60endif
61
62ifneq ($(CONFIG_FRAME_WARN),0)
63ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
64frame_warn_flag := -Wframe-larger-than=3072
65else
66frame_warn_flag := -Wframe-larger-than=2048
67endif
68endif
69
70CFLAGS_$(AMDDALPATH)/dc/dml2/display_mode_core.o := $(dml2_ccflags) $(frame_warn_flag)
71CFLAGS_$(AMDDALPATH)/dc/dml2/display_mode_util.o := $(dml2_ccflags)
72CFLAGS_$(AMDDALPATH)/dc/dml2/dml2_wrapper.o := $(dml2_ccflags)
73CFLAGS_$(AMDDALPATH)/dc/dml2/dml2_utils.o := $(dml2_ccflags)
74CFLAGS_$(AMDDALPATH)/dc/dml2/dml2_policy.o := $(dml2_ccflags)
75CFLAGS_$(AMDDALPATH)/dc/dml2/dml2_translation_helper.o := $(dml2_ccflags)
76CFLAGS_$(AMDDALPATH)/dc/dml2/dml2_mall_phantom.o := $(dml2_ccflags)
77CFLAGS_$(AMDDALPATH)/dc/dml2/dml_display_rq_dlg_calc.o := $(dml2_ccflags)
78CFLAGS_$(AMDDALPATH)/dc/dml2/dml2_dc_resource_mgmt.o := $(dml2_ccflags)
79
80CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/display_mode_core.o := $(dml2_rcflags)
81CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/display_mode_util.o := $(dml2_rcflags)
82CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml2_wrapper.o := $(dml2_rcflags)
83CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml2_utils.o := $(dml2_rcflags)
84CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml2_policy.o := $(dml2_rcflags)
85CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml2_translation_helper.o := $(dml2_rcflags)
86CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml2_mall_phantom.o := $(dml2_rcflags)
87CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml_display_rq_dlg_calc.o := $(dml2_rcflags)
88CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2/dml2_dc_resource_mgmt.o := $(dml2_rcflags)
89
90DML2 = display_mode_core.o display_mode_util.o dml2_wrapper.o \
91		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \
92		dml_display_rq_dlg_calc.o
93
94AMD_DAL_DML2 = $(addprefix $(AMDDALPATH)/dc/dml2/,$(DML2))
95
96AMD_DISPLAY_FILES += $(AMD_DAL_DML2)
97
98