xref: /linux/drivers/gpu/drm/xe/Makefile (revision a3a02a52bcfcbcc4a637d4b68bf1bc391c9fad02)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for the drm device driver.  This driver provides support for the
4# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
5
6# Enable W=1 warnings not enabled in drm subsystem Makefile
7subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
8
9# Enable -Werror in CI and development
10subdir-ccflags-$(CONFIG_DRM_XE_WERROR) += -Werror
11
12subdir-ccflags-y += -I$(obj) -I$(src)
13
14# generated sources
15hostprogs := xe_gen_wa_oob
16
17generated_oob := $(obj)/generated/xe_wa_oob.c $(obj)/generated/xe_wa_oob.h
18
19quiet_cmd_wa_oob = GEN     $(notdir $(generated_oob))
20      cmd_wa_oob = mkdir -p $(@D); $^ $(generated_oob)
21
22$(obj)/generated/%_wa_oob.c $(obj)/generated/%_wa_oob.h: $(obj)/xe_gen_wa_oob \
23		 $(src)/xe_wa_oob.rules
24	$(call cmd,wa_oob)
25
26uses_generated_oob := \
27	$(obj)/xe_ggtt.o \
28	$(obj)/xe_gsc.o \
29	$(obj)/xe_gt.o \
30	$(obj)/xe_guc.o \
31	$(obj)/xe_guc_ads.o \
32	$(obj)/xe_guc_pc.o \
33	$(obj)/xe_migrate.o \
34	$(obj)/xe_ring_ops.o \
35	$(obj)/xe_vm.o \
36	$(obj)/xe_wa.o \
37	$(obj)/xe_ttm_stolen_mgr.o
38
39$(uses_generated_oob): $(generated_oob)
40
41# Please keep these build lists sorted!
42
43# core driver code
44
45xe-y += xe_bb.o \
46	xe_bo.o \
47	xe_bo_evict.o \
48	xe_debugfs.o \
49	xe_devcoredump.o \
50	xe_device.o \
51	xe_device_sysfs.o \
52	xe_dma_buf.o \
53	xe_drm_client.o \
54	xe_exec.o \
55	xe_execlist.o \
56	xe_exec_queue.o \
57	xe_force_wake.o \
58	xe_ggtt.o \
59	xe_gpu_scheduler.o \
60	xe_gsc.o \
61	xe_gsc_proxy.o \
62	xe_gsc_submit.o \
63	xe_gt.o \
64	xe_gt_ccs_mode.o \
65	xe_gt_clock.o \
66	xe_gt_debugfs.o \
67	xe_gt_freq.o \
68	xe_gt_idle.o \
69	xe_gt_mcr.o \
70	xe_gt_pagefault.o \
71	xe_gt_sysfs.o \
72	xe_gt_throttle.o \
73	xe_gt_tlb_invalidation.o \
74	xe_gt_topology.o \
75	xe_guc.o \
76	xe_guc_ads.o \
77	xe_guc_ct.o \
78	xe_guc_db_mgr.o \
79	xe_guc_debugfs.o \
80	xe_guc_hwconfig.o \
81	xe_guc_id_mgr.o \
82	xe_guc_klv_helpers.o \
83	xe_guc_log.o \
84	xe_guc_pc.o \
85	xe_guc_submit.o \
86	xe_heci_gsc.o \
87	xe_hw_engine.o \
88	xe_hw_engine_class_sysfs.o \
89	xe_hw_fence.o \
90	xe_huc.o \
91	xe_huc_debugfs.o \
92	xe_irq.o \
93	xe_lrc.o \
94	xe_migrate.o \
95	xe_mmio.o \
96	xe_mocs.o \
97	xe_module.o \
98	xe_oa.o \
99	xe_observation.o \
100	xe_pat.o \
101	xe_pci.o \
102	xe_pcode.o \
103	xe_pm.o \
104	xe_preempt_fence.o \
105	xe_pt.o \
106	xe_pt_walk.o \
107	xe_query.o \
108	xe_range_fence.o \
109	xe_reg_sr.o \
110	xe_reg_whitelist.o \
111	xe_rtp.o \
112	xe_ring_ops.o \
113	xe_sa.o \
114	xe_sched_job.o \
115	xe_step.o \
116	xe_sync.o \
117	xe_tile.o \
118	xe_tile_sysfs.o \
119	xe_trace.o \
120	xe_trace_bo.o \
121	xe_trace_guc.o \
122	xe_ttm_sys_mgr.o \
123	xe_ttm_stolen_mgr.o \
124	xe_ttm_vram_mgr.o \
125	xe_tuning.o \
126	xe_uc.o \
127	xe_uc_debugfs.o \
128	xe_uc_fw.o \
129	xe_vm.o \
130	xe_vram.o \
131	xe_vram_freq.o \
132	xe_wait_user_fence.o \
133	xe_wa.o \
134	xe_wopcm.o
135
136xe-$(CONFIG_HMM_MIRROR) += xe_hmm.o
137
138# graphics hardware monitoring (HWMON) support
139xe-$(CONFIG_HWMON) += xe_hwmon.o
140
141# graphics virtualization (SR-IOV) support
142xe-y += \
143	xe_gt_sriov_vf.o \
144	xe_gt_sriov_vf_debugfs.o \
145	xe_guc_relay.o \
146	xe_memirq.o \
147	xe_sriov.o
148
149xe-$(CONFIG_PCI_IOV) += \
150	xe_gt_sriov_pf.o \
151	xe_gt_sriov_pf_config.o \
152	xe_gt_sriov_pf_control.o \
153	xe_gt_sriov_pf_debugfs.o \
154	xe_gt_sriov_pf_monitor.o \
155	xe_gt_sriov_pf_policy.o \
156	xe_gt_sriov_pf_service.o \
157	xe_lmtt.o \
158	xe_lmtt_2l.o \
159	xe_lmtt_ml.o \
160	xe_pci_sriov.o \
161	xe_sriov_pf.o
162
163# include helpers for tests even when XE is built-in
164ifdef CONFIG_DRM_XE_KUNIT_TEST
165xe-y += tests/xe_kunit_helpers.o
166endif
167
168# i915 Display compat #defines and #includes
169subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
170	-I$(src)/display/ext \
171	-I$(src)/compat-i915-headers \
172	-I$(srctree)/drivers/gpu/drm/i915/display/ \
173	-Ddrm_i915_gem_object=xe_bo \
174	-Ddrm_i915_private=xe_device
175
176# Rule to build SOC code shared with i915
177$(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
178	$(call cmd,force_checksrc)
179	$(call if_changed_rule,cc_o_c)
180
181# Rule to build display code shared with i915
182$(obj)/i915-display/%.o: $(srctree)/drivers/gpu/drm/i915/display/%.c FORCE
183	$(call cmd,force_checksrc)
184	$(call if_changed_rule,cc_o_c)
185
186# Display code specific to xe
187xe-$(CONFIG_DRM_XE_DISPLAY) += \
188	display/ext/i915_irq.o \
189	display/ext/i915_utils.o \
190	display/intel_fb_bo.o \
191	display/intel_fbdev_fb.o \
192	display/xe_display.o \
193	display/xe_display_misc.o \
194	display/xe_display_rps.o \
195	display/xe_dsb_buffer.o \
196	display/xe_fb_pin.o \
197	display/xe_hdcp_gsc.o \
198	display/xe_plane_initial.o \
199	display/xe_tdf.o
200
201# SOC code shared with i915
202xe-$(CONFIG_DRM_XE_DISPLAY) += \
203	i915-soc/intel_dram.o \
204	i915-soc/intel_pch.o
205
206# Display code shared with i915
207xe-$(CONFIG_DRM_XE_DISPLAY) += \
208	i915-display/icl_dsi.o \
209	i915-display/intel_alpm.o \
210	i915-display/intel_atomic.o \
211	i915-display/intel_atomic_plane.o \
212	i915-display/intel_audio.o \
213	i915-display/intel_backlight.o \
214	i915-display/intel_bios.o \
215	i915-display/intel_bw.o \
216	i915-display/intel_cdclk.o \
217	i915-display/intel_color.o \
218	i915-display/intel_combo_phy.o \
219	i915-display/intel_connector.o \
220	i915-display/intel_crtc.o \
221	i915-display/intel_crtc_state_dump.o \
222	i915-display/intel_cursor.o \
223	i915-display/intel_cx0_phy.o \
224	i915-display/intel_ddi.o \
225	i915-display/intel_ddi_buf_trans.o \
226	i915-display/intel_display.o \
227	i915-display/intel_display_device.o \
228	i915-display/intel_display_driver.o \
229	i915-display/intel_display_irq.o \
230	i915-display/intel_display_params.o \
231	i915-display/intel_display_power.o \
232	i915-display/intel_display_power_map.o \
233	i915-display/intel_display_power_well.o \
234	i915-display/intel_display_trace.o \
235	i915-display/intel_display_wa.o \
236	i915-display/intel_dkl_phy.o \
237	i915-display/intel_dmc.o \
238	i915-display/intel_dp.o \
239	i915-display/intel_dp_aux.o \
240	i915-display/intel_dp_aux_backlight.o \
241	i915-display/intel_dp_hdcp.o \
242	i915-display/intel_dp_link_training.o \
243	i915-display/intel_dp_mst.o \
244	i915-display/intel_dpll.o \
245	i915-display/intel_dpll_mgr.o \
246	i915-display/intel_dpt_common.o \
247	i915-display/intel_drrs.o \
248	i915-display/intel_dsb.o \
249	i915-display/intel_dsi.o \
250	i915-display/intel_dsi_dcs_backlight.o \
251	i915-display/intel_dsi_vbt.o \
252	i915-display/intel_encoder.o \
253	i915-display/intel_fb.o \
254	i915-display/intel_fbc.o \
255	i915-display/intel_fdi.o \
256	i915-display/intel_fifo_underrun.o \
257	i915-display/intel_frontbuffer.o \
258	i915-display/intel_global_state.o \
259	i915-display/intel_gmbus.o \
260	i915-display/intel_hdcp.o \
261	i915-display/intel_hdcp_gsc_message.o \
262	i915-display/intel_hdmi.o \
263	i915-display/intel_hotplug.o \
264	i915-display/intel_hotplug_irq.o \
265	i915-display/intel_hti.o \
266	i915-display/intel_link_bw.o \
267	i915-display/intel_lspcon.o \
268	i915-display/intel_modeset_lock.o \
269	i915-display/intel_modeset_setup.o \
270	i915-display/intel_modeset_verify.o \
271	i915-display/intel_panel.o \
272	i915-display/intel_pmdemand.o \
273	i915-display/intel_pps.o \
274	i915-display/intel_psr.o \
275	i915-display/intel_qp_tables.o \
276	i915-display/intel_quirks.o \
277	i915-display/intel_snps_phy.o \
278	i915-display/intel_tc.o \
279	i915-display/intel_vblank.o \
280	i915-display/intel_vdsc.o \
281	i915-display/intel_vga.o \
282	i915-display/intel_vrr.o \
283	i915-display/intel_dmc_wl.o \
284	i915-display/intel_wm.o \
285	i915-display/skl_scaler.o \
286	i915-display/skl_universal_plane.o \
287	i915-display/skl_watermark.o
288
289ifeq ($(CONFIG_ACPI),y)
290	xe-$(CONFIG_DRM_XE_DISPLAY) += \
291		i915-display/intel_acpi.o \
292		i915-display/intel_opregion.o
293endif
294
295ifeq ($(CONFIG_DRM_FBDEV_EMULATION),y)
296	xe-$(CONFIG_DRM_XE_DISPLAY) += i915-display/intel_fbdev.o
297endif
298
299ifeq ($(CONFIG_DEBUG_FS),y)
300	xe-$(CONFIG_DRM_XE_DISPLAY) += \
301		i915-display/intel_display_debugfs.o \
302		i915-display/intel_display_debugfs_params.o \
303		i915-display/intel_pipe_crc.o
304endif
305
306obj-$(CONFIG_DRM_XE) += xe.o
307obj-$(CONFIG_DRM_XE_KUNIT_TEST) += tests/
308
309# header test
310hdrtest_find_args := -not -path xe_rtp_helpers.h
311ifneq ($(CONFIG_DRM_XE_DISPLAY),y)
312	hdrtest_find_args += -not -path display/\* -not -path compat-i915-headers/\* -not -path xe_display.h
313endif
314
315always-$(CONFIG_DRM_XE_WERROR) += \
316	$(patsubst %.h,%.hdrtest, $(shell cd $(src) && find * -name '*.h' $(hdrtest_find_args)))
317
318quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
319      cmd_hdrtest = $(CC) -DHDRTEST $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o /dev/null -x c /dev/null -include $<; touch $@
320
321$(obj)/%.hdrtest: $(src)/%.h FORCE
322	$(call if_changed_dep,hdrtest)
323