diff mbox series

[1/5] drm/i915/frontbuffer: un-inline frontbuffer bits checks

Message ID 53a8e43c2846c513f248b37bc4ba2173b2ec1378.1718633874.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: make struct intel_frontbuffer opaque | expand

Commit Message

Jani Nikula June 17, 2024, 2:18 p.m. UTC
Move frontbuffer bits read and check from intel_frontbuffer.h inline
functions to intel_frontbuffer.c, in preparation for making struct
intel_frontbuffer opaque.

Rename __intel_fb_* to __intel_frontbuffer_* while at it, because fb
sounds like framebuffer more than frontbuffer.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../gpu/drm/i915/display/intel_frontbuffer.c  | 22 ++++++++++-----
 .../gpu/drm/i915/display/intel_frontbuffer.h  | 27 +++++--------------
 2 files changed, 22 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index 4923c340a0b6..7964eaa6a60a 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -167,11 +167,15 @@  void intel_frontbuffer_flip(struct drm_i915_private *i915,
 	frontbuffer_flush(i915, frontbuffer_bits, ORIGIN_FLIP);
 }
 
-void __intel_fb_invalidate(struct intel_frontbuffer *front,
-			   enum fb_op_origin origin,
-			   unsigned int frontbuffer_bits)
+bool __intel_frontbuffer_invalidate(struct intel_frontbuffer *front,
+				    enum fb_op_origin origin)
 {
 	struct drm_i915_private *i915 = intel_bo_to_i915(front->obj);
+	unsigned int frontbuffer_bits;
+
+	frontbuffer_bits = atomic_read(&front->bits);
+	if (!frontbuffer_bits)
+		return false;
 
 	if (origin == ORIGIN_CS) {
 		spin_lock(&i915->display.fb_tracking.lock);
@@ -186,13 +190,19 @@  void __intel_fb_invalidate(struct intel_frontbuffer *front,
 	intel_psr_invalidate(i915, frontbuffer_bits, origin);
 	intel_drrs_invalidate(i915, frontbuffer_bits);
 	intel_fbc_invalidate(i915, frontbuffer_bits, origin);
+
+	return true;
 }
 
-void __intel_fb_flush(struct intel_frontbuffer *front,
-		      enum fb_op_origin origin,
-		      unsigned int frontbuffer_bits)
+void __intel_frontbuffer_flush(struct intel_frontbuffer *front,
+			       enum fb_op_origin origin)
 {
 	struct drm_i915_private *i915 = intel_bo_to_i915(front->obj);
+	unsigned int frontbuffer_bits;
+
+	frontbuffer_bits = atomic_read(&front->bits);
+	if (!frontbuffer_bits)
+		return;
 
 	if (origin == ORIGIN_CS) {
 		spin_lock(&i915->display.fb_tracking.lock);
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.h b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
index abb51e8bb920..f4a3495300de 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.h
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
@@ -79,9 +79,8 @@  void intel_frontbuffer_put(struct intel_frontbuffer *front);
 struct intel_frontbuffer *
 intel_frontbuffer_get(struct drm_i915_gem_object *obj);
 
-void __intel_fb_invalidate(struct intel_frontbuffer *front,
-			   enum fb_op_origin origin,
-			   unsigned int frontbuffer_bits);
+bool __intel_frontbuffer_invalidate(struct intel_frontbuffer *front,
+				    enum fb_op_origin origin);
 
 /**
  * intel_frontbuffer_invalidate - invalidate frontbuffer object
@@ -97,22 +96,14 @@  void __intel_fb_invalidate(struct intel_frontbuffer *front,
 static inline bool intel_frontbuffer_invalidate(struct intel_frontbuffer *front,
 						enum fb_op_origin origin)
 {
-	unsigned int frontbuffer_bits;
-
 	if (!front)
 		return false;
 
-	frontbuffer_bits = atomic_read(&front->bits);
-	if (!frontbuffer_bits)
-		return false;
-
-	__intel_fb_invalidate(front, origin, frontbuffer_bits);
-	return true;
+	return __intel_frontbuffer_invalidate(front, origin);
 }
 
-void __intel_fb_flush(struct intel_frontbuffer *front,
-		      enum fb_op_origin origin,
-		      unsigned int frontbuffer_bits);
+void __intel_frontbuffer_flush(struct intel_frontbuffer *front,
+			       enum fb_op_origin origin);
 
 /**
  * intel_frontbuffer_flush - flush frontbuffer object
@@ -125,16 +116,10 @@  void __intel_fb_flush(struct intel_frontbuffer *front,
 static inline void intel_frontbuffer_flush(struct intel_frontbuffer *front,
 					   enum fb_op_origin origin)
 {
-	unsigned int frontbuffer_bits;
-
 	if (!front)
 		return;
 
-	frontbuffer_bits = atomic_read(&front->bits);
-	if (!frontbuffer_bits)
-		return;
-
-	__intel_fb_flush(front, origin, frontbuffer_bits);
+	__intel_frontbuffer_flush(front, origin);
 }
 
 void intel_frontbuffer_queue_flush(struct intel_frontbuffer *front);