/** * i915_vma_size - Obtain the va range size of the vma * @vma: The vma * * GPU virtual address space may be allocated with padding. This * function returns the effective virtual address range size * with padding subtracted. * * Return: The effective virtual address range size.
*/ staticinline u64 i915_vma_size(conststruct i915_vma *vma)
{
GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); return __i915_vma_size(vma);
}
/* Internal use only. */ staticinline u64 __i915_vma_offset(conststruct i915_vma *vma)
{ /* The actual start of the vma->pages is after the guard pages. */ return vma->node.start + vma->guard;
}
/** * i915_vma_offset - Obtain the va offset of the vma * @vma: The vma * * GPU virtual address space may be allocated with padding. This * function returns the effective virtual address offset the gpu * should use to access the bound data. * * Return: The effective virtual address offset.
*/ staticinline u64 i915_vma_offset(conststruct i915_vma *vma)
{
GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); return __i915_vma_offset(vma);
}
BUILD_BUG_ON(I915_GTT_VIEW_NORMAL != 0);
cmp = vma->gtt_view.type; if (!view) return cmp;
cmp -= view->type; if (cmp) return cmp;
assert_i915_gem_gtt_types();
/* gtt_view.type also encodes its size so that we both distinguish * different views using it as a "type" and also use a compact (no * accessing of uninitialised padding bytes) memcmp without storing * an extra parameter or adding more code. * * To ensure that the memcmp is valid for all branches of the union, * even though the code looks like it is just comparing one branch, * we assert above that all branches have the same address, and that * each branch has a unique type/size.
*/
BUILD_BUG_ON(I915_GTT_VIEW_NORMAL >= I915_GTT_VIEW_PARTIAL);
BUILD_BUG_ON(I915_GTT_VIEW_PARTIAL >= I915_GTT_VIEW_ROTATED);
BUILD_BUG_ON(I915_GTT_VIEW_ROTATED >= I915_GTT_VIEW_REMAPPED);
BUILD_BUG_ON(offsetof(typeof(*view), rotated) !=
offsetof(typeof(*view), partial));
BUILD_BUG_ON(offsetof(typeof(*view), rotated) !=
offsetof(typeof(*view), remapped)); return memcmp(&vma->gtt_view.partial, &view->partial, view->type);
}
/** * i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the aperture * @vma: VMA to iomap * * The passed in VMA has to be pinned in the global GTT mappable region. * An extra pinning of the VMA is acquired for the return iomapping, * the caller must call i915_vma_unpin_iomap to relinquish the pinning * after the iomapping is no longer required. * * Returns a valid iomapped pointer or ERR_PTR.
*/ void __iomem *i915_vma_pin_iomap(struct i915_vma *vma);
/** * i915_vma_unpin_iomap - unpins the mapping returned from i915_vma_iomap * @vma: VMA to unpin * * Unpins the previously iomapped VMA from i915_vma_pin_iomap(). * * This function is only valid to be called on a VMA previously * iomapped by the caller with i915_vma_pin_iomap().
*/ void i915_vma_unpin_iomap(struct i915_vma *vma);
/** * i915_vma_pin_fence - pin fencing state * @vma: vma to pin fencing for * * This pins the fencing state (whether tiled or untiled) to make sure the * vma (and its object) is ready to be used as a scanout target. Fencing * status must be synchronize first by calling i915_vma_get_fence(): * * The resulting fence pin reference must be released again with * i915_vma_unpin_fence(). * * Returns: * True if the vma has a fence, false otherwise.
*/ int __must_check i915_vma_pin_fence(struct i915_vma *vma); void i915_vma_revoke_fence(struct i915_vma *vma);
/** * i915_vma_unpin_fence - unpin fencing state * @vma: vma to unpin fencing for * * This releases the fence pin reference acquired through * i915_vma_pin_fence. It will handle both objects with and without an * attached fence correctly, callers do not need to distinguish this.
*/ staticinlinevoid
i915_vma_unpin_fence(struct i915_vma *vma)
{ if (vma->fence)
__i915_vma_unpin_fence(vma);
}
#define for_each_until(cond) if (cond) break; else
/** * for_each_ggtt_vma - Iterate over the GGTT VMA belonging to an object. * @V: the #i915_vma iterator * @OBJ: the #drm_i915_gem_object * * GGTT VMA are placed at the being of the object's vma_list, see * vma_create(), so we can stop our walk as soon as we see a ppgtt VMA, * or the list is empty ofc.
*/ #define for_each_ggtt_vma(V, OBJ) \
list_for_each_entry(V, &(OBJ)->vma.list, obj_link) \
for_each_until(!i915_vma_is_ggtt(V))
staticinlineint i915_vma_sync(struct i915_vma *vma)
{ /* Wait for the asynchronous bindings and pending GPU reads */ return i915_active_wait(&vma->active);
}
/** * i915_vma_get_current_resource - Get the current resource of the vma * @vma: The vma to get the current resource from. * * It's illegal to call this function if the vma is not bound. * * Return: A refcounted pointer to the current vma resource * of the vma, assuming the vma is bound.
*/ staticinlinestruct i915_vma_resource *
i915_vma_get_current_resource(struct i915_vma *vma)
{ return i915_vma_resource_get(vma->resource);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.