summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/crocus/crocus_batch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/crocus/crocus_batch.c')
-rw-r--r--src/gallium/drivers/crocus/crocus_batch.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/src/gallium/drivers/crocus/crocus_batch.c b/src/gallium/drivers/crocus/crocus_batch.c
index e4e132fd11a..5d74101c5df 100644
--- a/src/gallium/drivers/crocus/crocus_batch.c
+++ b/src/gallium/drivers/crocus/crocus_batch.c
@@ -45,7 +45,6 @@
#include "drm-uapi/i915_drm.h"
#include "intel/common/intel_gem.h"
-#include "main/macros.h"
#include "util/hash_table.h"
#include "util/set.h"
#include "util/u_upload_mgr.h"
@@ -67,7 +66,7 @@
* or 12 bytes for MI_BATCH_BUFFER_START (when chaining). Plus, we may
* need an extra 4 bytes to pad out to the nearest QWord. So reserve 16.
*/
-#define BATCH_RESERVED(devinfo) ((devinfo)->is_haswell ? 32 : 16)
+#define BATCH_RESERVED(devinfo) ((devinfo)->platform == INTEL_PLATFORM_HSW ? 32 : 16)
static void crocus_batch_reset(struct crocus_batch *batch);
@@ -216,7 +215,7 @@ crocus_init_batch(struct crocus_context *ice,
if (devinfo->ver == 6)
batch->valid_reloc_flags |= EXEC_OBJECT_NEEDS_GTT;
- if (INTEL_DEBUG & DEBUG_BATCH) {
+ if (INTEL_DEBUG(DEBUG_BATCH)) {
/* The shadow doesn't get relocs written so state decode fails. */
batch->use_shadow_copy = false;
} else
@@ -247,38 +246,46 @@ crocus_init_batch(struct crocus_context *ice,
batch->other_batches[j++] = &ice->batches[i];
}
- if (INTEL_DEBUG & DEBUG_BATCH) {
+ if (INTEL_DEBUG(DEBUG_BATCH)) {
batch->state_sizes = _mesa_hash_table_u64_create(NULL);
- const unsigned decode_flags =
- INTEL_BATCH_DECODE_FULL |
- ((INTEL_DEBUG & DEBUG_COLOR) ? INTEL_BATCH_DECODE_IN_COLOR : 0) |
- INTEL_BATCH_DECODE_OFFSETS | INTEL_BATCH_DECODE_FLOATS;
-
- intel_batch_decode_ctx_init(&batch->decoder, &screen->devinfo, stderr,
- decode_flags, NULL, decode_get_bo,
- decode_get_state_size, batch);
+ const unsigned decode_flags = INTEL_BATCH_DECODE_DEFAULT_FLAGS |
+ (INTEL_DEBUG(DEBUG_COLOR) ? INTEL_BATCH_DECODE_IN_COLOR : 0);
+
+ intel_batch_decode_ctx_init_elk(&batch->decoder, &screen->compiler->isa,
+ &screen->devinfo, stderr,
+ decode_flags, NULL, decode_get_bo,
+ decode_get_state_size, batch);
batch->decoder.max_vbo_decoded_lines = 32;
}
crocus_batch_reset(batch);
}
-static struct drm_i915_gem_exec_object2 *
-find_validation_entry(struct crocus_batch *batch, struct crocus_bo *bo)
+static int
+find_exec_index(struct crocus_batch *batch, struct crocus_bo *bo)
{
unsigned index = READ_ONCE(bo->index);
if (index < batch->exec_count && batch->exec_bos[index] == bo)
- return &batch->validation_list[index];
+ return index;
/* May have been shared between multiple active batches */
for (index = 0; index < batch->exec_count; index++) {
if (batch->exec_bos[index] == bo)
- return &batch->validation_list[index];
+ return index;
}
+ return -1;
+}
+
+static struct drm_i915_gem_exec_object2 *
+find_validation_entry(struct crocus_batch *batch, struct crocus_bo *bo)
+{
+ int index = find_exec_index(batch, bo);
- return NULL;
+ if (index == -1)
+ return NULL;
+ return &batch->validation_list[index];
}
static void
@@ -410,7 +417,7 @@ emit_reloc(struct crocus_batch *batch,
(struct drm_i915_gem_relocation_entry) {
.offset = offset,
.delta = target_offset,
- .target_handle = target->index,
+ .target_handle = find_exec_index(batch, target),
.presumed_offset = entry->offset,
};
@@ -940,8 +947,7 @@ _crocus_batch_flush(struct crocus_batch *batch, const char *file, int line)
finish_growing_bos(&batch->state);
int ret = submit_batch(batch);
- if (unlikely(INTEL_DEBUG &
- (DEBUG_BATCH | DEBUG_SUBMIT | DEBUG_PIPE_CONTROL))) {
+ if (INTEL_DEBUG(DEBUG_BATCH | DEBUG_SUBMIT | DEBUG_PIPE_CONTROL)) {
int bytes_for_commands = crocus_batch_bytes_used(batch);
int second_bytes = 0;
if (batch->command.bo != batch->exec_bos[0]) {
@@ -959,12 +965,12 @@ _crocus_batch_flush(struct crocus_batch *batch, const char *file, int line)
batch->command.relocs.reloc_count,
batch->state.relocs.reloc_count);
- if (INTEL_DEBUG & (DEBUG_BATCH | DEBUG_SUBMIT)) {
+ if (INTEL_DEBUG(DEBUG_BATCH | DEBUG_SUBMIT)) {
dump_fence_list(batch);
dump_validation_list(batch);
}
- if (INTEL_DEBUG & DEBUG_BATCH) {
+ if (INTEL_DEBUG(DEBUG_BATCH)) {
decode_batch(batch);
}
}
@@ -985,7 +991,7 @@ _crocus_batch_flush(struct crocus_batch *batch, const char *file, int line)
util_dynarray_clear(&batch->exec_fences);
- if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) {
+ if (INTEL_DEBUG(DEBUG_SYNC)) {
dbg_printf("waiting for idle\n");
crocus_bo_wait_rendering(batch->command.bo); /* if execbuf failed; this is a nop */
}
@@ -1008,8 +1014,8 @@ _crocus_batch_flush(struct crocus_batch *batch, const char *file, int line)
}
if (ret < 0) {
-#ifdef DEBUG
- const bool color = INTEL_DEBUG & DEBUG_COLOR;
+#if MESA_DEBUG
+ const bool color = INTEL_DEBUG(DEBUG_COLOR);
fprintf(stderr, "%scrocus: Failed to submit batchbuffer: %-80s%s\n",
color ? "\e[1;41m" : "", strerror(-ret), color ? "\e[0m" : "");
#endif