aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2018-04-28 01:56:59 -0700
committerJordan Justen <[email protected]>2019-10-28 00:09:14 -0700
commit66796a1787822fb2ae6189639ce96fbeb3767c9e (patch)
tree8884a864be11fdd1a0363b44e1c2d9a8b1552e98
parent2e6a7ced4dbc70149280fe3c8c453a228c73c524 (diff)
iris: Mark aux-map BO as used by all batches
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/gallium/drivers/iris/iris_batch.c53
1 files changed, 44 insertions, 9 deletions
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index 27acf8a5387..9dbe4a51bde 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -44,6 +44,7 @@
#include "drm-uapi/i915_drm.h"
+#include "common/gen_aux_map.h"
#include "intel/common/gen_gem.h"
#include "util/hash_table.h"
#include "util/set.h"
@@ -264,6 +265,20 @@ find_validation_entry(struct iris_batch *batch, struct iris_bo *bo)
return NULL;
}
+static void
+ensure_exec_obj_space(struct iris_batch *batch, uint32_t count)
+{
+ while (batch->exec_count + count > batch->exec_array_size) {
+ batch->exec_array_size *= 2;
+ 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]));
+ }
+}
+
/**
* Add a buffer to the current batch's validation list.
*
@@ -330,15 +345,7 @@ iris_use_pinned_bo(struct iris_batch *batch,
/* Now, take a reference and add it to the validation list. */
iris_bo_reference(bo);
- if (batch->exec_count == batch->exec_array_size) {
- batch->exec_array_size *= 2;
- 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]));
- }
+ ensure_exec_obj_space(batch, 1);
batch->validation_list[batch->exec_count] =
(struct drm_i915_gem_exec_object2) {
@@ -459,12 +466,40 @@ iris_chain_to_new_batch(struct iris_batch *batch)
VG(VALGRIND_CHECK_MEM_IS_DEFINED(map, batch->primary_batch_size));
}
+
+static void
+add_aux_map_bos_to_batch(struct iris_batch *batch)
+{
+ void *aux_map_ctx = iris_bufmgr_get_aux_map_context(batch->screen->bufmgr);
+ if (!aux_map_ctx)
+ return;
+
+ uint32_t count = gen_aux_map_get_num_buffers(aux_map_ctx);
+ ensure_exec_obj_space(batch, count);
+ gen_aux_map_fill_bos(aux_map_ctx,
+ (void**)&batch->exec_bos[batch->exec_count], count);
+ for (uint32_t i = 0; i < count; i++) {
+ struct iris_bo *bo = batch->exec_bos[batch->exec_count];
+ iris_bo_reference(bo);
+ batch->validation_list[batch->exec_count] =
+ (struct drm_i915_gem_exec_object2) {
+ .handle = bo->gem_handle,
+ .offset = bo->gtt_offset,
+ .flags = bo->kflags,
+ };
+ batch->aperture_space += bo->size;
+ batch->exec_count++;
+ }
+}
+
/**
* Terminate a batch with MI_BATCH_BUFFER_END.
*/
static void
iris_finish_batch(struct iris_batch *batch)
{
+ add_aux_map_bos_to_batch(batch);
+
/* Emit MI_BATCH_BUFFER_END to finish our batch. */
uint32_t *map = batch->map_next;