0001
0002
0003
0004
0005
0006 #ifndef __I915_TTM_BUDDY_MANAGER_H__
0007 #define __I915_TTM_BUDDY_MANAGER_H__
0008
0009 #include <linux/list.h>
0010 #include <linux/types.h>
0011
0012 #include <drm/ttm/ttm_resource.h>
0013
0014 struct ttm_device;
0015 struct ttm_resource_manager;
0016 struct drm_buddy;
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 struct i915_ttm_buddy_resource {
0032 struct ttm_resource base;
0033 struct list_head blocks;
0034 unsigned long flags;
0035 unsigned long used_visible_size;
0036 struct drm_buddy *mm;
0037 };
0038
0039
0040
0041
0042
0043
0044
0045
0046 static inline struct i915_ttm_buddy_resource *
0047 to_ttm_buddy_resource(struct ttm_resource *res)
0048 {
0049 return container_of(res, struct i915_ttm_buddy_resource, base);
0050 }
0051
0052 int i915_ttm_buddy_man_init(struct ttm_device *bdev,
0053 unsigned type, bool use_tt,
0054 u64 size, u64 visible_size,
0055 u64 default_page_size, u64 chunk_size);
0056 int i915_ttm_buddy_man_fini(struct ttm_device *bdev,
0057 unsigned int type);
0058
0059 int i915_ttm_buddy_man_reserve(struct ttm_resource_manager *man,
0060 u64 start, u64 size);
0061
0062 u64 i915_ttm_buddy_man_visible_size(struct ttm_resource_manager *man);
0063
0064 void i915_ttm_buddy_man_avail(struct ttm_resource_manager *man,
0065 u64 *avail, u64 *avail_visible);
0066
0067 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
0068 void i915_ttm_buddy_man_force_visible_size(struct ttm_resource_manager *man,
0069 u64 size);
0070 #endif
0071
0072 #endif