// SPDX-License-Identifier: MIT /* * Copyright © 2019 Intel Corporation */ #include <uapi/drm/i915_drm.h> #include "intel_memory_region.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" void __iomem * i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj, unsigned long n, unsigned long size) { … } /** * i915_gem_object_is_lmem - Whether the object is resident in * lmem * @obj: The object to check. * * Even if an object is allowed to migrate and change memory region, * this function checks whether it will always be present in lmem when * valid *or* if that's not the case, whether it's currently resident in lmem. * For migratable and evictable objects, the latter only makes sense when * the object is locked. * * Return: Whether the object migratable but resident in lmem, or not * migratable and will be present in lmem when valid. */ bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj) { … } /** * __i915_gem_object_is_lmem - Whether the object is resident in * lmem while in the fence signaling critical path. * @obj: The object to check. * * This function is intended to be called from within the fence signaling * path where the fence, or a pin, keeps the object from being migrated. For * example during gpu reset or similar. * * Return: Whether the object is resident in lmem. */ bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj) { … } /** * __i915_gem_object_create_lmem_with_ps - Create lmem object and force the * minimum page size for the backing pages. * @i915: The i915 instance. * @size: The size in bytes for the object. Note that we need to round the size * up depending on the @page_size. The final object size can be fished out from * the drm GEM object. * @page_size: The requested minimum page size in bytes for this object. This is * useful if we need something bigger than the regions min_page_size due to some * hw restriction, or in some very specialised cases where it needs to be * smaller, where the internal fragmentation cost is too great when rounding up * the object size. * @flags: The optional BO allocation flags. * * Note that this interface assumes you know what you are doing when forcing the * @page_size. If this is smaller than the regions min_page_size then it can * never be inserted into any GTT, otherwise it might lead to undefined * behaviour. * * Return: The object pointer, which might be an ERR_PTR in the case of failure. */ struct drm_i915_gem_object * __i915_gem_object_create_lmem_with_ps(struct drm_i915_private *i915, resource_size_t size, resource_size_t page_size, unsigned int flags) { … } struct drm_i915_gem_object * i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915, const void *data, size_t size) { … } struct drm_i915_gem_object * i915_gem_object_create_lmem(struct drm_i915_private *i915, resource_size_t size, unsigned int flags) { … }