[Mesa-stable] [PATCH 6/6] i965: Add some batchbuffer debugging code.
Kenneth Graunke
kenneth at whitecape.org
Wed Nov 29 08:34:08 UTC 2017
On Tuesday, November 28, 2017 4:13:21 PM PST Kenneth Graunke wrote:
> Uncommenting these blocks stress tests the batch/state growth code by
> trying to "grow" a buffer to the same size at least once per batch.
>
> When anything goes wrong with this code, dumping the validation list
> is a useful way to figure out what's happening.
> ---
> src/mesa/drivers/dri/i965/intel_batchbuffer.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> index 12d165d7236..b5b9468ed65 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> @@ -64,6 +64,21 @@
> static void
> intel_batchbuffer_reset(struct brw_context *brw);
>
> +UNUSED static void
> +dump_validation_list(struct intel_batchbuffer *batch)
> +{
> + fprintf(stderr, "Validation list (length %d):\n", batch->exec_count);
> +
> + for (int i = 0; i < batch->exec_count; i++) {
> + assert(batch->validation_list[i].handle ==
> + batch->exec_bos[i]->gem_handle);
> + fprintf(stderr, "[%d] = %d %s %p\n", i,
> + batch->validation_list[i].handle,
> + batch->exec_bos[i]->name,
> + batch->exec_bos[i]);
> + }
> +}
> +
> static bool
> uint_key_compare(const void *a, const void *b)
> {
> @@ -996,6 +1011,18 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,
> brw_finish_batch(brw);
> intel_upload_finish(brw);
>
> + /* Test batch/state growing by swapping a BO for one of the same size */
> + if (0) {
> + const unsigned used = 4 * USED_BATCH(brw->batch);
> + grow_buffer(brw, &brw->batch.batch, used, brw->batch.batch.bo->size);
> + brw->batch.map_next = (void *) brw->batch.batch.map + used;
> + }
> + if (0) {
I've updated this locally to:
+ if (0 && brw->batch.state.bo->index != -1) {
because the buffer growing code assumes the BO is actually in the
validation list. It normally is, unless you don't emit any state
at all, say for really simple batches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20171129/84ffc563/attachment.sig>
More information about the mesa-stable
mailing list