i965: add identifier BO

A buffer added to all execbufs so that we can attribute a batch that
caused a hang to a particular driver.

v2: Reuse workaround BO

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3203>
This commit is contained in:
Lionel Landwerlin
2019-12-24 03:13:52 +02:00
committed by Marge Bot
parent 2a4c361b06
commit 507b1ca10c
3 changed files with 42 additions and 1 deletions

View File

@@ -723,7 +723,17 @@ struct brw_context
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;

View File

@@ -371,6 +371,27 @@ brw_emit_mi_flush(struct brw_context *brw)
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)
@@ -418,6 +439,9 @@ brw_init_pipe_control(struct brw_context *brw,
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;

View File

@@ -277,6 +277,13 @@ intel_batchbuffer_reset(struct brw_context *brw)
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