Skip to contentSkip to conversation

drm/xe/display: Do not use i915 frontbuffer tracking implementation

PATCH In review Maarten Lankhorst 6 participants 15 messages Mar 6, 2023 – Apr 27, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xe/display: Do not use i915 frontbuffer tracking implementation

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

---
 .../gpu/drm/i915/display/intel_display_types.h  | 12 ++++++++++++
 drivers/gpu/drm/i915/display/intel_drrs.c       |  1 +
 drivers/gpu/drm/i915/display/intel_fb.c         |  8 +++++---
 drivers/gpu/drm/i915/display/intel_fbdev.c      |  2 +-
 .../gpu/drm/i915/display/intel_frontbuffer.c    | 17 +++++++++++++----
 .../gpu/drm/i915/display/intel_frontbuffer.h    | 12 ++++++++++--
 drivers/gpu/drm/i915/display/intel_psr.c        |  1 +
 .../gpu/drm/i915/display/skl_universal_plane.c  |  2 ++
 8 files changed, 45 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +12 -0
index f2918bb07107..a4a57aa24422 100644
@@ -133,7 +133,11 @@ struct intel_fb_view {
 
 struct intel_framebuffer {
 	struct drm_framebuffer base;
+#ifdef I915
 	struct intel_frontbuffer *frontbuffer;
+#else
+	atomic_t bits;
+#endif
 
 	/* Params to remap the FB pages and program the plane registers in each view. */
 	struct intel_fb_view normal_view;
@@ -2074,10 +2078,18 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_
 #endif
 }
 
+#ifdef I915
 static inline struct intel_frontbuffer *
 to_intel_frontbuffer(struct drm_framebuffer *fb)
 {
 	return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
 }
+#else
+static inline struct intel_framebuffer *
+to_intel_frontbuffer(struct drm_framebuffer *fb)
+{
+	return fb ? to_intel_framebuffer(fb) : NULL;
+}
+#endif
 
 #endif /*  __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_drrs.c +1 -0
index 5b9e44443814..3503d112387d 100644
@@ -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"
 
 /**
drivers/gpu/drm/i915/display/intel_fb.c +5 -3
index 8c357a4098f6..e67c71f9b29d 100644
@@ -1846,6 +1846,8 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 #ifdef I915
 	if (intel_fb_uses_dpt(fb))
 		intel_dpt_destroy(intel_fb->dpt_vm);
+
+	intel_frontbuffer_put(intel_fb->frontbuffer);
 #else
 	if (intel_fb_obj(fb)->flags & XE_BO_CREATE_PINNED_BIT) {
 		struct xe_bo *bo = intel_fb_obj(fb);
@@ -1857,8 +1859,6 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	}
 #endif
 
-	intel_frontbuffer_put(intel_fb->frontbuffer);
-
 	kfree(intel_fb);
 }
 
@@ -1966,9 +1966,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 		obj->flags |= XE_BO_SCANOUT_BIT;
 	}
 	ttm_bo_unreserve(&obj->ttm);
-#endif
 
 	atomic_set(&intel_fb->bits, 0);
+#endif
 
 	if (!drm_any_plane_has_format(&dev_priv->drm,
 				      mode_cmd->pixel_format,
@@ -2085,7 +2085,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 	return 0;
 
 err:
+#ifdef I915
 	intel_frontbuffer_put(intel_fb->frontbuffer);
+#endif
 	return ret;
 }
 
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -1
index 75d8029185f0..2682b26b511f 100644
@@ -82,7 +82,7 @@ struct intel_fbdev {
 
 static struct intel_frontbuffer *to_frontbuffer(struct intel_fbdev *ifbdev)
 {
-	return ifbdev->fb->frontbuffer;
+	return to_intel_frontbuffer(&ifbdev->fb->base);
 }
 
 static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
drivers/gpu/drm/i915/display/intel_frontbuffer.c +13 -4
index 17a7aa8b28c2..64fe73d2ac4d 100644
@@ -163,11 +163,17 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
 	frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
 }
 
+#ifdef I915
+#define intel_front_obj(front) ((front)->obj)
+#else
+#define intel_front_obj(front) (front)
+#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 = to_i915(intel_front_obj(front)->base.dev);
 
 	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 = to_i915(intel_front_obj(front)->base.dev);
 
 	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 =
@@ -289,6 +296,8 @@ void intel_frontbuffer_put(struct intel_frontbuffer *front)
 		      &to_i915(front->obj->base.dev)->display.fb_tracking.lock);
 }
 
+#endif
+
 /**
  * intel_frontbuffer_track - update frontbuffer tracking
  * @old: current buffer for the frontbuffer slots
@@ -315,13 +324,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_front_obj(old)->base.dev,
 			    !(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_front_obj(new)->base.dev,
 			    atomic_read(&new->bits) & frontbuffer_bits);
 		atomic_or(frontbuffer_bits, &new->bits);
 	}
drivers/gpu/drm/i915/display/intel_frontbuffer.h +10 -2
index 3c474ed937fb..a79e5ca419ec 100644
@@ -28,8 +28,6 @@
 #include <linux/bits.h>
 #include <linux/kref.h>
 
-#include "gem/i915_gem_object_types.h"
-#include "i915_active_types.h"
 
 struct drm_i915_private;
 
@@ -41,6 +39,10 @@ enum fb_op_origin {
 	ORIGIN_CURSOR_UPDATE,
 };
 
+#ifdef I915
+#include "gem/i915_gem_object_types.h"
+#include "i915_active_types.h"
+
 struct intel_frontbuffer {
 	struct kref ref;
 	atomic_t bits;
@@ -48,6 +50,9 @@ struct intel_frontbuffer {
 	struct drm_i915_gem_object *obj;
 	struct rcu_head rcu;
 };
+#else
+#define intel_frontbuffer intel_framebuffer
+#endif
 
 /*
  * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
@@ -73,6 +78,7 @@ void intel_frontbuffer_flip_complete(struct drm_i915_private *i915,
 void intel_frontbuffer_flip(struct drm_i915_private *i915,
 			    unsigned frontbuffer_bits);
 
+#ifdef I915
 void intel_frontbuffer_put(struct intel_frontbuffer *front);
 
 static inline struct intel_frontbuffer *
@@ -105,6 +111,8 @@ __intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
 struct intel_frontbuffer *
 intel_frontbuffer_get(struct drm_i915_gem_object *obj);
 
+#endif
+
 void __intel_fb_invalidate(struct intel_frontbuffer *front,
 			   enum fb_op_origin origin,
 			   unsigned int frontbuffer_bits);
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index 9820e5fdd087..bc998b526d88 100644
@@ -33,6 +33,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp_aux.h"
+#include "intel_frontbuffer.h"
 #include "intel_hdmi.h"
 #include "intel_psr.h"
 #include "intel_snps_phy.h"
drivers/gpu/drm/i915/display/skl_universal_plane.c +2 -0
index 38f70f27ff1b..86d022e195c7 100644
@@ -16,11 +16,13 @@
 #include "intel_display_types.h"
 #include "intel_fb.h"
 #include "intel_fbc.h"
+#include "intel_frontbuffer.h"
 #include "intel_psr.h"
 #include "intel_sprite.h"
 #include "skl_scaler.h"
 #include "skl_universal_plane.h"
 #include "skl_watermark.h"
+
 #ifdef I915
 #include "pxp/intel_pxp.h"
 #else
Signature · 1 line
2.34.1
#1 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe/display: Do not use i915 frontbuffer tracking implementation

== Series Details ==

== Series Details ==

Series: drm/xe/display: Do not use i915 frontbuffer tracking implementation
URL : https://patchwork.freedesktop.org/series/114712/
State : failure

== Summary ==

error: patch failed: drivers/gpu/drm/i915/display/intel_display_types.h:133
error: drivers/gpu/drm/i915/display/intel_display_types.h: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/intel_drrs.c:9
error: drivers/gpu/drm/i915/display/intel_drrs.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/intel_fb.c:1857
error: drivers/gpu/drm/i915/display/intel_fb.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/intel_fbdev.c:82
error: drivers/gpu/drm/i915/display/intel_fbdev.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/intel_frontbuffer.c:163
error: drivers/gpu/drm/i915/display/intel_frontbuffer.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/intel_frontbuffer.h:28
error: drivers/gpu/drm/i915/display/intel_frontbuffer.h: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/intel_psr.c:33
error: drivers/gpu/drm/i915/display/intel_psr.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/display/skl_universal_plane.c:16
error: drivers/gpu/drm/i915/display/skl_universal_plane.c: patch does not apply

#2 lore raw
In reply to Maarten Lankhorst
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

Quoted 262 lines
---
 .../gpu/drm/i915/display/intel_display_types.h  | 12 ++++++++++++
 drivers/gpu/drm/i915/display/intel_drrs.c       |  1 +
 drivers/gpu/drm/i915/display/intel_fb.c         |  8 +++++---
 drivers/gpu/drm/i915/display/intel_fbdev.c      |  2 +-
 .../gpu/drm/i915/display/intel_frontbuffer.c    | 17 +++++++++++++----
 .../gpu/drm/i915/display/intel_frontbuffer.h    | 12 ++++++++++--
 drivers/gpu/drm/i915/display/intel_psr.c        |  1 +
 .../gpu/drm/i915/display/skl_universal_plane.c  |  2 ++
 8 files changed, 45 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +12 -0
index f2918bb07107..a4a57aa24422 100644
@@ -133,7 +133,11 @@ struct intel_fb_view {
 
 struct intel_framebuffer {
 	struct drm_framebuffer base;
+#ifdef I915
 	struct intel_frontbuffer *frontbuffer;
+#else
+	atomic_t bits;
+#endif
 
 	/* Params to remap the FB pages and program the plane registers in each view. */
 	struct intel_fb_view normal_view;
@@ -2074,10 +2078,18 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_
 #endif
 }
 
+#ifdef I915
 static inline struct intel_frontbuffer *
 to_intel_frontbuffer(struct drm_framebuffer *fb)
 {
 	return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
 }
+#else
+static inline struct intel_framebuffer *
+to_intel_frontbuffer(struct drm_framebuffer *fb)
+{
+	return fb ? to_intel_framebuffer(fb) : NULL;
+}
+#endif
 
 #endif /*  __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_drrs.c +1 -0
index 5b9e44443814..3503d112387d 100644
@@ -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"
 
 /**
drivers/gpu/drm/i915/display/intel_fb.c +5 -3
index 8c357a4098f6..e67c71f9b29d 100644
@@ -1846,6 +1846,8 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 #ifdef I915
 	if (intel_fb_uses_dpt(fb))
 		intel_dpt_destroy(intel_fb->dpt_vm);
+
+	intel_frontbuffer_put(intel_fb->frontbuffer);
 #else
 	if (intel_fb_obj(fb)->flags & XE_BO_CREATE_PINNED_BIT) {
 		struct xe_bo *bo = intel_fb_obj(fb);
@@ -1857,8 +1859,6 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	}
 #endif
 
-	intel_frontbuffer_put(intel_fb->frontbuffer);
-
 	kfree(intel_fb);
 }
 
@@ -1966,9 +1966,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 		obj->flags |= XE_BO_SCANOUT_BIT;
 	}
 	ttm_bo_unreserve(&obj->ttm);
-#endif
 
 	atomic_set(&intel_fb->bits, 0);
+#endif
 
 	if (!drm_any_plane_has_format(&dev_priv->drm,
 				      mode_cmd->pixel_format,
@@ -2085,7 +2085,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 	return 0;
 
 err:
+#ifdef I915
 	intel_frontbuffer_put(intel_fb->frontbuffer);
+#endif
 	return ret;
 }
 
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -1
index 75d8029185f0..2682b26b511f 100644
@@ -82,7 +82,7 @@ struct intel_fbdev {
 
 static struct intel_frontbuffer *to_frontbuffer(struct intel_fbdev *ifbdev)
 {
-	return ifbdev->fb->frontbuffer;
+	return to_intel_frontbuffer(&ifbdev->fb->base);
 }
 
 static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
drivers/gpu/drm/i915/display/intel_frontbuffer.c +13 -4
index 17a7aa8b28c2..64fe73d2ac4d 100644
@@ -163,11 +163,17 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
 	frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
 }
 
+#ifdef I915
+#define intel_front_obj(front) ((front)->obj)
+#else
+#define intel_front_obj(front) (front)
+#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 = to_i915(intel_front_obj(front)->base.dev);
 
 	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 = to_i915(intel_front_obj(front)->base.dev);
 
 	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 =
@@ -289,6 +296,8 @@ void intel_frontbuffer_put(struct intel_frontbuffer *front)
 		      &to_i915(front->obj->base.dev)->display.fb_tracking.lock);
 }
 
+#endif
+
 /**
  * intel_frontbuffer_track - update frontbuffer tracking
  * @old: current buffer for the frontbuffer slots
@@ -315,13 +324,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_front_obj(old)->base.dev,
 			    !(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_front_obj(new)->base.dev,
 			    atomic_read(&new->bits) & frontbuffer_bits);
 		atomic_or(frontbuffer_bits, &new->bits);
 	}
drivers/gpu/drm/i915/display/intel_frontbuffer.h +10 -2
index 3c474ed937fb..a79e5ca419ec 100644
@@ -28,8 +28,6 @@
 #include <linux/bits.h>
 #include <linux/kref.h>
 
-#include "gem/i915_gem_object_types.h"
-#include "i915_active_types.h"
 
 struct drm_i915_private;
 
@@ -41,6 +39,10 @@ enum fb_op_origin {
 	ORIGIN_CURSOR_UPDATE,
 };
 
+#ifdef I915
+#include "gem/i915_gem_object_types.h"
+#include "i915_active_types.h"
+
 struct intel_frontbuffer {
 	struct kref ref;
 	atomic_t bits;
@@ -48,6 +50,9 @@ struct intel_frontbuffer {
 	struct drm_i915_gem_object *obj;
 	struct rcu_head rcu;
 };
+#else
+#define intel_frontbuffer intel_framebuffer
+#endif
 
 /*
  * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
@@ -73,6 +78,7 @@ void intel_frontbuffer_flip_complete(struct drm_i915_private *i915,
 void intel_frontbuffer_flip(struct drm_i915_private *i915,
 			    unsigned frontbuffer_bits);
 
+#ifdef I915
 void intel_frontbuffer_put(struct intel_frontbuffer *front);
 
 static inline struct intel_frontbuffer *
@@ -105,6 +111,8 @@ __intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
 struct intel_frontbuffer *
 intel_frontbuffer_get(struct drm_i915_gem_object *obj);
 
+#endif
+
 void __intel_fb_invalidate(struct intel_frontbuffer *front,
 			   enum fb_op_origin origin,
 			   unsigned int frontbuffer_bits);
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index 9820e5fdd087..bc998b526d88 100644
@@ -33,6 +33,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp_aux.h"
+#include "intel_frontbuffer.h"
 #include "intel_hdmi.h"
 #include "intel_psr.h"
 #include "intel_snps_phy.h"
drivers/gpu/drm/i915/display/skl_universal_plane.c +2 -0
index 38f70f27ff1b..86d022e195c7 100644
@@ -16,11 +16,13 @@
 #include "intel_display_types.h"
 #include "intel_fb.h"
 #include "intel_fbc.h"
+#include "intel_frontbuffer.h"
 #include "intel_psr.h"
 #include "intel_sprite.h"
 #include "skl_scaler.h"
 #include "skl_universal_plane.h"
 #include "skl_watermark.h"
+
 #ifdef I915
 #include "pxp/intel_pxp.h"
 #else
maintainer
#3 lore raw
Quoted 10 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

I'm afraid we cannot have this solution then. We will need FBC and PSR. Should we then add a new IOCTL where userspace can request the PSR/FBC, and then commit to always use the drity_fb calls on any frontbuffer update?

Quoted 264 lines
Quoted 263 lines
---
 .../gpu/drm/i915/display/intel_display_types.h  | 12 ++++++++++++
 drivers/gpu/drm/i915/display/intel_drrs.c       |  1 +
 drivers/gpu/drm/i915/display/intel_fb.c         |  8 +++++---
 drivers/gpu/drm/i915/display/intel_fbdev.c      |  2 +-
 .../gpu/drm/i915/display/intel_frontbuffer.c    | 17 +++++++++++++----
 .../gpu/drm/i915/display/intel_frontbuffer.h    | 12 ++++++++++--
 drivers/gpu/drm/i915/display/intel_psr.c        |  1 +
 .../gpu/drm/i915/display/skl_universal_plane.c  |  2 ++
 8 files changed, 45 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +12 -0
index f2918bb07107..a4a57aa24422 100644
@@ -133,7 +133,11 @@ struct intel_fb_view {
 
 struct intel_framebuffer {
 	struct drm_framebuffer base;
+#ifdef I915
 	struct intel_frontbuffer *frontbuffer;
+#else
+	atomic_t bits;
+#endif
 
 	/* Params to remap the FB pages and program the plane registers in each view. */
 	struct intel_fb_view normal_view;
@@ -2074,10 +2078,18 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_
 #endif
 }
 
+#ifdef I915
 static inline struct intel_frontbuffer *
 to_intel_frontbuffer(struct drm_framebuffer *fb)
 {
 	return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
 }
+#else
+static inline struct intel_framebuffer *
+to_intel_frontbuffer(struct drm_framebuffer *fb)
+{
+	return fb ? to_intel_framebuffer(fb) : NULL;
+}
+#endif
 
 #endif /*  __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_drrs.c +1 -0
index 5b9e44443814..3503d112387d 100644
@@ -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"
 
 /**
drivers/gpu/drm/i915/display/intel_fb.c +5 -3
index 8c357a4098f6..e67c71f9b29d 100644
@@ -1846,6 +1846,8 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 #ifdef I915
 	if (intel_fb_uses_dpt(fb))
 		intel_dpt_destroy(intel_fb->dpt_vm);
+
+	intel_frontbuffer_put(intel_fb->frontbuffer);
 #else
 	if (intel_fb_obj(fb)->flags & XE_BO_CREATE_PINNED_BIT) {
 		struct xe_bo *bo = intel_fb_obj(fb);
@@ -1857,8 +1859,6 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	}
 #endif
 
-	intel_frontbuffer_put(intel_fb->frontbuffer);
-
 	kfree(intel_fb);
 }
 
@@ -1966,9 +1966,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 		obj->flags |= XE_BO_SCANOUT_BIT;
 	}
 	ttm_bo_unreserve(&obj->ttm);
-#endif
 
 	atomic_set(&intel_fb->bits, 0);
+#endif
 
 	if (!drm_any_plane_has_format(&dev_priv->drm,
 				      mode_cmd->pixel_format,
@@ -2085,7 +2085,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 	return 0;
 
 err:
+#ifdef I915
 	intel_frontbuffer_put(intel_fb->frontbuffer);
+#endif
 	return ret;
 }
 
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -1
index 75d8029185f0..2682b26b511f 100644
@@ -82,7 +82,7 @@ struct intel_fbdev {
 
 static struct intel_frontbuffer *to_frontbuffer(struct intel_fbdev *ifbdev)
 {
-	return ifbdev->fb->frontbuffer;
+	return to_intel_frontbuffer(&ifbdev->fb->base);
 }
 
 static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
drivers/gpu/drm/i915/display/intel_frontbuffer.c +13 -4
index 17a7aa8b28c2..64fe73d2ac4d 100644
@@ -163,11 +163,17 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
 	frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
 }
 
+#ifdef I915
+#define intel_front_obj(front) ((front)->obj)
+#else
+#define intel_front_obj(front) (front)
+#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 = to_i915(intel_front_obj(front)->base.dev);
 
 	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 = to_i915(intel_front_obj(front)->base.dev);
 
 	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 =
@@ -289,6 +296,8 @@ void intel_frontbuffer_put(struct intel_frontbuffer *front)
 		      &to_i915(front->obj->base.dev)->display.fb_tracking.lock);
 }
 
+#endif
+
 /**
  * intel_frontbuffer_track - update frontbuffer tracking
  * @old: current buffer for the frontbuffer slots
@@ -315,13 +324,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_front_obj(old)->base.dev,
 			    !(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_front_obj(new)->base.dev,
 			    atomic_read(&new->bits) & frontbuffer_bits);
 		atomic_or(frontbuffer_bits, &new->bits);
 	}
drivers/gpu/drm/i915/display/intel_frontbuffer.h +10 -2
index 3c474ed937fb..a79e5ca419ec 100644
@@ -28,8 +28,6 @@
 #include <linux/bits.h>
 #include <linux/kref.h>
 
-#include "gem/i915_gem_object_types.h"
-#include "i915_active_types.h"
 
 struct drm_i915_private;
 
@@ -41,6 +39,10 @@ enum fb_op_origin {
 	ORIGIN_CURSOR_UPDATE,
 };
 
+#ifdef I915
+#include "gem/i915_gem_object_types.h"
+#include "i915_active_types.h"
+
 struct intel_frontbuffer {
 	struct kref ref;
 	atomic_t bits;
@@ -48,6 +50,9 @@ struct intel_frontbuffer {
 	struct drm_i915_gem_object *obj;
 	struct rcu_head rcu;
 };
+#else
+#define intel_frontbuffer intel_framebuffer
+#endif
 
 /*
  * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
@@ -73,6 +78,7 @@ void intel_frontbuffer_flip_complete(struct drm_i915_private *i915,
 void intel_frontbuffer_flip(struct drm_i915_private *i915,
 			    unsigned frontbuffer_bits);
 
+#ifdef I915
 void intel_frontbuffer_put(struct intel_frontbuffer *front);
 
 static inline struct intel_frontbuffer *
@@ -105,6 +111,8 @@ __intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
 struct intel_frontbuffer *
 intel_frontbuffer_get(struct drm_i915_gem_object *obj);
 
+#endif
+
 void __intel_fb_invalidate(struct intel_frontbuffer *front,
 			   enum fb_op_origin origin,
 			   unsigned int frontbuffer_bits);
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index 9820e5fdd087..bc998b526d88 100644
@@ -33,6 +33,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dp_aux.h"
+#include "intel_frontbuffer.h"
 #include "intel_hdmi.h"
 #include "intel_psr.h"
 #include "intel_snps_phy.h"
drivers/gpu/drm/i915/display/skl_universal_plane.c +2 -0
index 38f70f27ff1b..86d022e195c7 100644
@@ -16,11 +16,13 @@
 #include "intel_display_types.h"
 #include "intel_fb.h"
 #include "intel_fbc.h"
+#include "intel_frontbuffer.h"
 #include "intel_psr.h"
 #include "intel_sprite.h"
 #include "skl_scaler.h"
 #include "skl_universal_plane.h"
 #include "skl_watermark.h"
+
 #ifdef I915
 #include "pxp/intel_pxp.h"
 #else
#4 lore raw
In reply to Souza, Jose

Hey,

Quoted 9 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue to work, as I validated on my laptop with FBC.

Quoted 261 lines
Quoted 261 lines
---
  .../gpu/drm/i915/display/intel_display_types.h  | 12 ++++++++++++
  drivers/gpu/drm/i915/display/intel_drrs.c       |  1 +
  drivers/gpu/drm/i915/display/intel_fb.c         |  8 +++++---
  drivers/gpu/drm/i915/display/intel_fbdev.c      |  2 +-
  .../gpu/drm/i915/display/intel_frontbuffer.c    | 17 +++++++++++++----
  .../gpu/drm/i915/display/intel_frontbuffer.h    | 12 ++++++++++--
  drivers/gpu/drm/i915/display/intel_psr.c        |  1 +
  .../gpu/drm/i915/display/skl_universal_plane.c  |  2 ++
  8 files changed, 45 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +12 -0
index f2918bb07107..a4a57aa24422 100644
@@ -133,7 +133,11 @@ struct intel_fb_view {
 
  struct intel_framebuffer {
  	struct drm_framebuffer base;
+#ifdef I915
  	struct intel_frontbuffer *frontbuffer;
+#else
+	atomic_t bits;
+#endif
 
  	/* Params to remap the FB pages and program the plane registers in each view. */
  	struct intel_fb_view normal_view;
@@ -2074,10 +2078,18 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_
  #endif
  }
 
+#ifdef I915
  static inline struct intel_frontbuffer *
  to_intel_frontbuffer(struct drm_framebuffer *fb)
  {
  	return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
  }
+#else
+static inline struct intel_framebuffer *
+to_intel_frontbuffer(struct drm_framebuffer *fb)
+{
+	return fb ? to_intel_framebuffer(fb) : NULL;
+}
+#endif
 
  #endif /*  __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_drrs.c +1 -0
index 5b9e44443814..3503d112387d 100644
@@ -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"
 
  /**
drivers/gpu/drm/i915/display/intel_fb.c +5 -3
index 8c357a4098f6..e67c71f9b29d 100644
@@ -1846,6 +1846,8 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
  #ifdef I915
  	if (intel_fb_uses_dpt(fb))
  		intel_dpt_destroy(intel_fb->dpt_vm);
+
+	intel_frontbuffer_put(intel_fb->frontbuffer);
  #else
  	if (intel_fb_obj(fb)->flags & XE_BO_CREATE_PINNED_BIT) {
  		struct xe_bo *bo = intel_fb_obj(fb);
@@ -1857,8 +1859,6 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
  	}
  #endif
 
-	intel_frontbuffer_put(intel_fb->frontbuffer);
-
  	kfree(intel_fb);
  }
 
@@ -1966,9 +1966,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
  		obj->flags |= XE_BO_SCANOUT_BIT;
  	}
  	ttm_bo_unreserve(&obj->ttm);
-#endif
 
  	atomic_set(&intel_fb->bits, 0);
+#endif
 
  	if (!drm_any_plane_has_format(&dev_priv->drm,
  				      mode_cmd->pixel_format,
@@ -2085,7 +2085,9 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
  	return 0;
 
  err:
+#ifdef I915
  	intel_frontbuffer_put(intel_fb->frontbuffer);
+#endif
  	return ret;
  }
 
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -1
index 75d8029185f0..2682b26b511f 100644
@@ -82,7 +82,7 @@ struct intel_fbdev {
 
  static struct intel_frontbuffer *to_frontbuffer(struct intel_fbdev *ifbdev)
  {
-	return ifbdev->fb->frontbuffer;
+	return to_intel_frontbuffer(&ifbdev->fb->base);
  }
 
  static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
drivers/gpu/drm/i915/display/intel_frontbuffer.c +13 -4
index 17a7aa8b28c2..64fe73d2ac4d 100644
@@ -163,11 +163,17 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
  	frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
  }
 
+#ifdef I915
+#define intel_front_obj(front) ((front)->obj)
+#else
+#define intel_front_obj(front) (front)
+#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 = to_i915(intel_front_obj(front)->base.dev);
 
  	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 = to_i915(intel_front_obj(front)->base.dev);
 
  	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 =
@@ -289,6 +296,8 @@ void intel_frontbuffer_put(struct intel_frontbuffer *front)
  		      &to_i915(front->obj->base.dev)->display.fb_tracking.lock);
  }
 
+#endif
+
  /**
   * intel_frontbuffer_track - update frontbuffer tracking
   * @old: current buffer for the frontbuffer slots
@@ -315,13 +324,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_front_obj(old)->base.dev,
  			    !(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_front_obj(new)->base.dev,
  			    atomic_read(&new->bits) & frontbuffer_bits);
  		atomic_or(frontbuffer_bits, &new->bits);
  	}
drivers/gpu/drm/i915/display/intel_frontbuffer.h +10 -2
index 3c474ed937fb..a79e5ca419ec 100644
@@ -28,8 +28,6 @@
  #include <linux/bits.h>
  #include <linux/kref.h>
 
-#include "gem/i915_gem_object_types.h"
-#include "i915_active_types.h"
 
  struct drm_i915_private;
 
@@ -41,6 +39,10 @@ enum fb_op_origin {
  	ORIGIN_CURSOR_UPDATE,
  };
 
+#ifdef I915
+#include "gem/i915_gem_object_types.h"
+#include "i915_active_types.h"
+
  struct intel_frontbuffer {
  	struct kref ref;
  	atomic_t bits;
@@ -48,6 +50,9 @@ struct intel_frontbuffer {
  	struct drm_i915_gem_object *obj;
  	struct rcu_head rcu;
  };
+#else
+#define intel_frontbuffer intel_framebuffer
+#endif
 
  /*
   * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
@@ -73,6 +78,7 @@ void intel_frontbuffer_flip_complete(struct drm_i915_private *i915,
  void intel_frontbuffer_flip(struct drm_i915_private *i915,
  			    unsigned frontbuffer_bits);
 
+#ifdef I915
  void intel_frontbuffer_put(struct intel_frontbuffer *front);
 
  static inline struct intel_frontbuffer *
@@ -105,6 +111,8 @@ __intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
  struct intel_frontbuffer *
  intel_frontbuffer_get(struct drm_i915_gem_object *obj);
 
+#endif
+
  void __intel_fb_invalidate(struct intel_frontbuffer *front,
  			   enum fb_op_origin origin,
  			   unsigned int frontbuffer_bits);
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index 9820e5fdd087..bc998b526d88 100644
@@ -33,6 +33,7 @@
  #include "intel_de.h"
  #include "intel_display_types.h"
  #include "intel_dp_aux.h"
+#include "intel_frontbuffer.h"
  #include "intel_hdmi.h"
  #include "intel_psr.h"
  #include "intel_snps_phy.h"
drivers/gpu/drm/i915/display/skl_universal_plane.c +2 -0
index 38f70f27ff1b..86d022e195c7 100644
@@ -16,11 +16,13 @@
  #include "intel_display_types.h"
  #include "intel_fb.h"
  #include "intel_fbc.h"
+#include "intel_frontbuffer.h"
  #include "intel_psr.h"
  #include "intel_sprite.h"
  #include "skl_scaler.h"
  #include "skl_universal_plane.h"
  #include "skl_watermark.h"
+
  #ifdef I915
  #include "pxp/intel_pxp.h"
  #else
#5 lore raw
Quoted 10 lines · Maarten Lankhorst

Hey,

Quoted 7 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Quoted 8 lines
Quoted 2 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

Signature · 2 lines
Ville Syrjälä
Intel
#6 lore raw
Quoted 36 lines · Ville Syrjälä
Quoted 10 lines · Maarten Lankhorst

Hey,

Quoted 7 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Quoted 7 lines
Quoted 2 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

Quoted 2 lines

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

This test doesn't make sense. DirtyFB should simply not return before execbuffer finishes.

~Maarten

#7 lore raw
Quoted 38 lines · Maarten Lankhorst
Quoted 36 lines · Ville Syrjälä
Quoted 10 lines · Maarten Lankhorst

Hey,

Quoted 7 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Quoted 7 lines
Quoted 2 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

Quoted 5 lines
Quoted 2 lines

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

This test doesn't make sense. DirtyFB should simply not return before execbuffer finishes.

Of course it should. It's not a blocking ioctl, and can't be because that will make X unusable.

Signature · 2 lines
Ville Syrjälä
Intel
#8 lore raw

Hey,

Quoted 38 lines · Ville Syrjälä
Quoted 37 lines · Maarten Lankhorst
Quoted 36 lines · Ville Syrjälä
Quoted 10 lines · Maarten Lankhorst

Hey,

Quoted 7 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Quoted 7 lines
Quoted 2 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

This test doesn't make sense. DirtyFB should simply not return before execbuffer finishes.

Of course it should. It's not a blocking ioctl, and can't be because that will make X unusable.

Except it actually is.

DirtyFB blocks in its default implementation, and waits for the next vblank.

drm_atomic_helper_dirtyfb() blocks by default as it's a synchronous plane update.

Considering every driver except i915 uses it, it works just fine. :)

~Maarten

#9 lore raw
Quoted 49 lines · Maarten Lankhorst

Hey,

Quoted 38 lines · Ville Syrjälä
Quoted 37 lines · Maarten Lankhorst
Quoted 36 lines · Ville Syrjälä
Quoted 10 lines · Maarten Lankhorst

Hey,

Quoted 7 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can keep doing the weird intel_frontbuffer + i915_active thing without blocking Xe.

Quoted 7 lines
Quoted 2 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features. Without frontbuffer tracker those two features will break in some cases.

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

This test doesn't make sense. DirtyFB should simply not return before execbuffer finishes.

Of course it should. It's not a blocking ioctl, and can't be because that will make X unusable.

Quoted 8 lines

Except it actually is.

DirtyFB blocks in its default implementation, and waits for the next vblank.

drm_atomic_helper_dirtyfb() blocks by default as it's a synchronous plane update.

Considering every driver except i915 uses it, it works just fine. :)

No it doesn't. We tries to use it, but that was an utter failure.

Signature · 2 lines
Ville Syrjälä
Intel
#10 lore raw
In reply to Ville Syrjälä
Quoted 45 lines · Ville Syrjälä
Quoted 19 lines · Maarten Lankhorst

Hey,

Quoted 11 lines · Jose
Quoted 10 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow
i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can
keep doing the weird intel_frontbuffer + i915_active thing without
blocking Xe.

Quoted 4 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features.
Without frontbuffer tracker those two features will break in some cases.

Quoted 6 lines

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue
to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

Quoted 3 lines

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

CRC calculation doesn't work with PSR currently. PSR is disabled if CRC capture is requested.

Are we supposed to support frontbuffer rendering using GPU?

BR,

Jouni Högander

#11 lore raw
Quoted 44 lines · Jouni
Quoted 43 lines · Ville Syrjälä
Quoted 18 lines · Maarten Lankhorst

Hey,

Quoted 11 lines · Jose
Quoted 10 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow
i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can
keep doing the weird intel_frontbuffer + i915_active thing without
blocking Xe.

Quoted 4 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features.
Without frontbuffer tracker those two features will break in some cases.

Quoted 6 lines

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue
to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

Quoted 7 lines
Quoted 3 lines

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

CRC calculation doesn't work with PSR currently. PSR is disabled if CRC capture is requested.

Are we supposed to support frontbuffer rendering using GPU?

No other driver does that. It's fine if DirtyFB hangs instead until the job it waits on completes.

~Maarten

#12 lore raw
Quoted 49 lines · Maarten Lankhorst
Quoted 47 lines · Jouni
Quoted 46 lines · Ville Syrjälä
Quoted 18 lines · Maarten Lankhorst

Hey,

Quoted 11 lines · Jose
Quoted 10 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow
i915 to keep its own implementation, and do the right thing in Xe.

The frontbuffer tracking for Xe is still done per-fb, while i915 can
keep doing the weird intel_frontbuffer + i915_active thing without
blocking Xe.

Quoted 4 lines

Please also disable PSR and FBC with this or at least add a way for users to disable those features.
Without frontbuffer tracker those two features will break in some cases.

Quoted 6 lines

FBC and PSR work completely as expected. I don't remove frontbuffer tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB continue
to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

Quoted 6 lines
Quoted 4 lines

CRC calculation doesn't work with PSR currently. PSR is disabled if CRC capture is requested.

Are we supposed to support frontbuffer rendering using GPU?

No other driver does that.

Every driver does that when you run X w/o a compositor. Assuming there is an actual GPU in there.

Quoted 2 lines

It's fine if DirtyFB hangs instead until the
job it waits on completes.

No one tried to make it just wait for the fence(s) w/o doing a full blown atomic commit. It might work, but might also still suck too much. I guess depends on how overloaded the GPU is.

What we could do is do a frontbuffer invalidate on dirtyfb invocation, and then once the fence(s) signal we do a frontbuffer flush. That would most closely match the gem hook behaviour, except the invalidate comes in a bit later. The alternative would be to skip the invalidate, which should still guarantee correctness in the end, just with possibly jankier interactivity.

Signature · 2 lines
Ville Syrjälä
Intel
#13 lore raw
Quoted 78 lines · Ville Syrjälä
Quoted 58 lines · Maarten Lankhorst
Quoted 56 lines · Jouni
Quoted 55 lines · Ville Syrjälä
Quoted 23 lines · Maarten Lankhorst

Hey,

Quoted 14 lines · Jose
Quoted 6 lines · Maarten Lankhorst

As a fallback if we decide not to merge the frontbuffer tracking, allow
i915 to keep its own implementation, and do the right thing in
Xe.

Quoted 7 lines

The frontbuffer tracking for Xe is still done per-fb, while
i915 can
keep doing the weird intel_frontbuffer + i915_active thing
without
blocking Xe.

Quoted 6 lines

Please also disable PSR and FBC with this or at least add a way
for users to disable those features.
Without frontbuffer tracker those two features will break in some
cases.

Quoted 8 lines

FBC and PSR work completely as expected. I don't remove frontbuffer
tracking; I only remove the GEM parts.

Explicit invalidation using pageflip or CPU rendering + DirtyFB
continue
to work, as I validated on my laptop with FBC.

Neither of which are relevant to the removal of the gem hooks.

Like I already said ~10 times in the last meeting, we need a proper
testcase. Here's a rough idea what it should do:

prepare a batch with
1. spinner
2. something that clobbers the fb

Then
1. grab reference crc
2. execbuffer
3. dirtyfb
4. wait long enough for fbc to recompress
5. terminate spinner
6. gem_sync
7. grab crc and compare with reference

No idea what the current status of PSR+CRC is, so not sure whether we can actually test PSR or not.

Quoted 7 lines
Quoted 5 lines

CRC calculation doesn't work with PSR currently. PSR is disabled if CRC
capture is requested.

Are we supposed to support frontbuffer rendering using GPU?

No other driver does that.

Every driver does that when you run X w/o a compositor. Assuming there is an actual GPU in there.

Quoted 2 lines

It's fine if DirtyFB hangs instead until the
job it waits on completes.

No one tried to make it just wait for the fence(s) w/o doing a full blown atomic commit. It might work, but might also still suck too much. I guess depends on how overloaded the GPU is.

Quoted 7 lines

What we could do is do a frontbuffer invalidate on dirtyfb invocation, and then once the fence(s) signal we do a frontbuffer flush. That would most closely match the gem hook behaviour, except the invalidate comes in a bit later. The alternative would be to skip the invalidate, which should still guarantee correctness in the end, just with possibly jankier interactivity.

I have implemented this approach here:

https://patchwork.freedesktop.org/series/116620/

Review/comments are welcome.

BR,

Jouni Högander

#14 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/xe/display: Do not use i915 frontbuffer tracking implementation

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm/xe/display: Do not use i915 frontbuffer tracking implementation
URL : https://patchwork.freedesktop.org/series/114714/
State : failure

== Summary ==

Error: patch https://patchwork.freedesktop.org/api/1.0/series/114714/revisions/1/mbox/ not applied
Applying: drm/xe/display: Do not use i915 frontbuffer tracking implementation
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/display/intel_display_types.h).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/xe/display: Do not use i915 frontbuffer tracking implementation When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".