uint32_t hw_ctx;
- /** BO for post-sync nonzero writes for gen6 workaround. */
+ /**
+ * BO for post-sync nonzero writes for gen6 workaround.
+ *
+ * This buffer also contains a marker + description of the driver. This
+ * buffer is added to all execbufs syscalls so that we can identify the
+ * driver that generated a hang by looking at the content of the buffer in
+ * the error state.
+ *
+ * Read/write should go at workaround_bo_offset in that buffer to avoid
+ * overriding the debug data.
+ */
struct brw_bo *workaround_bo;
uint32_t workaround_bo_offset;
uint8_t pipe_controls_since_last_cs_stall;
brw_emit_pipe_control_flush(brw, flags);
}
+static bool
+init_identifier_bo(struct brw_context *brw)
+{
+ void *bo_map;
+
+ if (!can_do_exec_capture(brw->screen))
+ return true;
+
+ bo_map = brw_bo_map(NULL, brw->workaround_bo, MAP_READ | MAP_WRITE);
+ if (!bo_map)
+ return false;
+
+ brw->workaround_bo->kflags |= EXEC_OBJECT_CAPTURE;
+ brw->workaround_bo_offset =
+ ALIGN(intel_debug_write_identifiers(bo_map, 4096, "i965") + 8, 8);
+
+ brw_bo_unmap(brw->workaround_bo);
+
+ return true;
+}
+
int
brw_init_pipe_control(struct brw_context *brw,
const struct gen_device_info *devinfo)
if (brw->workaround_bo == NULL)
return -ENOMEM;
+ if (!init_identifier_bo(brw))
+ return -ENOMEM; /* Couldn't map workaround_bo?? */
+
brw->workaround_bo_offset = 0;
brw->pipe_controls_since_last_cs_stall = 0;
if (batch->state_batch_sizes)
_mesa_hash_table_u64_clear(batch->state_batch_sizes, NULL);
+
+ /* Always add workaround_bo which contains a driver identifier to be
+ * recorded in error states.
+ */
+ struct brw_bo *identifier_bo = brw->workaround_bo;
+ if (identifier_bo)
+ add_exec_bo(batch, identifier_bo);
}
static void