[Intel-xe] [PATCH 3/4] fixup! drm/i915/display: Remaining changes to make xe compile
Jouni Högander
jouni.hogander at intel.com
Mon May 15 09:46:13 UTC 2023
After reverting frontbuffer tracking removal our build is broken. Fix this
by adding some includes and ifdefs.
Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
drivers/gpu/drm/i915/display/intel_drrs.c | 1 +
drivers/gpu/drm/i915/display/intel_fb.c | 5 ++-
.../gpu/drm/i915/display/intel_frontbuffer.c | 43 +++++++++++++++----
.../gpu/drm/i915/display/intel_frontbuffer.h | 9 ++++
drivers/gpu/drm/i915/display/intel_psr.c | 1 +
.../drm/i915/display/skl_universal_plane.c | 1 +
6 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c
index 760e63cdc0c8..59527a4667f4 100644
--- a/drivers/gpu/drm/i915/display/intel_drrs.c
+++ b/drivers/gpu/drm/i915/display/intel_drrs.c
@@ -9,6 +9,7 @@
#include "intel_de.h"
#include "intel_display_types.h"
#include "intel_drrs.h"
+#include "intel_frontbuffer.h"
#include "intel_panel.h"
/**
diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index 953e3a4269b6..7856b6191cd8 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -13,6 +13,7 @@
#include "intel_display_types.h"
#include "intel_dpt.h"
#include "intel_fb.h"
+#include "intel_frontbuffer.h"
#ifdef I915
/*
@@ -1923,11 +1924,13 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
int i;
#ifdef I915
unsigned tiling, stride;
+#endif
intel_fb->frontbuffer = intel_frontbuffer_get(obj);
if (!intel_fb->frontbuffer)
return -ENOMEM;
+#ifdef I915
i915_gem_object_lock(obj, NULL);
tiling = i915_gem_object_get_tiling(obj);
stride = i915_gem_object_get_stride(obj);
@@ -1975,8 +1978,6 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
ttm_bo_unreserve(&obj->ttm);
#endif
- atomic_set(&intel_fb->bits, 0);
-
if (!drm_any_plane_has_format(&dev_priv->drm,
mode_cmd->pixel_format,
mode_cmd->modifier[0])) {
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index 17a7aa8b28c2..64fdc7880381 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -163,11 +163,17 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
}
+#ifdef I915
+#define intel_bo_to_i915(obj) to_i915((obj)->base.dev)
+#else
+#define intel_bo_to_i915(obj) to_i915((obj)->ttm.base.dev)
+#endif
+
void __intel_fb_invalidate(struct intel_frontbuffer *front,
enum fb_op_origin origin,
unsigned int frontbuffer_bits)
{
- struct drm_i915_private *i915 = to_i915(front->obj->base.dev);
+ struct drm_i915_private *i915 = intel_bo_to_i915(front->obj);
if (origin == ORIGIN_CS) {
spin_lock(&i915->display.fb_tracking.lock);
@@ -188,7 +194,7 @@ void __intel_fb_flush(struct intel_frontbuffer *front,
enum fb_op_origin origin,
unsigned int frontbuffer_bits)
{
- struct drm_i915_private *i915 = to_i915(front->obj->base.dev);
+ struct drm_i915_private *i915 = intel_bo_to_i915((front->obj));
if (origin == ORIGIN_CS) {
spin_lock(&i915->display.fb_tracking.lock);
@@ -202,6 +208,7 @@ void __intel_fb_flush(struct intel_frontbuffer *front,
frontbuffer_flush(i915, frontbuffer_bits, origin);
}
+#ifdef I915
static int frontbuffer_active(struct i915_active *ref)
{
struct intel_frontbuffer *front =
@@ -219,17 +226,21 @@ static void frontbuffer_retire(struct i915_active *ref)
intel_frontbuffer_flush(front, ORIGIN_CS);
intel_frontbuffer_put(front);
}
+#endif
static void frontbuffer_release(struct kref *ref)
- __releases(&to_i915(front->obj->base.dev)->display.fb_tracking.lock)
+ __releases(&intel_bo_to_i915(front->obj)->display.fb_tracking.lock)
{
struct intel_frontbuffer *front =
container_of(ref, typeof(*front), ref);
struct drm_i915_gem_object *obj = front->obj;
+#ifdef I915
struct i915_vma *vma;
+#endif
- drm_WARN_ON(obj->base.dev, atomic_read(&front->bits));
+ drm_WARN_ON(&intel_bo_to_i915(obj)->drm, atomic_read(&front->bits));
+#ifdef I915
spin_lock(&obj->vma.lock);
for_each_ggtt_vma(vma, obj) {
i915_vma_clear_scanout(vma);
@@ -238,23 +249,32 @@ static void frontbuffer_release(struct kref *ref)
spin_unlock(&obj->vma.lock);
RCU_INIT_POINTER(obj->frontbuffer, NULL);
- spin_unlock(&to_i915(obj->base.dev)->display.fb_tracking.lock);
+#endif
+ spin_unlock(&intel_bo_to_i915(obj)->display.fb_tracking.lock);
+#ifdef I915
i915_active_fini(&front->write);
i915_gem_object_put(obj);
+#else
+ xe_bo_get(obj);
+#endif
kfree_rcu(front, rcu);
}
struct intel_frontbuffer *
intel_frontbuffer_get(struct drm_i915_gem_object *obj)
{
- struct drm_i915_private *i915 = to_i915(obj->base.dev);
+#ifdef I915
+ struct drm_i915_private *i915 = intel_bo_to_i915(obj);
+#endif
struct intel_frontbuffer *front;
+#ifdef I915
front = __intel_frontbuffer_get(obj);
if (front)
return front;
+#endif
front = kmalloc(sizeof(*front), GFP_KERNEL);
if (!front)
@@ -263,6 +283,7 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj)
front->obj = obj;
kref_init(&front->ref);
atomic_set(&front->bits, 0);
+#ifdef I915
i915_active_init(&front->write,
frontbuffer_active,
frontbuffer_retire,
@@ -274,10 +295,14 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj)
front = rcu_dereference_protected(obj->frontbuffer, true);
kref_get(&front->ref);
} else {
+
i915_gem_object_get(obj);
rcu_assign_pointer(obj->frontbuffer, front);
}
spin_unlock(&i915->display.fb_tracking.lock);
+#else
+ xe_bo_get(obj);
+#endif
return front;
}
@@ -286,7 +311,7 @@ void intel_frontbuffer_put(struct intel_frontbuffer *front)
{
kref_put_lock(&front->ref,
frontbuffer_release,
- &to_i915(front->obj->base.dev)->display.fb_tracking.lock);
+ &intel_bo_to_i915(front->obj)->display.fb_tracking.lock);
}
/**
@@ -315,13 +340,13 @@ void intel_frontbuffer_track(struct intel_frontbuffer *old,
BUILD_BUG_ON(I915_MAX_PLANES > INTEL_FRONTBUFFER_BITS_PER_PIPE);
if (old) {
- drm_WARN_ON(old->obj->base.dev,
+ drm_WARN_ON(&intel_bo_to_i915(old->obj)->drm,
!(atomic_read(&old->bits) & frontbuffer_bits));
atomic_andnot(frontbuffer_bits, &old->bits);
}
if (new) {
- drm_WARN_ON(new->obj->base.dev,
+ drm_WARN_ON(&intel_bo_to_i915(old->obj)->drm,
atomic_read(&new->bits) & frontbuffer_bits);
atomic_or(frontbuffer_bits, &new->bits);
}
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.h b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
index 3c474ed937fb..be33bc2a84cd 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.h
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
@@ -28,7 +28,12 @@
#include <linux/bits.h>
#include <linux/kref.h>
+#ifdef I915
#include "gem/i915_gem_object_types.h"
+#else
+#include "xe_bo.h"
+#endif
+
#include "i915_active_types.h"
struct drm_i915_private;
@@ -44,7 +49,9 @@ enum fb_op_origin {
struct intel_frontbuffer {
struct kref ref;
atomic_t bits;
+#ifdef I915
struct i915_active write;
+#endif
struct drm_i915_gem_object *obj;
struct rcu_head rcu;
};
@@ -75,6 +82,7 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
void intel_frontbuffer_put(struct intel_frontbuffer *front);
+#ifdef I915
static inline struct intel_frontbuffer *
__intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
{
@@ -101,6 +109,7 @@ __intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
return front;
}
+#endif
struct intel_frontbuffer *
intel_frontbuffer_get(struct drm_i915_gem_object *obj);
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index ea0389c5f656..2ecc902a85a2 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -32,6 +32,7 @@
#include "intel_display_types.h"
#include "intel_dp.h"
#include "intel_dp_aux.h"
+#include "intel_frontbuffer.h"
#include "intel_hdmi.h"
#include "intel_psr.h"
#include "intel_psr_regs.h"
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 71ba544eda71..0f1e4e61d32e 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -16,6 +16,7 @@
#include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_fbc.h"
+#include "intel_frontbuffer.h"
#include "intel_psr.h"
#include "skl_scaler.h"
#include "skl_universal_plane.h"
--
2.34.1
More information about the Intel-xe
mailing list