[Intel-xe] [RFC PATCH 05/20] drm/i915/display: Change __intel_frontbuffer_get parameter

Jouni Högander jouni.hogander at intel.com
Fri May 5 08:29:41 UTC 2023


Change__intel_frontbuffer_get to take intel_frontbuffer pointer instead of
i915_gem_object pointer. This allows us to remove including
gem/i915_gem_object_types.h.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 drivers/gpu/drm/i915/display/intel_frontbuffer.c | 2 +-
 drivers/gpu/drm/i915/display/intel_frontbuffer.h | 9 ++++-----
 drivers/gpu/drm/i915/gem/i915_gem_object.c       | 4 ++--
 drivers/gpu/drm/i915/i915_vma.c                  | 2 +-
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index 17a7aa8b28c2..783ab1ab7f62 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -252,7 +252,7 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj)
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	struct intel_frontbuffer *front;
 
-	front = __intel_frontbuffer_get(obj);
+	front = __intel_frontbuffer_get(obj->frontbuffer);
 	if (front)
 		return front;
 
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.h b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
index 3c474ed937fb..a3d47ab619cc 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.h
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
@@ -28,7 +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;
@@ -76,23 +75,23 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
 void intel_frontbuffer_put(struct intel_frontbuffer *front);
 
 static inline struct intel_frontbuffer *
-__intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
+__intel_frontbuffer_get(struct intel_frontbuffer *frontbuffer)
 {
 	struct intel_frontbuffer *front;
 
-	if (likely(!rcu_access_pointer(obj->frontbuffer)))
+	if (likely(!rcu_access_pointer(frontbuffer)))
 		return NULL;
 
 	rcu_read_lock();
 	do {
-		front = rcu_dereference(obj->frontbuffer);
+		front = rcu_dereference(frontbuffer);
 		if (!front)
 			break;
 
 		if (unlikely(!kref_get_unless_zero(&front->ref)))
 			continue;
 
-		if (likely(front == rcu_access_pointer(obj->frontbuffer)))
+		if (likely(front == rcu_access_pointer(frontbuffer)))
 			break;
 
 		intel_frontbuffer_put(front);
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 4666bb82f312..7f5842aba48a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -405,7 +405,7 @@ void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
 {
 	struct intel_frontbuffer *front;
 
-	front = __intel_frontbuffer_get(obj);
+	front = __intel_frontbuffer_get(obj->frontbuffer);
 	if (front) {
 		intel_frontbuffer_flush(front, origin);
 		intel_frontbuffer_put(front);
@@ -417,7 +417,7 @@ void __i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
 {
 	struct intel_frontbuffer *front;
 
-	front = __intel_frontbuffer_get(obj);
+	front = __intel_frontbuffer_get(obj->frontbuffer);
 	if (front) {
 		intel_frontbuffer_invalidate(front, origin);
 		intel_frontbuffer_put(front);
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 20a44788999e..008d4eb42f10 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -1906,7 +1906,7 @@ int _i915_vma_move_to_active(struct i915_vma *vma,
 	if (flags & EXEC_OBJECT_WRITE) {
 		struct intel_frontbuffer *front;
 
-		front = __intel_frontbuffer_get(obj);
+		front = __intel_frontbuffer_get(obj->frontbuffer);
 		if (unlikely(front)) {
 			if (intel_frontbuffer_invalidate(front, ORIGIN_CS))
 				i915_active_add_request(&front->write, rq);
-- 
2.34.1



More information about the Intel-xe mailing list