Mesa (master): freedreno: Use ctx seqno in batch cache key
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 10 18:27:28 UTC 2020
Module: Mesa
Branch: master
Commit: b1b8e0f8d158758ea9756e226ea807ea296cb787
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1b8e0f8d158758ea9756e226ea807ea296cb787
Author: Rob Clark <robdclark at chromium.org>
Date: Sat Oct 24 12:09:12 2020 -0700
freedreno: Use ctx seqno in batch cache key
It is smaller than a pointer, and doesn't run into problems of context
destroy/create cycle ending up with the same address.
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
---
src/gallium/drivers/freedreno/freedreno_batch_cache.c | 11 +++++++----
src/gallium/drivers/freedreno/freedreno_context.c | 1 +
src/gallium/drivers/freedreno/freedreno_context.h | 3 +++
src/gallium/drivers/freedreno/freedreno_screen.h | 1 +
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
index f0f0bbbaca4..0d0064c6ce7 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
@@ -77,9 +77,12 @@
*/
struct key {
- uint32_t width, height, layers;
- uint16_t samples, num_surfs;
- struct fd_context *ctx;
+ uint32_t width;
+ uint32_t height;
+ uint16_t layers;
+ uint16_t samples;
+ uint16_t num_surfs;
+ uint16_t ctx_seqno;
struct {
struct pipe_resource *texture;
union pipe_surface_desc u;
@@ -478,7 +481,7 @@ fd_batch_from_fb(struct fd_batch_cache *cache, struct fd_context *ctx,
key->height = pfb->height;
key->layers = pfb->layers;
key->samples = util_framebuffer_get_num_samples(pfb);
- key->ctx = ctx;
+ key->ctx_seqno = ctx->seqno;
if (pfb->zsbuf)
key_surf(key, idx++, 0, pfb->zsbuf);
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 20ee0191832..0d3c5e6c15e 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -507,6 +507,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
list_inithead(&ctx->log_chunks);
fd_screen_lock(ctx->screen);
+ ctx->seqno = ++screen->ctx_seqno;
list_add(&ctx->node, &ctx->screen->context_list);
fd_screen_unlock(ctx->screen);
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index e73a4694962..7637f0b4788 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -305,6 +305,9 @@ struct fd_context {
*/
uint32_t context_reset_count, global_reset_count;
+ /* Context sequence #, used for batch-cache key: */
+ uint16_t seqno;
+
/* Are we in process of shadowing a resource? Used to detect recursion
* in transfer_map, and skip unneeded synchronization.
*/
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h
index bc1d8212a77..684c42c5dec 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.h
+++ b/src/gallium/drivers/freedreno/freedreno_screen.h
@@ -116,6 +116,7 @@ struct fd_screen {
bool reorder;
uint16_t rsc_seqno;
+ uint16_t ctx_seqno;
unsigned num_supported_modifiers;
const uint64_t *supported_modifiers;
More information about the mesa-commit
mailing list