[Intel-xe] [PATCH 3/8] fixup! drm/xe/display: Implement display support

Jouni Högander jouni.hogander at intel.com
Thu Nov 16 06:41:40 UTC 2023


Move xe_bo_get and xe_bo_put into intel_frontbuffer_get/put. This is where
it's done for i915. It should work for Xe as well and this way we get rid
of related ifdefs.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 .../gem/i915_gem_object_frontbuffer.h         | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_frontbuffer.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_frontbuffer.h
index 2a3f12d2978c..498292fa15b9 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_frontbuffer.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object_frontbuffer.h
@@ -6,7 +6,26 @@
 #ifndef _I915_GEM_OBJECT_FRONTBUFFER_H_
 #define _I915_GEM_OBJECT_FRONTBUFFER_H_
 
+#include "xe_bo_types.h"
+#include "xe_bo.h"
+
 #define i915_gem_object_get_frontbuffer(obj)		NULL
-#define i915_gem_object_set_frontbuffer(obj, front)	(front)
+
+static inline struct intel_frontbuffer *
+i915_gem_object_set_frontbuffer(struct xe_bo *bo,
+				struct intel_frontbuffer *front)
+{
+	if (!front) {
+		if (bo->flags & XE_BO_CREATE_PINNED_BIT) {
+			/* Unpin our kernel fb first */
+			xe_bo_lock(bo, false);
+			xe_bo_unpin(bo);
+			xe_bo_unlock(bo);
+		}
+		xe_bo_put(bo);
+	} else
+		xe_bo_get(bo);
+	return front;
+}
 
 #endif
-- 
2.34.1



More information about the Intel-xe mailing list