iris: Move depth/stencil flushes so they actually do something
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 9 Mar 2019 08:42:54 +0000 (00:42 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 11 Mar 2019 22:04:08 +0000 (15:04 -0700)
Commit d6dd57d43cd (iris: Add missing depth cache flushes) added the
depth/stencil flushes to the wrong place.  I meant to add them to the
iris_upload_dirty_render_state code that emits the packets, but I
accidentally added them to the nearly identical looking code in
iris_restore_render_saved_bos.  This meant we missed the actual flushing
at draw time, but instead did pointless flushing on the first draw in a
batch where things are already flushed anyway.

This commit moves them to iris_resolve.c, next to the depth prepares,
similar to what we do for color buffers.  i965 does them elsewhere, but
I'm not sure why - this seems like the most consistent place.

src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_state.c

index 6989f89aa21350995e5f36439a1c6e900249b9ce..7262c252afc06cd7c195c5bec0d5a49a85ac0353 100644 (file)
@@ -176,6 +176,11 @@ iris_predraw_resolve_framebuffer(struct iris_context *ice,
       if (z_res) {
          iris_resource_prepare_depth(ice, batch, z_res, zs_surf->u.tex.level,
                                      zs_surf->u.tex.first_layer, num_layers);
+         iris_cache_flush_for_depth(batch, z_res->bo);
+      }
+
+      if (s_res) {
+         iris_cache_flush_for_depth(batch, s_res->bo);
       }
    }
 
index d00186d66576bd8c975f633f977b7fdc658f4b78..a686188f701d3e91ab7dba850fe5ed65d95e4601 100644 (file)
@@ -4069,8 +4069,6 @@ iris_restore_render_saved_bos(struct iris_context *ice,
          iris_get_depth_stencil_resources(cso_fb->zsbuf->texture,
                                           &zres, &sres);
          if (zres) {
-            iris_cache_flush_for_depth(batch, zres->bo);
-
             iris_use_pinned_bo(batch, zres->bo,
                                ice->state.depth_writes_enabled);
             if (zres->aux.bo) {
@@ -4080,8 +4078,6 @@ iris_restore_render_saved_bos(struct iris_context *ice,
          }
 
          if (sres) {
-            iris_cache_flush_for_depth(batch, sres->bo);
-
             iris_use_pinned_bo(batch, sres->bo,
                                ice->state.stencil_writes_enabled);
          }