The display code needs to deal with gem objects, and mostly uses struct
drm_i915_gem_object. That's not great, because for xe we need to
redefine it struct xe_bo during build.
Start a common interface using struct drm_gem_object, with separate
implementations for i915 and xe. For starters, convert i9xx_wm.c to use
it.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/df6867523a0b5fdd4eb63f657f545603ae6f6e0b.1726589119.git.jani.nikula@intel.com
 
        display/intel_atomic_plane.o \
        display/intel_audio.o \
        display/intel_bios.o \
+       display/intel_bo.o \
        display/intel_bw.o \
        display/intel_cdclk.o \
        display/intel_color.o \
 
 #include "i915_reg.h"
 #include "i9xx_wm.h"
 #include "intel_atomic.h"
+#include "intel_bo.h"
 #include "intel_display.h"
 #include "intel_display_trace.h"
 #include "intel_fb.h"
 
        crtc = single_enabled_crtc(dev_priv);
        if (IS_I915GM(dev_priv) && crtc) {
-               struct drm_i915_gem_object *obj;
+               struct drm_gem_object *obj;
 
-               obj = intel_fb_obj(crtc->base.primary->state->fb);
+               obj = intel_fb_bo(crtc->base.primary->state->fb);
 
                /* self-refresh seems busted with untiled */
-               if (!i915_gem_object_is_tiled(obj))
+               if (!intel_bo_is_tiled(obj))
                        crtc = NULL;
        }
 
 
--- /dev/null
+// SPDX-License-Identifier: MIT
+/* Copyright © 2024 Intel Corporation */
+
+#include "gem/i915_gem_object.h"
+#include "intel_bo.h"
+
+bool intel_bo_is_tiled(struct drm_gem_object *obj)
+{
+       return i915_gem_object_is_tiled(to_intel_bo(obj));
+}
 
--- /dev/null
+/* SPDX-License-Identifier: MIT */
+/* Copyright © 2024 Intel Corporation */
+
+#ifndef __INTEL_BO__
+#define __INTEL_BO__
+
+#include <linux/types.h>
+
+struct drm_gem_object;
+
+bool intel_bo_is_tiled(struct drm_gem_object *obj);
+
+#endif /* __INTEL_BO__ */
 
 {
        return fb ? to_intel_bo(fb->obj[0]) : NULL;
 }
+
+struct drm_gem_object *intel_fb_bo(const struct drm_framebuffer *fb)
+{
+       return fb ? fb->obj[0] : NULL;
+}
 
 struct drm_device;
 struct drm_file;
 struct drm_framebuffer;
+struct drm_gem_object;
 struct drm_i915_gem_object;
 struct drm_i915_private;
 struct drm_mode_fb_cmd2;
 
 struct drm_i915_gem_object *intel_fb_obj(const struct drm_framebuffer *fb);
 
+struct drm_gem_object *intel_fb_bo(const struct drm_framebuffer *fb);
+
 #endif /* __INTEL_FB_H__ */
 
 xe-$(CONFIG_DRM_XE_DISPLAY) += \
        display/ext/i915_irq.o \
        display/ext/i915_utils.o \
+       display/intel_bo.o \
        display/intel_fb_bo.o \
        display/intel_fbdev_fb.o \
        display/xe_display.o \
 
--- /dev/null
+// SPDX-License-Identifier: MIT
+/* Copyright © 2024 Intel Corporation */
+
+#include <drm/drm_gem.h>
+
+#include "intel_bo.h"
+
+bool intel_bo_is_tiled(struct drm_gem_object *obj)
+{
+       /* legacy tiling is unused */
+       return false;
+}