[Intel-xe] [PATCH 7/7] drm/xe: Remove i915 header dependency when building without display

Lucas De Marchi lucas.demarchi at intel.com
Thu Mar 2 01:34:11 UTC 2023


If xe is built without support for driving display, it shouldn't need
the i915 headers. As a consequence the build system shouldn't be passing
the additional CFLAGS to include the i915 directories. However as the
display structs were needed in other compilation units, it was not
possible to remove, leading to every single file indirectly including
the i915 headers via xe_device_types.h.

The Makefile had a note about i915 register definitions, but missed the
display dependencies.

Now that the display substruct from xe_device and the info substruct
from xe->info are initialized by display-only files, it's possible to
shield the rest of the driver with some additional ifdefs. Ideally the
structs should be made opaque and only defined in the display
compilation units: this would allow removing the includes from
xe_device_types.h even when building with display. However this needs
more refactors and cleanups because the i915 files expect the info and
display substruct to be available from drm_i915_private that is aliased
by xe_device when building xe.  So, to avoid future dependencies on the
i915 headers, just add a few more ifdefs in the header so a build
without display breaks if this is attempted.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 drivers/gpu/drm/xe/Makefile          | 3 ---
 drivers/gpu/drm/xe/xe_device_types.h | 9 ++++++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index d1d255df74a1..5489d761f6f6 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -104,9 +104,6 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += -I$(srctree)/$(src)/display/ext \
 	-Ddrm_i915_gem_object=xe_bo \
 	-Ddrm_i915_private=xe_device
 
-# XXX: Needed for i915 register definitions. Will be removed after xe-regs.
-subdir-ccflags-y += -I$(srctree)/drivers/gpu/drm/i915/
-
 CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
 
 $(obj)/display/i915_%.o: $(srctree)/drivers/gpu/drm/i915/display/i915_%.c FORCE
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index ec36cedb87cc..199bd37fce9a 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -16,10 +16,11 @@
 #include "xe_platform_types.h"
 #include "xe_step_types.h"
 
-/* For display substruct */
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 #include "display/ext/intel_device_info.h"
 #include "display/ext/intel_pch.h"
 #include "display/intel_display_core.h"
+#endif
 
 #define XE_BO_INVALID_OFFSET	LONG_MAX
 
@@ -97,6 +98,7 @@ struct xe_device {
 		/** @enable_display: display enabled */
 		bool enable_display;
 
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 		struct xe_device_display_info {
 			u8 ver;
 
@@ -147,6 +149,7 @@ struct xe_device {
 			u8 num_scalers[I915_MAX_PIPES];
 			u32 rawclk_freq;
 		} display;
+#endif
 	} info;
 
 	/** @irq: device interrupt state */
@@ -241,8 +244,7 @@ struct xe_device {
 	/** @d3cold_allowed: Indicates if d3cold is a valid device state */
 	bool d3cold_allowed;
 
-	/* private: */
-
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 	/*
 	 * Any fields below this point are the ones used by display.
 	 * They are temporarily added here so xe_device can be desguised as
@@ -308,6 +310,7 @@ struct xe_device {
 		const char *vbt_firmware;
 		u32 lvds_channel_mode;
 	} params;
+#endif
 };
 
 /**
-- 
2.39.0



More information about the Intel-xe mailing list