Mesa (main): zink: make descriptors_update hook return a bool if a flush occurred
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jul 20 00:37:34 UTC 2021
Module: Mesa
Branch: main
Commit: f2f1892e621c892606db73df493ad21f708bbb92
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2f1892e621c892606db73df493ad21f708bbb92
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue May 11 17:49:05 2021 -0400
zink: make descriptors_update hook return a bool if a flush occurred
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11964>
---
src/gallium/drivers/zink/zink_descriptors.c | 4 +++-
src/gallium/drivers/zink/zink_descriptors.h | 4 ++--
src/gallium/drivers/zink/zink_descriptors_lazy.c | 7 +++++--
src/gallium/drivers/zink/zink_screen.h | 2 +-
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c
index 54d7eef3e83..71f4291e3d2 100644
--- a/src/gallium/drivers/zink/zink_descriptors.c
+++ b/src/gallium/drivers/zink/zink_descriptors.c
@@ -1324,10 +1324,11 @@ update_descriptors_internal(struct zink_context *ctx, struct zink_descriptor_set
static void
zink_context_update_descriptor_states(struct zink_context *ctx, struct zink_program *pg);
-void
+bool
zink_descriptors_update(struct zink_context *ctx, bool is_compute)
{
struct zink_program *pg = is_compute ? (struct zink_program *)ctx->curr_compute : (struct zink_program *)ctx->curr_program;
+ struct zink_batch_state *bs = ctx->batch.state;
zink_context_update_descriptor_states(ctx, pg);
bool cache_hit[ZINK_DESCRIPTOR_TYPES + 1];
@@ -1376,6 +1377,7 @@ zink_descriptors_update(struct zink_context *ctx, bool is_compute)
pg->layout, 0, pg->num_dsl, sets,
dynamic_offset_idx, dynamic_offsets);
ctx->dd->pg[is_compute] = pg;
+ return bs != batch->state;
}
void
diff --git a/src/gallium/drivers/zink/zink_descriptors.h b/src/gallium/drivers/zink/zink_descriptors.h
index 09e72546343..34d3796140a 100644
--- a/src/gallium/drivers/zink/zink_descriptors.h
+++ b/src/gallium/drivers/zink/zink_descriptors.h
@@ -227,7 +227,7 @@ zink_descriptor_program_init(struct zink_context *ctx, struct zink_program *pg);
void
zink_descriptor_program_deinit(struct zink_screen *screen, struct zink_program *pg);
-void
+bool
zink_descriptors_update(struct zink_context *ctx, bool is_compute);
@@ -261,7 +261,7 @@ zink_descriptor_program_init_lazy(struct zink_context *ctx, struct zink_program
void
zink_descriptor_program_deinit_lazy(struct zink_screen *screen, struct zink_program *pg);
-void
+bool
zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute);
diff --git a/src/gallium/drivers/zink/zink_descriptors_lazy.c b/src/gallium/drivers/zink/zink_descriptors_lazy.c
index e9abd90025b..1caeadab462 100644
--- a/src/gallium/drivers/zink/zink_descriptors_lazy.c
+++ b/src/gallium/drivers/zink/zink_descriptors_lazy.c
@@ -393,13 +393,14 @@ zink_descriptor_set_update_lazy(struct zink_context *ctx, struct zink_program *p
screen->vk.UpdateDescriptorSetWithTemplate(screen->dev, set, pg->dd->layouts[type + 1]->desc_template, ctx);
}
-void
+bool
zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
struct zink_batch *batch = &ctx->batch;
struct zink_batch_state *bs = ctx->batch.state;
struct zink_program *pg = is_compute ? &ctx->curr_compute->base : &ctx->curr_program->base;
+ bool ret = false;
bool batch_changed = !bdd_lazy(bs)->pg[is_compute];
if (batch_changed) {
@@ -431,11 +432,12 @@ zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute)
(dd_lazy(ctx)->push_state_changed[is_compute] || batch_changed);
if (!populate_sets(ctx, pg, &changed_sets, need_push, desc_sets)) {
debug_printf("ZINK: couldn't get descriptor sets!\n");
- return;
+ return false;
}
if (ctx->batch.state != bs) {
/* recheck: populate may have overflowed the pool and triggered a flush */
batch_changed = true;
+ ret = true;
dd_lazy(ctx)->state_changed[is_compute] = pg->dd->binding_usage;
changed_sets = pg->dd->binding_usage & dd_lazy(ctx)->state_changed[is_compute];
dd_lazy(ctx)->push_state_changed[is_compute] = !!pg->dd->push_usage;
@@ -479,6 +481,7 @@ zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute)
/* set again in case of flushing */
bdd_lazy(bs)->pg[is_compute] = pg;
ctx->dd->pg[is_compute] = pg;
+ return ret;
}
void
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index da911f958ee..703152627bc 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -131,7 +131,7 @@ struct zink_screen {
bool (*descriptor_program_init)(struct zink_context *ctx, struct zink_program *pg);
void (*descriptor_program_deinit)(struct zink_screen *screen, struct zink_program *pg);
- void (*descriptors_update)(struct zink_context *ctx, bool is_compute);
+ bool (*descriptors_update)(struct zink_context *ctx, bool is_compute);
void (*context_update_descriptor_states)(struct zink_context *ctx, bool is_compute);
void (*context_invalidate_descriptor_state)(struct zink_context *ctx, enum pipe_shader_type shader,
enum zink_descriptor_type type,
More information about the mesa-commit
mailing list