xref: /openbsd/sys/dev/pci/drm/i915/intel_region_ttm.h (revision 1bb76ff1)
15ca02815Sjsg /* SPDX-License-Identifier: MIT */
25ca02815Sjsg /*
35ca02815Sjsg  * Copyright © 2021 Intel Corporation
45ca02815Sjsg  */
55ca02815Sjsg #ifndef _INTEL_REGION_TTM_H_
65ca02815Sjsg #define _INTEL_REGION_TTM_H_
75ca02815Sjsg 
85ca02815Sjsg #include <linux/types.h>
95ca02815Sjsg 
105ca02815Sjsg #include "i915_selftest.h"
115ca02815Sjsg 
125ca02815Sjsg struct drm_i915_private;
135ca02815Sjsg struct intel_memory_region;
145ca02815Sjsg struct ttm_resource;
155ca02815Sjsg struct ttm_device_funcs;
165ca02815Sjsg 
175ca02815Sjsg int intel_region_ttm_device_init(struct drm_i915_private *dev_priv);
185ca02815Sjsg 
195ca02815Sjsg void intel_region_ttm_device_fini(struct drm_i915_private *dev_priv);
205ca02815Sjsg 
215ca02815Sjsg int intel_region_ttm_init(struct intel_memory_region *mem);
225ca02815Sjsg 
23*1bb76ff1Sjsg int intel_region_ttm_fini(struct intel_memory_region *mem);
245ca02815Sjsg 
25*1bb76ff1Sjsg struct i915_refct_sgt *
26*1bb76ff1Sjsg intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem,
27*1bb76ff1Sjsg 				  struct ttm_resource *res,
28*1bb76ff1Sjsg 				  u32 page_alignment);
295ca02815Sjsg 
305ca02815Sjsg void intel_region_ttm_resource_free(struct intel_memory_region *mem,
315ca02815Sjsg 				    struct ttm_resource *res);
325ca02815Sjsg 
335ca02815Sjsg int intel_region_to_ttm_type(const struct intel_memory_region *mem);
345ca02815Sjsg 
355ca02815Sjsg struct ttm_device_funcs *i915_ttm_driver(void);
365ca02815Sjsg 
375ca02815Sjsg #ifdef CONFIG_DRM_I915_SELFTEST
385ca02815Sjsg struct ttm_resource *
395ca02815Sjsg intel_region_ttm_resource_alloc(struct intel_memory_region *mem,
40*1bb76ff1Sjsg 				resource_size_t offset,
415ca02815Sjsg 				resource_size_t size,
425ca02815Sjsg 				unsigned int flags);
435ca02815Sjsg #endif
445ca02815Sjsg #endif /* _INTEL_REGION_TTM_H_ */
45