Skip to content

Commit 44e6949

Browse files
mlankhorstrodrigovivi
authored andcommitted
drm/xe/display: Implement display support
As for display, the intent is to share the display code with the i915 driver so that there is maximum reuse there. We do this by recompiling i915/display code twice. Now that i915 has been adapted to support the Xe build, we can add the xe/display support. This initial work is a collaboration of many people and unfortunately this squashed patch won't fully honor the proper credits. But let's try to add a few from the squashed patches: Co-developed-by: Matthew Brost <[email protected]> Co-developed-by: Jani Nikula <[email protected]> Co-developed-by: Lucas De Marchi <[email protected]> Co-developed-by: Matt Roper <[email protected]> Co-developed-by: Mauro Carvalho Chehab <[email protected]> Co-developed-by: Rodrigo Vivi <[email protected]> Co-developed-by: Dave Airlie <[email protected]> Signed-off-by: Maarten Lankhorst <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> Signed-off-by: Lucas De Marchi <[email protected]>
1 parent a839e36 commit 44e6949

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2873
-51
lines changed

drivers/gpu/drm/xe/.kunitconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CONFIG_DRM=y
66
CONFIG_DRM_FBDEV_EMULATION=y
77
CONFIG_DRM_KMS_HELPER=y
88
CONFIG_DRM_XE=y
9+
CONFIG_DRM_XE_DISPLAY=n
910
CONFIG_EXPERT=y
1011
CONFIG_FB=y
1112
CONFIG_DRM_XE_KUNIT_TEST=y

drivers/gpu/drm/xe/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,20 @@ config DRM_XE
1212
select DRM_KMS_HELPER
1313
select DRM_PANEL
1414
select DRM_SUBALLOC_HELPER
15+
select DRM_DISPLAY_DP_HELPER
16+
select DRM_DISPLAY_HDCP_HELPER
17+
select DRM_DISPLAY_HDMI_HELPER
18+
select DRM_DISPLAY_HELPER
19+
select DRM_MIPI_DSI
1520
select RELAY
1621
select IRQ_WORK
22+
# i915 depends on ACPI_VIDEO when ACPI is enabled
23+
# but for select to work, need to select ACPI_VIDEO's dependencies, ick
24+
select BACKLIGHT_CLASS_DEVICE if ACPI
25+
select INPUT if ACPI
26+
select ACPI_VIDEO if X86 && ACPI
27+
select ACPI_BUTTON if ACPI
28+
select ACPI_WMI if ACPI
1729
select SYNC_FILE
1830
select IOSF_MBI
1931
select CRC32
@@ -33,6 +45,16 @@ config DRM_XE
3345

3446
If "M" is selected, the module will be called xe.
3547

48+
config DRM_XE_DISPLAY
49+
bool "Enable display support"
50+
depends on DRM_XE && EXPERT && DRM_XE=m
51+
select FB_IOMEM_HELPERS
52+
select I2C
53+
select I2C_ALGOBIT
54+
default y
55+
help
56+
Disable this option only if you want to compile out display support.
57+
3658
config DRM_XE_FORCE_PROBE
3759
string "Force probe xe for selected Intel hardware IDs"
3860
depends on DRM_XE

drivers/gpu/drm/xe/Makefile

Lines changed: 136 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
2424
subdir-ccflags-y += $(call cc-disable-warning, frame-address)
2525
subdir-ccflags-$(CONFIG_DRM_XE_WERROR) += -Werror
2626

27-
# Fine grained warnings disable
28-
CFLAGS_xe_pci.o = $(call cc-disable-warning, override-init)
29-
3027
subdir-ccflags-y += -I$(obj) -I$(srctree)/$(src)
3128

3229
# generated sources
@@ -126,13 +123,147 @@ xe-y += xe_bb.o \
126123
# graphics hardware monitoring (HWMON) support
127124
xe-$(CONFIG_HWMON) += xe_hwmon.o
128125

129-
obj-$(CONFIG_DRM_XE) += xe.o
130-
obj-$(CONFIG_DRM_XE_KUNIT_TEST) += tests/
126+
# i915 Display compat #defines and #includes
127+
subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
128+
-I$(srctree)/$(src)/display/ext \
129+
-I$(srctree)/$(src)/compat-i915-headers \
130+
-I$(srctree)/drivers/gpu/drm/xe/display/ \
131+
-I$(srctree)/drivers/gpu/drm/i915/display/ \
132+
-Ddrm_i915_gem_object=xe_bo \
133+
-Ddrm_i915_private=xe_device
134+
135+
CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
136+
CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
137+
138+
# Rule to build SOC code shared with i915
139+
$(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
140+
$(call cmd,force_checksrc)
141+
$(call if_changed_rule,cc_o_c)
142+
143+
# Rule to build display code shared with i915
144+
$(obj)/i915-display/%.o: $(srctree)/drivers/gpu/drm/i915/display/%.c FORCE
145+
$(call cmd,force_checksrc)
146+
$(call if_changed_rule,cc_o_c)
147+
148+
# Display code specific to xe
149+
xe-$(CONFIG_DRM_XE_DISPLAY) += \
150+
xe_display.o \
151+
display/xe_fb_pin.o \
152+
display/xe_hdcp_gsc.o \
153+
display/xe_plane_initial.o \
154+
display/xe_display_rps.o \
155+
display/intel_fbdev_fb.o \
156+
display/intel_fb_bo.o \
157+
display/ext/i915_irq.o \
158+
display/ext/i915_utils.o
159+
160+
# SOC code shared with i915
161+
xe-$(CONFIG_DRM_XE_DISPLAY) += \
162+
i915-soc/intel_dram.o \
163+
i915-soc/intel_pch.o
164+
165+
# Display code shared with i915
166+
xe-$(CONFIG_DRM_XE_DISPLAY) += \
167+
i915-display/icl_dsi.o \
168+
i915-display/intel_atomic.o \
169+
i915-display/intel_atomic_plane.o \
170+
i915-display/intel_audio.o \
171+
i915-display/intel_backlight.o \
172+
i915-display/intel_bios.o \
173+
i915-display/intel_bw.o \
174+
i915-display/intel_cdclk.o \
175+
i915-display/intel_color.o \
176+
i915-display/intel_combo_phy.o \
177+
i915-display/intel_connector.o \
178+
i915-display/intel_crtc.o \
179+
i915-display/intel_crtc_state_dump.o \
180+
i915-display/intel_cursor.o \
181+
i915-display/intel_cx0_phy.o \
182+
i915-display/intel_ddi.o \
183+
i915-display/intel_ddi_buf_trans.o \
184+
i915-display/intel_display.o \
185+
i915-display/intel_display_debugfs.o \
186+
i915-display/intel_display_debugfs_params.o \
187+
i915-display/intel_display_device.o \
188+
i915-display/intel_display_driver.o \
189+
i915-display/intel_display_irq.o \
190+
i915-display/intel_display_params.o \
191+
i915-display/intel_display_power.o \
192+
i915-display/intel_display_power_map.o \
193+
i915-display/intel_display_power_well.o \
194+
i915-display/intel_display_trace.o \
195+
i915-display/intel_display_wa.o \
196+
i915-display/intel_dkl_phy.o \
197+
i915-display/intel_dmc.o \
198+
i915-display/intel_dp.o \
199+
i915-display/intel_dp_aux.o \
200+
i915-display/intel_dp_aux_backlight.o \
201+
i915-display/intel_dp_hdcp.o \
202+
i915-display/intel_dp_link_training.o \
203+
i915-display/intel_dp_mst.o \
204+
i915-display/intel_dpll.o \
205+
i915-display/intel_dpll_mgr.o \
206+
i915-display/intel_dpt_common.o \
207+
i915-display/intel_drrs.o \
208+
i915-display/intel_dsb.o \
209+
i915-display/intel_dsi.o \
210+
i915-display/intel_dsi_dcs_backlight.o \
211+
i915-display/intel_dsi_vbt.o \
212+
i915-display/intel_fb.o \
213+
i915-display/intel_fbc.o \
214+
i915-display/intel_fdi.o \
215+
i915-display/intel_fifo_underrun.o \
216+
i915-display/intel_frontbuffer.o \
217+
i915-display/intel_global_state.o \
218+
i915-display/intel_gmbus.o \
219+
i915-display/intel_hdcp.o \
220+
i915-display/intel_hdmi.o \
221+
i915-display/intel_hotplug.o \
222+
i915-display/intel_hotplug_irq.o \
223+
i915-display/intel_hti.o \
224+
i915-display/intel_link_bw.o \
225+
i915-display/intel_lspcon.o \
226+
i915-display/intel_modeset_lock.o \
227+
i915-display/intel_modeset_setup.o \
228+
i915-display/intel_modeset_verify.o \
229+
i915-display/intel_panel.o \
230+
i915-display/intel_pipe_crc.o \
231+
i915-display/intel_pmdemand.o \
232+
i915-display/intel_pps.o \
233+
i915-display/intel_psr.o \
234+
i915-display/intel_qp_tables.o \
235+
i915-display/intel_quirks.o \
236+
i915-display/intel_snps_phy.o \
237+
i915-display/intel_tc.o \
238+
i915-display/intel_vblank.o \
239+
i915-display/intel_vdsc.o \
240+
i915-display/intel_vga.o \
241+
i915-display/intel_vrr.o \
242+
i915-display/intel_wm.o \
243+
i915-display/skl_scaler.o \
244+
i915-display/skl_universal_plane.o \
245+
i915-display/skl_watermark.o
131246

132247
xe-$(CONFIG_PERF_EVENTS) += xe_pmu.o
133248

249+
ifeq ($(CONFIG_ACPI),y)
250+
xe-$(CONFIG_DRM_XE_DISPLAY) += \
251+
i915-display/intel_acpi.o \
252+
i915-display/intel_opregion.o
253+
endif
254+
255+
ifeq ($(CONFIG_DRM_FBDEV_EMULATION),y)
256+
xe-$(CONFIG_DRM_XE_DISPLAY) += i915-display/intel_fbdev.o
257+
endif
258+
259+
obj-$(CONFIG_DRM_XE) += xe.o
260+
obj-$(CONFIG_DRM_XE_KUNIT_TEST) += tests/
261+
134262
# header test
135263
hdrtest_find_args := -not -path xe_rtp_helpers.h
264+
ifneq ($(CONFIG_DRM_XE_DISPLAY),y)
265+
hdrtest_find_args += -not -path display/\* -not -path compat-i915-headers/\* -not -path xe_display.h
266+
endif
136267

137268
always-$(CONFIG_DRM_XE_WERROR) += \
138269
$(patsubst %.h,%.hdrtest, $(shell cd $(srctree)/$(src) && find * -name '*.h' $(hdrtest_find_args)))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Empty */
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2023 Intel Corporation
4+
*/
5+
6+
#ifndef _I915_GEM_MMAN_H_
7+
#define _I915_GEM_MMAN_H_
8+
9+
#include "xe_bo_types.h"
10+
#include <drm/drm_prime.h>
11+
12+
static inline int i915_gem_fb_mmap(struct xe_bo *bo, struct vm_area_struct *vma)
13+
{
14+
return drm_gem_prime_mmap(&bo->ttm.base, vma);
15+
}
16+
17+
#endif
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2022 Intel Corporation
4+
*/
5+
6+
#ifndef _I915_GEM_OBJECT_H_
7+
#define _I915_GEM_OBJECT_H_
8+
9+
#include <linux/types.h>
10+
11+
#include "xe_bo.h"
12+
13+
#define i915_gem_object_is_shmem(obj) ((obj)->flags & XE_BO_CREATE_SYSTEM_BIT)
14+
15+
static inline dma_addr_t i915_gem_object_get_dma_address(const struct xe_bo *bo, pgoff_t n)
16+
{
17+
/* Should never be called */
18+
WARN_ON(1);
19+
return n;
20+
}
21+
22+
static inline bool i915_gem_object_is_tiled(const struct xe_bo *bo)
23+
{
24+
/* legacy tiling is unused */
25+
return false;
26+
}
27+
28+
static inline bool i915_gem_object_is_userptr(const struct xe_bo *bo)
29+
{
30+
/* legacy tiling is unused */
31+
return false;
32+
}
33+
34+
static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
35+
u32 ofs, u64 *ptr, u32 size)
36+
{
37+
struct ttm_bo_kmap_obj map;
38+
void *virtual;
39+
bool is_iomem;
40+
int ret;
41+
42+
XE_WARN_ON(size != 8);
43+
44+
ret = xe_bo_lock(bo, true);
45+
if (ret)
46+
return ret;
47+
48+
ret = ttm_bo_kmap(&bo->ttm, ofs >> PAGE_SHIFT, 1, &map);
49+
if (ret)
50+
goto out_unlock;
51+
52+
ofs &= ~PAGE_MASK;
53+
virtual = ttm_kmap_obj_virtual(&map, &is_iomem);
54+
if (is_iomem)
55+
*ptr = readq((void __iomem *)(virtual + ofs));
56+
else
57+
*ptr = *(u64 *)(virtual + ofs);
58+
59+
ttm_bo_kunmap(&map);
60+
out_unlock:
61+
xe_bo_unlock(bo);
62+
return ret;
63+
}
64+
65+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2023 Intel Corporation
4+
*/
5+
6+
#ifndef __INTEL_RPS_H__
7+
#define __INTEL_RPS_H__
8+
9+
#define gen5_rps_irq_handler(x) ({})
10+
11+
#endif /* __INTEL_RPS_H__ */

drivers/gpu/drm/xe/compat-i915-headers/i915_active_types.h

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2023 Intel Corporation
4+
*/
5+
6+
#ifndef __I915_CONFIG_H__
7+
#define __I915_CONFIG_H__
8+
9+
#include <linux/sched.h>
10+
11+
struct drm_i915_private;
12+
13+
static inline unsigned long
14+
i915_fence_timeout(const struct drm_i915_private *i915)
15+
{
16+
return MAX_SCHEDULE_TIMEOUT;
17+
}
18+
19+
#endif /* __I915_CONFIG_H__ */
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2023 Intel Corporation
4+
*/
5+
6+
#ifndef __I915_DEBUGFS_H__
7+
#define __I915_DEBUGFS_H__
8+
9+
struct drm_i915_gem_object;
10+
struct seq_file;
11+
12+
static inline void i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) {}
13+
14+
#endif /* __I915_DEBUGFS_H__ */

0 commit comments

Comments
 (0)