- const bool do_exec = !(ilo_debug & ILO_DEBUG_NOHW);
- struct intel_context *ctx;
- unsigned long flags;
- int err;
-
- switch (cp->ring) {
- case ILO_CP_RING_RENDER:
- ctx = cp->render_ctx;
- flags = INTEL_EXEC_RENDER;
- break;
- case ILO_CP_RING_BLT:
- ctx = NULL;
- flags = INTEL_EXEC_BLT;
- break;
- default:
- ctx = NULL;
- flags = 0;
- break;
+ uint32_t active_lost, pending_lost;
+ bool guilty = false;
+
+ if (likely(!(ilo_debug & ILO_DEBUG_HANG)))
+ return false;
+
+ /* wait and get reset stats */
+ if (intel_bo_wait(cp->last_submitted_bo, -1) ||
+ intel_winsys_get_reset_stats(cp->winsys, cp->render_ctx,
+ &active_lost, &pending_lost))
+ return false;
+
+ if (cp->active_lost != active_lost) {
+ ilo_err("GPU hang caused by bo %p\n", cp->last_submitted_bo);
+ cp->active_lost = active_lost;
+ guilty = true;