[RFC PATCH 09/22] drm/i915/display: Add a new frontbuffer tracking interface for intel_overlay
Jouni Högander
jouni.hogander at intel.com
Fri Mar 24 11:24:52 UTC 2023
Intel_overlay doesn't know anything about intel_framebuffer. Add a new
interface for intel_overlay which takes frontbuffer bits
directly. Also drop __intel_fb_flush as unneeded.
Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
.../gpu/drm/i915/display/intel_frontbuffer.c | 54 +++++++++----------
.../gpu/drm/i915/display/intel_frontbuffer.h | 31 ++---------
2 files changed, 32 insertions(+), 53 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index 2031daa24e79..ece2d92ab4a7 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -76,18 +76,10 @@
*
* Can be called without any locks held.
*/
-static void frontbuffer_flush(struct drm_i915_private *i915,
+void frontbuffer_flush(struct drm_i915_private *i915,
unsigned int frontbuffer_bits,
enum fb_op_origin origin)
{
- /* Delay flushing when rings are still busy.*/
- spin_lock(&i915->display.fb_tracking.lock);
- frontbuffer_bits &= ~i915->display.fb_tracking.busy_bits;
- spin_unlock(&i915->display.fb_tracking.lock);
-
- if (!frontbuffer_bits)
- return;
-
trace_intel_frontbuffer_flush(i915, frontbuffer_bits, origin);
might_sleep();
@@ -96,6 +88,32 @@ static void frontbuffer_flush(struct drm_i915_private *i915,
intel_fbc_flush(i915, frontbuffer_bits, origin);
}
+/**
+ * intel_frontbuffer_flush - flush frontbuffer object
+ * @front: GEM object to flush
+ * @origin: which operation caused the flush
+ *
+ * This function gets called every time rendering on the given object has
+ * completed and frontbuffer caching can be started again.
+ */
+void intel_frontbuffer_flush(struct intel_framebuffer *fb,
+ enum fb_op_origin origin)
+{
+ struct drm_i915_private *i915;
+ unsigned int frontbuffer_bits;
+
+ if (!fb)
+ return;
+
+ i915 = to_i915(fb->base.dev);
+
+ frontbuffer_bits = atomic_read(&fb->bits);
+ if (!frontbuffer_bits)
+ return;
+
+ frontbuffer_flush(i915, origin, frontbuffer_bits);
+}
+
/**
* intel_frontbuffer_flip_prepare - prepare asynchronous frontbuffer flip
* @i915: i915 device
@@ -163,24 +181,6 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
}
-void __intel_fb_flush(struct intel_framebuffer *fb,
- enum fb_op_origin origin,
- unsigned int frontbuffer_bits)
-{
- struct drm_i915_private *i915 = to_i915(fb->base.dev);
-
- if (origin == ORIGIN_CS) {
- spin_lock(&i915->display.fb_tracking.lock);
- /* Filter out new bits since rendering started. */
- frontbuffer_bits &= i915->display.fb_tracking.busy_bits;
- i915->display.fb_tracking.busy_bits &= ~frontbuffer_bits;
- spin_unlock(&i915->display.fb_tracking.lock);
- }
-
- if (frontbuffer_bits)
- frontbuffer_flush(i915, frontbuffer_bits, origin);
-}
-
/**
* intel_frontbuffer_track - update frontbuffer tracking
* @old: current buffer for the frontbuffer slots
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.h b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
index 9aebd7b8e0cf..051fe066073a 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.h
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
@@ -64,32 +64,11 @@ void intel_frontbuffer_flip_complete(struct drm_i915_private *i915,
void intel_frontbuffer_flip(struct drm_i915_private *i915,
unsigned frontbuffer_bits);
-void __intel_fb_flush(struct intel_framebuffer *fb,
- enum fb_op_origin origin,
- unsigned int frontbuffer_bits);
-
-/**
- * intel_frontbuffer_flush - flush frontbuffer object
- * @front: GEM object to flush
- * @origin: which operation caused the flush
- *
- * This function gets called every time rendering on the given object has
- * completed and frontbuffer caching can be started again.
- */
-static inline void intel_frontbuffer_flush(struct intel_framebuffer *fb,
- enum fb_op_origin origin)
-{
- unsigned int frontbuffer_bits;
-
- if (!fb)
- return;
-
- frontbuffer_bits = atomic_read(&fb->bits);
- if (!frontbuffer_bits)
- return;
-
- __intel_fb_flush(fb, origin, frontbuffer_bits);
-}
+void frontbuffer_flush(struct drm_i915_private *i915,
+ unsigned int frontbuffer_bits,
+ enum fb_op_origin origin);
+void intel_frontbuffer_flush(struct intel_framebuffer *fb,
+ enum fb_op_origin origin);
void intel_frontbuffer_track(struct intel_framebuffer *old,
struct intel_framebuffer *new,
--
2.34.1
More information about the Intel-gfx-trybot
mailing list