Mesa (master): iris: Update SURFACE_STATE addresses when setting sampler views

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 25 23:55:40 UTC 2019


Module: Mesa
Branch: master
Commit: f6aa51103b134b2cfdc4517cf251a180bd71cebc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6aa51103b134b2cfdc4517cf251a180bd71cebc

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Nov 15 15:18:06 2019 -0800

iris: Update SURFACE_STATE addresses when setting sampler views

We may have replaced the backing storage for a texture buffer while it
was unbound, at which point iris_rebind_buffer would not have caught it
and updated it.  We need to ensure that the current resource's address
matches the one our SURFACE_STATE points at.  If not, update addresses
and re-upload the SURFACE_STATE.

Shader images and buffers do not suffer from this problem because we
re-stream the surface state on every set call, since there isn't a
created CSO object for those with a saved SURFACE_STATE.  Constant
buffers are also currently re-streamed (we pitch the SURFACE_STATE
on every set_constant_buffer call).  Surfaces would need this
treatment (as they're created CSOs) except that we never swap out
their backing storage today (we only do it for buffers), so it's OK
for now.

Fixes misrendering in Unreal 4 demos (Elemental, Matinee Fight Scene).
Huge thanks to Andrii Simiklit for tracking down the problem - it was
quite difficult to find!  Also fixes Andrii's new Piglit test for the
bug, 'arb_texture_buffer_object-re-init'.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1365

---

 src/gallium/drivers/iris/iris_state.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 2a1e53d9643..a30aa61b3ce 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2790,6 +2790,9 @@ iris_set_sampler_views(struct pipe_context *ctx,
          view->res->bind_stages |= 1 << stage;
 
          shs->bound_sampler_views |= 1 << (start + i);
+
+         update_surface_state_addrs(ice->state.surface_uploader,
+                                    &view->surface_state, view->res->bo);
       }
    }
 




More information about the mesa-commit mailing list