[Intel-gfx] [PATCH 07/11] drm/i915/gem: Try allocating va from free space
Matthew Auld
matthew.william.auld at gmail.com
Wed Apr 1 18:20:56 UTC 2020
On Tue, 31 Mar 2020 at 22:31, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>
> If the current node/entry location is occupied, and the object is not
> pinned, try assigning it some free space. We cannot wait here, so if in
> doubt, we unreserve and try to grab all at once.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index bc8aa9604787..d8c746108d85 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -446,8 +446,17 @@ eb_pin_vma(struct i915_execbuffer *eb,
> if (unlikely(ev->flags & EXEC_OBJECT_NEEDS_GTT))
> pin_flags |= PIN_GLOBAL;
>
> - if (unlikely(i915_vma_pin(vma, 0, 0, pin_flags)))
> - return false;
> + if (unlikely(i915_vma_pin(vma, 0, 0, pin_flags))) {
> + if (entry->flags & EXEC_OBJECT_PINNED)
> + return false;
> +
> + pin_flags &= ~PIN_OFFSET_FIXED;
> + if (unlikely(i915_vma_pin(vma,
> + entry->pad_to_size,
> + entry->alignment,
> + pin_flags)))
Just curious, why not just apply the rest of the flags here(MAP, 48B,
BIAS etc) which saves us from having to bind/unbind/bind if it's
trivially misplaced?
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
More information about the Intel-gfx
mailing list