[Intel-xe] [PATCH 13/15] drm/xe: Update headers to be more compatible with i915

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Oct 26 14:09:12 UTC 2023


---
 .../xe/compat-i915-headers/gem/i915_gem_mman.h | 17 +++++++++++++++++
 .../compat-i915-headers/gem/i915_gem_object.h  | 18 ++++++++++++++++++
 .../xe/compat-i915-headers/i915_gem_stolen.h   |  9 ++++++++-
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_mman.h

diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_mman.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_mman.h
new file mode 100644
index 000000000000..650ea2803a97
--- /dev/null
+++ b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_mman.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _I915_GEM_MMAN_H_
+#define _I915_GEM_MMAN_H_
+
+#include "xe_bo_types.h"
+#include <drm/drm_prime.h>
+
+static inline int i915_gem_fb_mmap(struct xe_bo *bo, struct vm_area_struct *vma)
+{
+	return drm_gem_prime_mmap(&bo->ttm.base, vma);
+}
+
+#endif
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
index 5f0545a3a99b..17620412eddd 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
@@ -55,4 +55,22 @@ static inline dma_addr_t i915_gem_object_get_dma_address(const struct xe_bo *bo,
 	return n;
 }
 
+/* Useful for kernel managed objects only */
+static inline bool i915_gem_object_is_shmem(const struct xe_bo *bo)
+{
+	return bo->flags & XE_BO_CREATE_SYSTEM_BIT;
+}
+
+static inline bool i915_gem_object_is_tiled(const struct xe_bo *bo)
+{
+	/* legacy tiling is unused */
+	return false;
+}
+
+static inline bool i915_gem_object_is_userptr(const struct xe_bo *bo)
+{
+	/* legacy tiling is unused */
+	return false;
+}
+
 #endif
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
index 888e7a87a925..19bf463cfd3d 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
@@ -70,7 +70,14 @@ static inline u32 i915_gem_stolen_node_offset(struct i915_stolen_fb *fb)
 /* Used for < gen4. These are not supported by Xe */
 #define i915_gem_stolen_area_address(xe) (!WARN_ON(1))
 /* Used for gen9 specific WA. Gen9 is not supported by Xe */
-#define i915_gem_stolen_area_size(xe) (!WARN_ON(1))
+static inline u64 i915_gem_stolen_area_size(struct xe_device *xe)
+{
+	struct ttm_resource_manager *ttm_mgr = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
+
+	if (!ttm_mgr)
+		return 0;
+	return ttm_mgr->size;
+}
 
 #define i915_gem_stolen_node_address(xe, fb) (xe_ttm_stolen_gpu_offset(xe) + \
 					 i915_gem_stolen_node_offset(fb))
-- 
2.40.1



More information about the Intel-xe mailing list