Module: Mesa
Branch: main
Commit: 936f2ebb4683cd625303a09e2684267123642897
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=936f2ebb4683cd625303a09e2684267123642897

Author: Rob Clark <[email protected]>
Date:   Wed Feb 15 12:03:01 2023 -0800

freedreno/a6xx: Remove needs_invalidate flag

Whether the rsc seqno has changed tells us whether we need to update.

Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21408>

---

 src/gallium/drivers/freedreno/a6xx/fd6_texture.c | 11 ++++++-----
 src/gallium/drivers/freedreno/a6xx/fd6_texture.h |  2 --
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c 
b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c
index 39476626c7a..e55e9c84714 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c
@@ -344,7 +344,6 @@ fd6_sampler_view_create(struct pipe_context *pctx, struct 
pipe_resource *prsc,
    so->base.texture = prsc;
    so->base.reference.count = 1;
    so->base.context = pctx;
-   so->needs_validate = true;
 
    return &so->base;
 }
@@ -367,15 +366,13 @@ fd6_set_sampler_views(struct pipe_context *pctx, enum 
pipe_shader_type shader,
    for (unsigned i = 0; i < nr; i++) {
       struct fd6_pipe_sampler_view *so = fd6_pipe_sampler_view(views[i + 
start]);
 
-      if (!(so && so->needs_validate))
+      if (!so)
          continue;
 
       struct fd_resource *rsc = fd_resource(so->base.texture);
 
       fd6_validate_format(ctx, rsc, so->base.format);
       fd6_sampler_view_update(ctx, so);
-
-      so->needs_validate = false;
    }
 }
 
@@ -388,7 +385,11 @@ fd6_sampler_view_update(struct fd_context *ctx,
    struct fd_resource *rsc = fd_resource(prsc);
    enum pipe_format format = cso->format;
 
-   fd6_validate_format(ctx, rsc, cso->format);
+   fd6_assert_valid_format(rsc, cso->format);
+
+   /* If texture has not had a layout change, then no update needed: */
+   if (so->rsc_seqno == rsc->seqno)
+      return;
 
    so->seqno = seqno_next_u16(&fd6_context(ctx)->tex_seqno);
    so->rsc_seqno = rsc->seqno;
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.h 
b/src/gallium/drivers/freedreno/a6xx/fd6_texture.h
index 278a4e56560..ff1074e73fd 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.h
@@ -86,8 +86,6 @@ struct fd6_pipe_sampler_view {
     * to uncompressed, which means the sampler state needs to be updated
     */
    uint16_t rsc_seqno;
-
-   bool needs_validate;
 };
 
 static inline struct fd6_pipe_sampler_view *

Reply via email to