Mesa (master): panfrost: Import render condition check from fd

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 1 05:26:34 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Dec 31 23:44:32 2020 -0500

panfrost: Import render condition check from fd

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8292>

---

 src/gallium/drivers/panfrost/pan_context.h  |  3 +++
 src/gallium/drivers/panfrost/pan_resource.c | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 8ce673c9030..7d2f26a2809 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -344,6 +344,9 @@ panfrost_flush(
         struct pipe_fence_handle **fence,
         unsigned flags);
 
+bool
+pan_render_condition_check(struct pipe_context *pctx);
+
 mali_ptr panfrost_sfbd_fragment(struct panfrost_batch *batch, bool has_draws);
 mali_ptr panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws);
 
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 02e1bc3796c..64c0d0948fb 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -52,6 +52,25 @@
 #include "decode.h"
 #include "panfrost-quirks.h"
 
+bool
+pan_render_condition_check(struct pipe_context *pctx)
+{
+	struct panfrost_context *ctx = pan_context(pctx);
+
+	if (!ctx->cond_query)
+		return true;
+
+	union pipe_query_result res = { 0 };
+	bool wait =
+		ctx->cond_mode != PIPE_RENDER_COND_NO_WAIT &&
+		ctx->cond_mode != PIPE_RENDER_COND_BY_REGION_NO_WAIT;
+
+	if (pctx->get_query_result(pctx, (struct pipe_query *) ctx->cond_query, wait, &res))
+			return (bool)res.u64 != ctx->cond_cond;
+
+	return true;
+}
+
 static struct pipe_resource *
 panfrost_resource_from_handle(struct pipe_screen *pscreen,
                               const struct pipe_resource *templat,



More information about the mesa-commit mailing list