iris: Flag ALL_DIRTY_BINDINGS on aux state change.
authorRafael Antognolli <rafael.antognolli@intel.com>
Wed, 20 Feb 2019 01:12:19 +0000 (17:12 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:12 +0000 (10:26 -0800)
If we change the aux state for a given resource, we need to re-emit the
binding table pointers for any stage that has such resource bound. Since
we don't track that, flag IRIS_ALL_DIRTY_BINDINGS and emit all of them.

src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_resource.h

index 8d888fdd4ed8ba15a9b2106bb9b8a7d227a87b06..e30e63f00cc4d0a9d678afacd089198a064aa011 100644 (file)
@@ -191,8 +191,11 @@ iris_predraw_resolve_framebuffer(struct iris_context *ice,
                                         ice->state.blend_enables & (1u << i),
                                         draw_aux_buffer_disabled[i]);
 
-      // XXX: NEW_AUX_STATE
-      ice->state.draw_aux_usage[i] = aux_usage;
+      if (ice->state.draw_aux_usage[i] != aux_usage) {
+         ice->state.draw_aux_usage[i] = aux_usage;
+         /* XXX: Need to track which bindings to make dirty */
+         ice->state.dirty |= IRIS_ALL_DIRTY_BINDINGS;
+      }
 
       iris_resource_prepare_render(ice, batch, res, surf->view.base_level,
                                    surf->view.base_array_layer,
@@ -805,12 +808,12 @@ iris_resource_prepare_ccs_access(struct iris_context *ice,
           * pass-through state.  (You can also think of this as being both a
           * resolve and an ambiguate in one operation.)
           */
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_PASS_THROUGH);
          break;
 
       case ISL_AUX_OP_PARTIAL_RESOLVE:
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_COMPRESSED_NO_CLEAR);
          break;
 
@@ -841,10 +844,10 @@ iris_resource_finish_ccs_write(struct iris_context *ice,
                 aux_usage == ISL_AUX_USAGE_CCS_D);
 
          if (aux_usage == ISL_AUX_USAGE_CCS_E) {
-            iris_resource_set_aux_state(res, level, layer, 1,
+            iris_resource_set_aux_state(ice, res, level, layer, 1,
                                         ISL_AUX_STATE_COMPRESSED_CLEAR);
          } else if (aux_state != ISL_AUX_STATE_PARTIAL_CLEAR) {
-            iris_resource_set_aux_state(res, level, layer, 1,
+            iris_resource_set_aux_state(ice, res, level, layer, 1,
                                         ISL_AUX_STATE_PARTIAL_CLEAR);
          }
          break;
@@ -856,7 +859,7 @@ iris_resource_finish_ccs_write(struct iris_context *ice,
 
       case ISL_AUX_STATE_PASS_THROUGH:
          if (aux_usage == ISL_AUX_USAGE_CCS_E) {
-            iris_resource_set_aux_state(res, level, layer, 1,
+            iris_resource_set_aux_state(ice, res, level, layer, 1,
                                         ISL_AUX_STATE_COMPRESSED_NO_CLEAR);
          } else {
             /* Nothing to do */
@@ -873,7 +876,7 @@ iris_resource_finish_ccs_write(struct iris_context *ice,
       switch (aux_state) {
       case ISL_AUX_STATE_CLEAR:
          assert(aux_usage == ISL_AUX_USAGE_CCS_D);
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_PARTIAL_CLEAR);
          break;
 
@@ -909,7 +912,7 @@ iris_resource_prepare_mcs_access(struct iris_context *ice,
    case ISL_AUX_STATE_COMPRESSED_CLEAR:
       if (!fast_clear_supported) {
          iris_mcs_partial_resolve(ice, batch, res, layer, 1);
-         iris_resource_set_aux_state(res, 0, layer, 1,
+         iris_resource_set_aux_state(ice, res, 0, layer, 1,
                                      ISL_AUX_STATE_COMPRESSED_NO_CLEAR);
       }
       break;
@@ -935,7 +938,7 @@ iris_resource_finish_mcs_write(struct iris_context *ice,
 
    switch (iris_resource_get_aux_state(res, 0, layer)) {
    case ISL_AUX_STATE_CLEAR:
-      iris_resource_set_aux_state(res, 0, layer, 1,
+      iris_resource_set_aux_state(ice, res, 0, layer, 1,
                                   ISL_AUX_STATE_COMPRESSED_CLEAR);
       break;
 
@@ -992,13 +995,13 @@ iris_resource_prepare_hiz_access(struct iris_context *ice,
 
       switch (hiz_op) {
       case ISL_AUX_OP_FULL_RESOLVE:
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_RESOLVED);
          break;
 
       case ISL_AUX_OP_AMBIGUATE:
          /* The HiZ resolve operation is actually an ambiguate */
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_PASS_THROUGH);
          break;
 
@@ -1019,7 +1022,7 @@ iris_resource_finish_hiz_write(struct iris_context *ice,
    switch (iris_resource_get_aux_state(res, level, layer)) {
    case ISL_AUX_STATE_CLEAR:
       assert(aux_usage == ISL_AUX_USAGE_HIZ);
-      iris_resource_set_aux_state(res, level, layer, 1,
+      iris_resource_set_aux_state(ice, res, level, layer, 1,
                                   ISL_AUX_STATE_COMPRESSED_CLEAR);
       break;
 
@@ -1030,17 +1033,17 @@ iris_resource_finish_hiz_write(struct iris_context *ice,
 
    case ISL_AUX_STATE_RESOLVED:
       if (aux_usage == ISL_AUX_USAGE_HIZ) {
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_COMPRESSED_NO_CLEAR);
       } else {
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_AUX_INVALID);
       }
       break;
 
    case ISL_AUX_STATE_PASS_THROUGH:
       if (aux_usage == ISL_AUX_USAGE_HIZ) {
-         iris_resource_set_aux_state(res, level, layer, 1,
+         iris_resource_set_aux_state(ice, res, level, layer, 1,
                                      ISL_AUX_STATE_COMPRESSED_NO_CLEAR);
       }
       break;
@@ -1176,7 +1179,8 @@ iris_resource_get_aux_state(const struct iris_resource *res,
 }
 
 void
-iris_resource_set_aux_state(struct iris_resource *res, uint32_t level,
+iris_resource_set_aux_state(struct iris_context *ice,
+                            struct iris_resource *res, uint32_t level,
                             uint32_t start_layer, uint32_t num_layers,
                             enum isl_aux_state aux_state)
 {
@@ -1194,8 +1198,8 @@ iris_resource_set_aux_state(struct iris_resource *res, uint32_t level,
    for (unsigned a = 0; a < num_layers; a++) {
       if (res->aux.state[level][start_layer + a] != aux_state) {
          res->aux.state[level][start_layer + a] = aux_state;
-         // XXX: dirty works differently
-         // brw->ctx.NewDriverState |= BRW_NEW_AUX_STATE;
+         /* XXX: Need to track which bindings to make dirty */
+         ice->state.dirty |= IRIS_ALL_DIRTY_BINDINGS;
       }
    }
 }
index 2184ac17082d9945110b52167a3b7181f832ccc1..b5829e94b36d986edb308a22698f532f256ba742 100644 (file)
@@ -767,7 +767,10 @@ iris_resource_get_handle(struct pipe_screen *pscreen,
                                    0, INTEL_REMAINING_LEVELS,
                                    0, INTEL_REMAINING_LAYERS,
                                    ISL_AUX_USAGE_NONE, false);
-      iris_resource_disable_aux(res);
+      if (res->aux.usage != ISL_AUX_USAGE_NONE) {
+         iris_resource_disable_aux(res);
+         ice->state.dirty |= IRIS_ALL_DIRTY_BINDINGS;
+      }
    } else {
       if (res->aux.usage != ISL_AUX_USAGE_NONE) {
          enum isl_aux_state aux_state =
index 26451cbed4b5af5bdd219ca7283147d4cbac32aa..8b5d176191ea875ef7e040a1f13923bf12f3bb94 100644 (file)
@@ -294,7 +294,8 @@ iris_resource_get_aux_state(const struct iris_resource *res,
  * use iris_resource_prepare_access or iris_resource_finish_write.
  */
 void
-iris_resource_set_aux_state(struct iris_resource *res, uint32_t level,
+iris_resource_set_aux_state(struct iris_context *ice,
+                            struct iris_resource *res, uint32_t level,
                             uint32_t start_layer, uint32_t num_layers,
                             enum isl_aux_state aux_state);