iris: Also properly restore INTERFACE_DESCRIPTOR_DATA buffer object
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 27 Jun 2019 06:56:45 +0000 (23:56 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 27 Jun 2019 15:12:22 +0000 (08:12 -0700)
We were at least cleaning up this reference, but we were failing to
pin it in iris_restore_compute_saved_bos.

src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_state.c

index 21877173b3f71a1b0b0cc5d134f6d8ad065eb8bc..30a585f27416d38590accad009797ae3432182fd 100644 (file)
@@ -713,6 +713,7 @@ struct iris_context {
          struct pipe_resource *blend;
          struct pipe_resource *index_buffer;
          struct pipe_resource *cs_thread_ids;
+         struct pipe_resource *cs_desc;
       } last_res;
 
       /** Records the size of variable-length state for INTEL_DEBUG=bat */
index 5de994893e0baca3e319ad9a7b59e9331bfe002c..c65421ed13245c880708f359b76426a770a1cac7 100644 (file)
@@ -4362,6 +4362,13 @@ iris_restore_compute_saved_bos(struct iris_context *ice,
    if (sampler_res)
       iris_use_pinned_bo(batch, iris_resource_bo(sampler_res), false);
 
+   if ((clean & IRIS_DIRTY_SAMPLER_STATES_CS) &&
+       (clean & IRIS_DIRTY_BINDINGS_CS) &&
+       (clean & IRIS_DIRTY_CONSTANTS_CS) &&
+       (clean & IRIS_DIRTY_CS)) {
+      iris_use_optional_res(batch, ice->state.last_res.cs_desc, false);
+   }
+
    if (clean & IRIS_DIRTY_CS) {
       struct iris_compiled_shader *shader = ice->shaders.prog[stage];
 
@@ -5531,7 +5538,6 @@ iris_upload_compute_state(struct iris_context *ice,
                 IRIS_DIRTY_BINDINGS_CS |
                 IRIS_DIRTY_CONSTANTS_CS |
                 IRIS_DIRTY_CS)) {
-      struct pipe_resource *desc_res = NULL;
       uint32_t desc[GENX(INTERFACE_DESCRIPTOR_DATA_length)];
 
       iris_pack_state(GENX(INTERFACE_DESCRIPTOR_DATA), desc, idd) {
@@ -5547,10 +5553,8 @@ iris_upload_compute_state(struct iris_context *ice,
             GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t);
          load.InterfaceDescriptorDataStartAddress =
             emit_state(batch, ice->state.dynamic_uploader,
-                       &desc_res, desc, sizeof(desc), 64);
+                       &ice->state.last_res.cs_desc, desc, sizeof(desc), 64);
       }
-
-      pipe_resource_reference(&desc_res, NULL);
    }
 
    uint32_t group_size = grid->block[0] * grid->block[1] * grid->block[2];
@@ -5658,6 +5662,7 @@ iris_destroy_state(struct iris_context *ice)
    pipe_resource_reference(&ice->state.last_res.blend, NULL);
    pipe_resource_reference(&ice->state.last_res.index_buffer, NULL);
    pipe_resource_reference(&ice->state.last_res.cs_thread_ids, NULL);
+   pipe_resource_reference(&ice->state.last_res.cs_desc, NULL);
 }
 
 /* ------------------------------------------------------------------- */