[Intel-gfx] [PATCH 49/55] drm/i915: Double check activity before relocations
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Tue Jul 26 12:45:06 UTC 2016
On ma, 2016-07-25 at 18:32 +0100, Chris Wilson wrote:
> If the object is active and we need to perform a relocation upon it, we
> need to take the slow relocation path. Before we do, double check the
> active requests to see if they have completed.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com
> ---
> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index e1dfdbd8fc2e..9778b1bc6336 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -441,6 +441,20 @@ relocate_entry_clflush(struct drm_i915_gem_object *obj,
> return 0;
> }
>
> +static bool object_is_idle(struct drm_i915_gem_object *obj)
> +{
> + unsigned long active = obj->active;
> + int idx;
> +
> + for_each_active(active, idx) {
> + if (!i915_gem_active_is_idle(&obj->last_read[idx],
> + &obj->base.dev->struct_mutex))
> + return false;
> + }
> +
> + return true;
> +}
> +
> static int
> i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
> struct eb_vmas *eb,
> @@ -524,7 +538,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
> }
>
> /* We can't wait for rendering with pagefaults disabled */
> - if (obj->active && pagefault_disabled())
> + if (pagefault_disabled() && !object_is_idle(obj))
> return -EFAULT;
>
> if (use_cpu_reloc(obj))
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list