Mesa (master): panfrost: Do fine-grained flushing for occlusion query results
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 30 15:34:53 UTC 2020
Module: Mesa
Branch: master
Commit: 3e3958c44f78e882468a092557ec6b0b1404bc54
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e3958c44f78e882468a092557ec6b0b1404bc54
Author: Icecream95 <ixn at keemail.me>
Date: Sun Jun 28 20:48:36 2020 +1200
panfrost: Do fine-grained flushing for occlusion query results
This allows doing occlusion queries in one frame and getting the
results in the next frame without having to flush.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5676>
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 9 +++++++--
src/gallium/drivers/panfrost/pan_context.c | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 841e89d75a0..c1267b43f02 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -134,10 +134,15 @@ panfrost_vt_update_occlusion_query(struct panfrost_context *ctx,
struct mali_vertex_tiler_postfix *postfix)
{
SET_BIT(postfix->gl_enables, MALI_OCCLUSION_QUERY, ctx->occlusion_query);
- if (ctx->occlusion_query)
+ if (ctx->occlusion_query) {
postfix->occlusion_counter = ctx->occlusion_query->bo->gpu;
- else
+ panfrost_batch_add_bo(ctx->batch, ctx->occlusion_query->bo,
+ PAN_BO_ACCESS_SHARED |
+ PAN_BO_ACCESS_RW |
+ PAN_BO_ACCESS_FRAGMENT);
+ } else {
postfix->occlusion_counter = 0;
+ }
}
void
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 2ec636e1579..69f05e5beab 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1327,7 +1327,8 @@ panfrost_get_query_result(struct pipe_context *pipe,
case PIPE_QUERY_OCCLUSION_PREDICATE:
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
DBG("Flushing for occlusion query\n");
- panfrost_flush_all_batches(ctx, true);
+ panfrost_flush_batches_accessing_bo(ctx, query->bo, PAN_BO_ACCESS_WRITE);
+ panfrost_bo_wait(query->bo, INT64_MAX, PAN_BO_ACCESS_WRITE);
/* Read back the query results */
unsigned *result = (unsigned *) query->bo->cpu;
More information about the mesa-commit
mailing list