drm/i915: Perform execbuffer object locking as a separate step
To help avoid evicting already resident buffers from the batch we're processing, perform locking as a separate step. Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Ramalingam C <ramalingam.c@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210615113600.30660-1-thomas.hellstrom@linux.intel.com
This commit is contained in:
parent
99919be74a
commit
5cd57f676b
|
@ -922,6 +922,23 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int eb_lock_vmas(struct i915_execbuffer *eb)
|
||||
{
|
||||
unsigned int i;
|
||||
int err;
|
||||
|
||||
for (i = 0; i < eb->buffer_count; i++) {
|
||||
struct eb_vma *ev = &eb->vma[i];
|
||||
struct i915_vma *vma = ev->vma;
|
||||
|
||||
err = i915_gem_object_lock(vma->obj, &eb->ww);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int eb_validate_vmas(struct i915_execbuffer *eb)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -929,15 +946,15 @@ static int eb_validate_vmas(struct i915_execbuffer *eb)
|
|||
|
||||
INIT_LIST_HEAD(&eb->unbound);
|
||||
|
||||
err = eb_lock_vmas(eb);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
for (i = 0; i < eb->buffer_count; i++) {
|
||||
struct drm_i915_gem_exec_object2 *entry = &eb->exec[i];
|
||||
struct eb_vma *ev = &eb->vma[i];
|
||||
struct i915_vma *vma = ev->vma;
|
||||
|
||||
err = i915_gem_object_lock(vma->obj, &eb->ww);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = eb_pin_vma(eb, entry, ev);
|
||||
if (err == -EDEADLK)
|
||||
return err;
|
||||
|
|
Loading…
Reference in New Issue