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