Mesa (staging/20.3): iris: Consider resolves after changing a resource's aux state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 25 18:50:21 UTC 2021


Module: Mesa
Branch: staging/20.3
Commit: 127e9ef456326fbc31cb1dd5621a43c8e2598a75
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=127e9ef456326fbc31cb1dd5621a43c8e2598a75

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Jan 20 14:10:49 2021 -0800

iris: Consider resolves after changing a resource's aux state

The intention of IRIS_DIRTY_{RENDER,COMPUTE}_RESOLVES_AND_FLUSHES
is to avoid considering resolves/flushes on back to back draw calls
where nothing of significance has changed with the resources.  When
anything changes that could require a resolve, we must flag those.

Those situations are:
1. Texture/image/framebuffer bindings change
   (as the set of images we need to look at is now different)
2. Depth writes are enabled/disabled (the resolve code uses this)
3. The aux state for a currently bound resource changes.

We were missing this last case.  In particular, one example where
we missed this was:

1. Bind a texture.
2. Clear that texture (likely blits/copies/teximage would work too)
3. Draw and sample from that texture

Clear-then-Bind would work, as binding would flag resolves as dirty.
But Bind-then-Clear doesn't work, as clear can change the aux state
of the bound texture, but wasn't flagging that anything had changed.

Technically, we could consider whether the resource whose aux state
is changing is bound for compute (and only flag COMPUTE_RESOLVES),
or bound for a 3D stage (and only flag RENDER_RESOLVES), and flag
nothing at all if it isn't bound.  But we don't track that well,
and it probably isn't worth bothering.  So, flag unconditionally
for now.

This does not appear to impact Piglit's drawoverhead scores.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3994
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4019
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8603>
(cherry picked from commit e2500c02cc7bd429e035c5208e533e569c525b03)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/iris/iris_resolve.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e3c03daf0f9..bd83a9acdf3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -355,7 +355,7 @@
         "description": "iris: Consider resolves after changing a resource's aux state",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c
index 276ad62b1dd..045f43ed8c0 100644
--- a/src/gallium/drivers/iris/iris_resolve.c
+++ b/src/gallium/drivers/iris/iris_resolve.c
@@ -793,7 +793,9 @@ iris_resource_set_aux_state(struct iris_context *ice,
       if (res->aux.state[level][start_layer + a] != aux_state) {
          res->aux.state[level][start_layer + a] = aux_state;
          /* XXX: Need to track which bindings to make dirty */
-         ice->state.dirty |= IRIS_DIRTY_RENDER_BUFFER;
+         ice->state.dirty |= IRIS_DIRTY_RENDER_BUFFER |
+                             IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES |
+                             IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES;
          ice->state.stage_dirty |= IRIS_ALL_STAGE_DIRTY_BINDINGS;
       }
    }



More information about the mesa-commit mailing list