* Debugging code to dump the validation list, used by INTEL_DEBUG=submit.
*/
static void
-dump_validation_list(struct iris_batch *batch)
+dump_validation_list(struct iris_batch *batch,
+ struct drm_i915_gem_exec_object2 *validation_list)
{
fprintf(stderr, "Validation list (length %d):\n", batch->exec_count);
for (int i = 0; i < batch->exec_count; i++) {
- uint64_t flags = batch->validation_list[i].flags;
- assert(batch->validation_list[i].handle ==
- batch->exec_bos[i]->gem_handle);
+ uint64_t flags = validation_list[i].flags;
+ assert(validation_list[i].handle == batch->exec_bos[i]->gem_handle);
fprintf(stderr, "[%2d]: %2d %-14s @ 0x%"PRIx64" (%"PRIu64"B)\t %2d refs %s\n",
i,
- batch->validation_list[i].handle,
+ validation_list[i].handle,
batch->exec_bos[i]->name,
- (uint64_t)batch->validation_list[i].offset,
+ (uint64_t)validation_list[i].offset,
batch->exec_bos[i]->size,
batch->exec_bos[i]->refcount,
(flags & EXEC_OBJECT_WRITE) ? " (write)" : "");
batch->exec_array_size = 128;
batch->exec_bos =
malloc(batch->exec_array_size * sizeof(batch->exec_bos[0]));
- batch->validation_list =
- malloc(batch->exec_array_size * sizeof(batch->validation_list[0]));
batch->bos_written =
rzalloc_array(NULL, BITSET_WORD, BITSET_WORDS(batch->exec_array_size));
batch->exec_bos =
realloc(batch->exec_bos,
batch->exec_array_size * sizeof(batch->exec_bos[0]));
- batch->validation_list =
- realloc(batch->validation_list,
- batch->exec_array_size * sizeof(batch->validation_list[0]));
batch->bos_written =
rerzalloc(NULL, batch->bos_written, BITSET_WORD,
BITSET_WORDS(old_size),
static void
add_bo_to_batch(struct iris_batch *batch, struct iris_bo *bo, bool writable)
{
- uint64_t extra_flags = 0;
-
assert(batch->exec_array_size > batch->exec_count);
- if (writable)
- extra_flags |= EXEC_OBJECT_WRITE;
- if (!iris_bo_is_external(bo))
- extra_flags |= EXEC_OBJECT_ASYNC;
-
iris_bo_reference(bo);
batch->exec_bos[batch->exec_count] = bo;
if (writable)
BITSET_SET(batch->bos_written, batch->exec_count);
- batch->validation_list[batch->exec_count] =
- (struct drm_i915_gem_exec_object2) {
- .handle = bo->gem_handle,
- .offset = bo->address,
- .flags = bo->kflags | extra_flags,
- };
-
bo->index = batch->exec_count;
batch->exec_count++;
batch->aperture_space += bo->size;
if (existing_index != -1) {
/* The BO is already in the list; mark it writable */
- if (writable) {
+ if (writable)
BITSET_SET(batch->bos_written, existing_index);
- batch->validation_list[existing_index].flags |= EXEC_OBJECT_WRITE;
- }
return;
}
iris_bo_unreference(batch->exec_bos[i]);
}
free(batch->exec_bos);
- free(batch->validation_list);
ralloc_free(batch->bos_written);
ralloc_free(batch->exec_fences.mem_ctx);
for (int i = 0; i < batch->exec_count; i++) {
struct iris_bo *bo = batch->exec_bos[i];
- struct drm_i915_gem_exec_object2 *exec_obj = &batch->validation_list[i];
- bool write = exec_obj->flags & EXEC_OBJECT_WRITE;
+ bool write = BITSET_TEST(batch->bos_written, i);
if (bo == batch->screen->workaround_bo)
continue;
{
iris_bo_unmap(batch->bo);
+ struct drm_i915_gem_exec_object2 *validation_list =
+ malloc(batch->exec_count * sizeof(*validation_list));
+
+ for (int i = 0; i < batch->exec_count; i++) {
+ struct iris_bo *bo = batch->exec_bos[i];
+ bool written = BITSET_TEST(batch->bos_written, i);
+ unsigned extra_flags = 0;
+
+ if (written)
+ extra_flags |= EXEC_OBJECT_WRITE;
+ if (!iris_bo_is_external(bo))
+ extra_flags |= EXEC_OBJECT_ASYNC;
+
+ validation_list[i] = (struct drm_i915_gem_exec_object2) {
+ .handle = bo->gem_handle,
+ .offset = bo->address,
+ .flags = bo->kflags | extra_flags,
+ };
+ }
+
+ if (INTEL_DEBUG & (DEBUG_BATCH | DEBUG_SUBMIT)) {
+ dump_fence_list(batch);
+ dump_validation_list(batch, validation_list);
+ }
+
+ if (INTEL_DEBUG & DEBUG_BATCH) {
+ decode_batch(batch);
+ }
+
/* The requirement for using I915_EXEC_NO_RELOC are:
*
* The addresses written in the objects must match the corresponding
* address of that object within the active context.
*/
struct drm_i915_gem_execbuffer2 execbuf = {
- .buffers_ptr = (uintptr_t) batch->validation_list,
+ .buffers_ptr = (uintptr_t) validation_list,
.buffer_count = batch->exec_count,
.batch_start_offset = 0,
/* This must be QWord aligned. */
iris_bo_unreference(bo);
}
+ free(validation_list);
+
return ret;
}
batch->exec_count,
(float) batch->aperture_space / (1024 * 1024));
- if (INTEL_DEBUG & (DEBUG_BATCH | DEBUG_SUBMIT)) {
- dump_fence_list(batch);
- dump_validation_list(batch);
- }
-
- if (INTEL_DEBUG & DEBUG_BATCH) {
- decode_batch(batch);
- }
}
int ret = submit_batch(batch);