drm/i915/display: include gem/i915_gem_stolen.h where needed
authorJani Nikula <jani.nikula@intel.com>
Wed, 29 May 2024 17:48:05 +0000 (20:48 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 6 Jun 2024 12:59:08 +0000 (15:59 +0300)
Include what you use. We need to move the compat i915_gem_stolen.h under
gem subdir. With this, we can drop the include from xe compat
i915_drv.h.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/6ac3480a8689fda5aaf4007cb604e06e939a03f7.1717004739.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_fbc.c
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_stolen.h [new file with mode: 0644]
drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h [deleted file]

index e9189a864f696bc5ffa718ee1ffa53f2589b40a6..6985abeb6102f98efc5a657d1dcb4e5f0d54029e 100644 (file)
@@ -43,6 +43,7 @@
 #include <drm/drm_blend.h>
 #include <drm/drm_fourcc.h>
 
+#include "gem/i915_gem_stolen.h"
 #include "i915_drv.h"
 #include "i915_reg.h"
 #include "i915_utils.h"
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_stolen.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_stolen.h
new file mode 100644 (file)
index 0000000..cb6c759
--- /dev/null
@@ -0,0 +1,87 @@
+#ifndef _I915_GEM_STOLEN_H_
+#define _I915_GEM_STOLEN_H_
+
+#include "xe_ttm_stolen_mgr.h"
+#include "xe_res_cursor.h"
+
+struct xe_bo;
+
+struct i915_stolen_fb {
+       struct xe_bo *bo;
+};
+
+static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe,
+                                                      struct i915_stolen_fb *fb,
+                                                      u32 size, u32 align,
+                                                      u32 start, u32 end)
+{
+       struct xe_bo *bo;
+       int err;
+       u32 flags = XE_BO_FLAG_PINNED | XE_BO_FLAG_STOLEN;
+
+       if (start < SZ_4K)
+               start = SZ_4K;
+
+       if (align) {
+               size = ALIGN(size, align);
+               start = ALIGN(start, align);
+       }
+
+       bo = xe_bo_create_locked_range(xe, xe_device_get_root_tile(xe),
+                                      NULL, size, start, end,
+                                      ttm_bo_type_kernel, flags);
+       if (IS_ERR(bo)) {
+               err = PTR_ERR(bo);
+               bo = NULL;
+               return err;
+       }
+       err = xe_bo_pin(bo);
+       xe_bo_unlock_vm_held(bo);
+
+       if (err) {
+               xe_bo_put(fb->bo);
+               bo = NULL;
+       }
+
+       fb->bo = bo;
+
+       return err;
+}
+
+static inline int i915_gem_stolen_insert_node(struct xe_device *xe,
+                                             struct i915_stolen_fb *fb,
+                                             u32 size, u32 align)
+{
+       /* Not used on xe */
+       BUG_ON(1);
+       return -ENODEV;
+}
+
+static inline void i915_gem_stolen_remove_node(struct xe_device *xe,
+                                              struct i915_stolen_fb *fb)
+{
+       xe_bo_unpin_map_no_vm(fb->bo);
+       fb->bo = NULL;
+}
+
+#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
+#define i915_gem_stolen_node_allocated(fb) (!!((fb)->bo))
+
+static inline u32 i915_gem_stolen_node_offset(struct i915_stolen_fb *fb)
+{
+       struct xe_res_cursor res;
+
+       xe_res_first(fb->bo->ttm.resource, 0, 4096, &res);
+       return res.start;
+}
+
+/* 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))
+
+#define i915_gem_stolen_node_address(xe, fb) (xe_ttm_stolen_gpu_offset(xe) + \
+                                        i915_gem_stolen_node_offset(fb))
+#define i915_gem_stolen_node_size(fb) ((u64)((fb)->bo->ttm.base.size))
+
+#endif
index ffaa4d2f1eed3d25fde17009af66ab8267d69978..0675c50edc6fb805d35610a2701590c2b665c204 100644 (file)
@@ -19,7 +19,6 @@
 #include "xe_bo.h"
 #include "xe_pm.h"
 #include "xe_step.h"
-#include "i915_gem_stolen.h"
 #include "i915_gpu_error.h"
 #include "i915_reg_defs.h"
 #include "i915_utils.h"
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
deleted file mode 100644 (file)
index cb6c759..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef _I915_GEM_STOLEN_H_
-#define _I915_GEM_STOLEN_H_
-
-#include "xe_ttm_stolen_mgr.h"
-#include "xe_res_cursor.h"
-
-struct xe_bo;
-
-struct i915_stolen_fb {
-       struct xe_bo *bo;
-};
-
-static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe,
-                                                      struct i915_stolen_fb *fb,
-                                                      u32 size, u32 align,
-                                                      u32 start, u32 end)
-{
-       struct xe_bo *bo;
-       int err;
-       u32 flags = XE_BO_FLAG_PINNED | XE_BO_FLAG_STOLEN;
-
-       if (start < SZ_4K)
-               start = SZ_4K;
-
-       if (align) {
-               size = ALIGN(size, align);
-               start = ALIGN(start, align);
-       }
-
-       bo = xe_bo_create_locked_range(xe, xe_device_get_root_tile(xe),
-                                      NULL, size, start, end,
-                                      ttm_bo_type_kernel, flags);
-       if (IS_ERR(bo)) {
-               err = PTR_ERR(bo);
-               bo = NULL;
-               return err;
-       }
-       err = xe_bo_pin(bo);
-       xe_bo_unlock_vm_held(bo);
-
-       if (err) {
-               xe_bo_put(fb->bo);
-               bo = NULL;
-       }
-
-       fb->bo = bo;
-
-       return err;
-}
-
-static inline int i915_gem_stolen_insert_node(struct xe_device *xe,
-                                             struct i915_stolen_fb *fb,
-                                             u32 size, u32 align)
-{
-       /* Not used on xe */
-       BUG_ON(1);
-       return -ENODEV;
-}
-
-static inline void i915_gem_stolen_remove_node(struct xe_device *xe,
-                                              struct i915_stolen_fb *fb)
-{
-       xe_bo_unpin_map_no_vm(fb->bo);
-       fb->bo = NULL;
-}
-
-#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
-#define i915_gem_stolen_node_allocated(fb) (!!((fb)->bo))
-
-static inline u32 i915_gem_stolen_node_offset(struct i915_stolen_fb *fb)
-{
-       struct xe_res_cursor res;
-
-       xe_res_first(fb->bo->ttm.resource, 0, 4096, &res);
-       return res.start;
-}
-
-/* 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))
-
-#define i915_gem_stolen_node_address(xe, fb) (xe_ttm_stolen_gpu_offset(xe) + \
-                                        i915_gem_stolen_node_offset(fb))
-#define i915_gem_stolen_node_size(fb) ((u64)((fb)->bo->ttm.base.size))
-
-#endif