iris: hook up batch decoder

This commit is contained in:
Kenneth Graunke 2018-04-06 16:21:21 -07:00
parent 6cbd1d1692
commit 65073c2217
2 changed files with 43 additions and 6 deletions

View File

@ -25,7 +25,6 @@
#include "iris_batch.h"
#include "iris_bufmgr.h"
#include "iris_context.h"
#include "common/gen_decoder.h"
#include "drm-uapi/i915_drm.h"
@ -70,6 +69,25 @@ dump_validation_list(struct iris_batch *batch)
}
}
static struct gen_batch_decode_bo
decode_get_bo(void *v_batch, uint64_t address)
{
struct iris_batch *batch = v_batch;
struct iris_bo *bo = NULL;
for (int i = 0; i < batch->exec_count; i++) {
if (batch->exec_bos[i]->gtt_offset == address) {
return (struct gen_batch_decode_bo) {
.addr = address,
.size = batch->exec_bos[i]->size,
.map = iris_bo_map(batch->dbg, batch->exec_bos[i], MAP_READ),
};
}
}
return (struct gen_batch_decode_bo) { };
}
static bool
uint_key_compare(const void *a, const void *b)
{
@ -117,6 +135,16 @@ iris_init_batch(struct iris_batch *batch,
if (unlikely(INTEL_DEBUG)) {
batch->state_sizes =
_mesa_hash_table_create(NULL, uint_key_hash, uint_key_compare);
const unsigned decode_flags =
GEN_BATCH_DECODE_FULL |
((INTEL_DEBUG & DEBUG_COLOR) ? GEN_BATCH_DECODE_IN_COLOR : 0) |
GEN_BATCH_DECODE_OFFSETS;
GEN_BATCH_DECODE_FLOATS;
gen_batch_decode_ctx_init(&batch->decoder, &screen->devinfo,
stderr, decode_flags, NULL,
decode_get_bo, NULL, batch);
}
iris_batch_reset(batch);
@ -216,8 +244,10 @@ iris_batch_free(struct iris_batch *batch)
iris_bo_unreference(batch->last_cmd_bo);
if (batch->state_sizes)
if (batch->state_sizes) {
_mesa_hash_table_destroy(batch->state_sizes, NULL);
gen_batch_decode_ctx_finish(&batch->decoder);
}
}
/**
@ -522,6 +552,9 @@ _iris_batch_flush_fence(struct iris_batch *batch,
(float) batch->aperture_space / (1024 * 1024));
}
if (unlikely(INTEL_DEBUG & DEBUG_BATCH))
decode_batch(batch);
int ret = submit_batch(batch, in_fence_fd, out_fence_fd);
//throttle(iris);
@ -529,9 +562,6 @@ _iris_batch_flush_fence(struct iris_batch *batch,
if (ret < 0)
return ret;
if (unlikely(INTEL_DEBUG & DEBUG_BATCH))
decode_batch(batch);
//if (iris->ctx.Const.ResetStrategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
//iris_check_for_reset(ice);
@ -584,5 +614,7 @@ iris_use_pinned_bo(struct iris_batch *batch,
static void
decode_batch(struct iris_batch *batch)
{
// XXX: decode the batch
gen_print_batch(&batch->decoder, batch->cmdbuf.map,
buffer_bytes_used(&batch->cmdbuf),
batch->cmdbuf.bo->gtt_offset);
}

View File

@ -26,6 +26,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "common/gen_decoder.h"
/* The kernel assumes batchbuffers are smaller than 256kB. */
#define MAX_BATCH_SIZE (256 * 1024)
@ -77,8 +78,12 @@ struct iris_batch {
/** The amount of aperture space (in bytes) used by all exec_bos */
int aperture_space;
#if DEBUG
/** Map from batch offset to iris_alloc_state data (with DEBUG_BATCH) */
// XXX: unused
struct hash_table *state_sizes;
struct gen_batch_decode_ctx decoder;
#endif
void (*emit_state_base_address)(struct iris_batch *batch);
};