bool intel_engine_is_idle(struct intel_engine_cs *engine)
{
	/* More white lies, if wedged, hw state is inconsistent */
	if (intel_gt_is_wedged(engine->gt))
		return true;

	if (!intel_engine_pm_is_awake(engine))
		return true;

	/* Waiting to drain ELSP? */
	if (execlists_active(&engine->execlists)) {
		synchronize_hardirq(engine->i915->drm.pdev->irq);

		intel_engine_flush_submission(engine);

		if (execlists_active(&engine->execlists))
			return false;
	}

	/* ELSP is empty, but there are ready requests? E.g. after reset */
	if (!RB_EMPTY_ROOT(&engine->execlists.queue.rb_root))
		return false;

	/* Ring stopped? */
	return ring_is_idle(engine);
}
bool intel_engine_is_idle(struct intel_engine_cs *engine)
{
	 
	if (intel_gt_is_wedged(engine->gt))
		return true;

	if (!intel_engine_pm_is_awake(engine))
		return true;

	 
	if (execlists_active(&engine->execlists)) {
		synchronize_hardirq(engine->i915->drm.pdev->irq);

		intel_engine_flush_submission(engine);

		if (execlists_active(&engine->execlists))
			return false;
	}

	 
	if (!RB_EMPTY_ROOT(&engine->execlists.queue.rb_root))
		return false;

	 
	return ring_is_idle(engine);
}