From: Chris Wilson Date: Wed, 27 Jun 2018 12:53:34 +0100 Subject: drm/i915: Wait for engines to idle before retiring Git-commit: a61b47f672c1ebd56b273a55cfed9621448d253e Patch-mainline: v4.19-rc1 References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166 In the next^W forthcoming patch, we will start to defer retiring the request from the engine list if it is still active on the submission backend. To preserve the semantics that after wait-for-idle completes the system is idle and fully retired, we need to therefore wait for the backends to idle before calling i915_retire_requests(). Signed-off-by: Chris Wilson Reviewed-by: Tvrtko Ursulin Link: https://patchwork.freedesktop.org/patch/msgid/20180627115334.16282-1-chris@chris-wilson.co.uk Acked-by: Petr Tesarik --- drivers/gpu/drm/i915/i915_gem.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3823,10 +3823,13 @@ int i915_gem_wait_for_idle(struct drm_i9 if (err) return err; } + + err = wait_for_engines(i915); + if (err) + return err; + i915_retire_requests(i915); GEM_BUG_ON(i915->gt.active_requests); - - return wait_for_engines(i915); } else { struct intel_engine_cs *engine; enum intel_engine_id id; @@ -3837,9 +3840,9 @@ int i915_gem_wait_for_idle(struct drm_i9 if (err) return err; } - - return 0; } + + return 0; } static void __i915_gem_object_flush_for_display(struct drm_i915_gem_object *obj)