On Wed, May 29, 2024 at 08:48:10PM +0300, Jani Nikula wrote: > Include what you use. The dependencies on the headers, and what they > include, is a bit convoluted. Add xe compat gem/gem_object_types.h. Fix > all the places needed. it was indeed convoluted. Nice clean up here. Although it introduces a new compat header, at least it organize things better and clean up the main pain point of the compat headers... Reviewed-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_atomic_plane.c | 1 + > drivers/gpu/drm/i915/display/intel_display_types.h | 1 + > drivers/gpu/drm/i915/display/intel_fb.c | 1 + > drivers/gpu/drm/i915/display/intel_fbdev.c | 1 + > .../compat-i915-headers/gem/i915_gem_object_types.h | 11 +++++++++++ > drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 4 ---- > drivers/gpu/drm/xe/display/intel_fb_bo.c | 2 ++ > drivers/gpu/drm/xe/display/intel_fbdev_fb.c | 9 ++++----- > drivers/gpu/drm/xe/display/xe_fb_pin.c | 5 +++-- > drivers/gpu/drm/xe/display/xe_plane_initial.c | 1 + > 10 files changed, 25 insertions(+), 11 deletions(-) > create mode 100644 drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_types.h > > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c > index a2a827070c33..1143ba5b4f7c 100644 > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c > @@ -32,6 +32,7 @@ > */ > > #include <linux/dma-fence-chain.h> > +#include <linux/dma-resv.h> > > #include <drm/drm_atomic_helper.h> > #include <drm/drm_gem_atomic_helper.h> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > index 6fbfe8a18f45..4de86e299c91 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > @@ -47,6 +47,7 @@ > #include <drm/i915_hdcp_interface.h> > #include <media/cec-notifier.h> > > +#include "gem/i915_gem_object_types.h" /* for to_intel_bo() */ > #include "i915_vma.h" > #include "i915_vma_types.h" > #include "intel_bios.h" > diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c > index b6638726949d..8069abf91c5e 100644 > --- a/drivers/gpu/drm/i915/display/intel_fb.c > +++ b/drivers/gpu/drm/i915/display/intel_fb.c > @@ -9,6 +9,7 @@ > #include <linux/dma-fence.h> > #include <linux/dma-resv.h> > > +#include "gem/i915_gem_object.h" > #include "i915_drv.h" > #include "intel_display.h" > #include "intel_display_types.h" > diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c > index 5ad0b4c8a0fd..37ae176bfeb0 100644 > --- a/drivers/gpu/drm/i915/display/intel_fbdev.c > +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c > @@ -44,6 +44,7 @@ > #include <drm/drm_gem_framebuffer_helper.h> > > #include "gem/i915_gem_mman.h" > +#include "gem/i915_gem_object.h" > > #include "i915_drv.h" > #include "intel_display_types.h" > diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_types.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_types.h > new file mode 100644 > index 000000000000..7d6bb1abab73 > --- /dev/null > +++ b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_types.h > @@ -0,0 +1,11 @@ > +/* SPDX-License-Identifier: MIT */ > +/* Copyright © 2024 Intel Corporation */ > + > +#ifndef __I915_GEM_OBJECT_TYPES_H__ > +#define __I915_GEM_OBJECT_TYPES_H__ > + > +#include "xe_bo.h" > + > +#define to_intel_bo(x) gem_to_xe_bo((x)) > + > +#endif > diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h > index 3e930ce25c90..7b3f53427b03 100644 > --- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h > +++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h > @@ -12,11 +12,8 @@ > > #include <drm/drm_drv.h> > > -#include "gem/i915_gem_object.h" > - > #include "soc/intel_pch.h" > #include "xe_device.h" > -#include "xe_bo.h" > #include "xe_pm.h" > #include "i915_reg_defs.h" > #include "i915_utils.h" > @@ -113,7 +110,6 @@ static inline struct drm_i915_private *kdev_to_i915(struct device *kdev) > #define IS_RAPTORLAKE_U(xe) ((xe)->info.subplatform == XE_SUBPLATFORM_ALDERLAKE_P_RPLU) > #define IS_ICL_WITH_PORT_F(xe) (xe && 0) > #define HAS_FLAT_CCS(xe) (xe_device_has_flat_ccs(xe)) > -#define to_intel_bo(x) gem_to_xe_bo((x)) > > #define HAS_128_BYTE_Y_TILING(xe) (xe || 1) > > diff --git a/drivers/gpu/drm/xe/display/intel_fb_bo.c b/drivers/gpu/drm/xe/display/intel_fb_bo.c > index e18521acc516..b89cda053d2c 100644 > --- a/drivers/gpu/drm/xe/display/intel_fb_bo.c > +++ b/drivers/gpu/drm/xe/display/intel_fb_bo.c > @@ -4,10 +4,12 @@ > */ > > #include <drm/drm_modeset_helper.h> > +#include <drm/ttm/ttm_bo.h> > > #include "i915_drv.h" > #include "intel_display_types.h" > #include "intel_fb_bo.h" > +#include "xe_bo.h" > > void intel_fb_bo_framebuffer_fini(struct xe_bo *bo) > { > diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c > index f6bf5896ff1b..5ecc7d467934 100644 > --- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c > +++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c > @@ -3,15 +3,14 @@ > * Copyright © 2023 Intel Corporation > */ > > -#include "intel_fbdev_fb.h" > - > #include <drm/drm_fb_helper.h> > > -#include "xe_gt.h" > -#include "xe_ttm_stolen_mgr.h" > - > #include "i915_drv.h" > #include "intel_display_types.h" > +#include "intel_fbdev_fb.h" > +#include "xe_bo.h" > +#include "xe_gt.h" > +#include "xe_ttm_stolen_mgr.h" > > struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper, > struct drm_fb_helper_surface_size *sizes) > diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c > index 36e15c4961c1..0449cdb892f3 100644 > --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c > +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c > @@ -3,17 +3,18 @@ > * Copyright © 2021 Intel Corporation > */ > > +#include <drm/ttm/ttm_bo.h> > + > #include "i915_drv.h" > #include "intel_display_types.h" > #include "intel_dpt.h" > #include "intel_fb.h" > #include "intel_fb_pin.h" > +#include "xe_bo.h" > #include "xe_ggtt.h" > #include "xe_gt.h" > #include "xe_pm.h" > > -#include <drm/ttm/ttm_bo.h> > - > static void > write_dpt_rotated(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs, u32 bo_ofs, > u32 width, u32 height, u32 src_stride, u32 dst_stride) > diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c > index 9eaa29e733e1..7672a0cffbd8 100644 > --- a/drivers/gpu/drm/xe/display/xe_plane_initial.c > +++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c > @@ -18,6 +18,7 @@ > #include "intel_fb_pin.h" > #include "intel_frontbuffer.h" > #include "intel_plane_initial.h" > +#include "xe_bo.h" > > static bool > intel_reuse_initial_plane_obj(struct intel_crtc *this, > -- > 2.39.2 >