iris: actually pin the instruction cache buffers
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 30 Jan 2018 10:16:34 +0000 (02:16 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_state.c

index 5d3d6698a37c446476e9c7e61dd7af285000af8a..e254863aef9c3cb5cd5778a60c58947edc33d73f 100644 (file)
@@ -659,6 +659,13 @@ emit_reloc(struct iris_batch *batch,
    return entry->offset + target_offset;
 }
 
+void
+iris_use_pinned_bo(struct iris_batch *batch, struct iris_bo *bo)
+{
+   assert(bo->kflags & EXEC_OBJECT_PINNED);
+   add_exec_bo(batch, bo);
+}
+
 uint64_t
 iris_batch_reloc(struct iris_batch *batch, uint32_t batch_offset,
                  struct iris_bo *target, uint32_t target_offset,
index 6b67737f614d675b21a9b5270ff72368b3ceac4a..bb891c68263045f5fe93b4f4af1edf3570d5f89e 100644 (file)
@@ -121,6 +121,8 @@ bool iris_batch_references(struct iris_batch *batch, struct iris_bo *bo);
 
 #define RELOC_WRITE EXEC_OBJECT_WRITE
 
+void iris_use_pinned_bo(struct iris_batch *batch, struct iris_bo *bo);
+
 uint64_t iris_batch_reloc(struct iris_batch *batch,
                           uint32_t batch_offset,
                           struct iris_bo *target,
index b07664bc88d4ed8639753810d29d03d4e194f090..be75de2402c7b35c71eac1147369eb65055c89e4 100644 (file)
@@ -263,6 +263,8 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
       goto fail;
 
    if (templ->flags & IRIS_RESOURCE_FLAG_INSTRUCTION_CACHE) {
+      res->bo->kflags = EXEC_OBJECT_PINNED;
+      res->bo->name = "instruction cache";
       // XXX: p_atomic_add is backwards :(
       res->bo->gtt_offset = __atomic_fetch_add(&screen->next_instruction_address, res->bo->size, __ATOMIC_ACQ_REL);
    }
index 5f9573dd8dd3cece3d586f84a4d727e406c81baa..48f62b13b0babc27ff0d778145d6951616fa0965 100644 (file)
@@ -1989,8 +1989,12 @@ iris_upload_render_state(struct iris_context *ice,
       if (!(dirty & (IRIS_DIRTY_VS << stage)))
          continue;
 
-      if (ice->shaders.prog[stage]) {
-         iris_batch_emit(batch, ice->shaders.prog[stage]->derived_data,
+      struct iris_compiled_shader *shader = ice->shaders.prog[stage];
+
+      if (shader) {
+         struct iris_resource *cache = (void *) shader->buffer;
+         iris_use_pinned_bo(batch, cache->bo);
+         iris_batch_emit(batch, shader->derived_data,
                          iris_derived_program_state_size(stage));
       } else {
          if (stage == MESA_SHADER_TESS_EVAL) {