Mesa (master): iris: Add iris_resolve_conditional_render().

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 20 23:47:51 UTC 2019


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

Author: Rafael Antognolli <rafael.antognolli at intel.com>
Date:   Wed Mar  6 16:59:44 2019 -0800

iris: Add iris_resolve_conditional_render().

This function can be used to stall on the CPU and resolve the predicate
for the conditional render. It will convert ice->state.predicate from
IRIS_PREDICATE_STATE_USE_BIT to either IRIS_PREDICATE_STATE_RENDER or
IRIS_PREDICATE_STATE_DONT_RENDER, depending on the result of the query.

v2:
 - return void (Ken)
 - update the stored condition (Ken)
 - simplify the code leading to resolve the predicate (Ken)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/gallium/drivers/iris/iris_context.h |  6 ++++++
 src/gallium/drivers/iris/iris_query.c   | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 8f91d28446f..f3a5bdb7eb8 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -515,6 +515,11 @@ struct iris_context {
    } shaders;
 
    struct {
+      struct iris_query *query;
+      bool condition;
+   } condition;
+
+   struct {
       uint64_t dirty;
       uint64_t dirty_for_nos[IRIS_NOS_COUNT];
 
@@ -781,6 +786,7 @@ void iris_math_div32_gpr0(struct iris_context *ice,
 
 uint64_t iris_timebase_scale(const struct gen_device_info *devinfo,
                              uint64_t gpu_timestamp);
+void iris_resolve_conditional_render(struct iris_context *ice);
 
 /* iris_resolve.c */
 
diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c
index ec9050b6390..76816a7c0fd 100644
--- a/src/gallium/drivers/iris/iris_query.c
+++ b/src/gallium/drivers/iris/iris_query.c
@@ -1069,6 +1069,8 @@ iris_render_condition(struct pipe_context *ctx,
 
    /* The old condition isn't relevant; we'll update it if necessary */
    ice->state.compute_predicate = NULL;
+   ice->condition.query = q;
+   ice->condition.condition = condition;
 
    if (!q) {
       ice->state.predicate = IRIS_PREDICATE_STATE_RENDER;
@@ -1090,6 +1092,23 @@ iris_render_condition(struct pipe_context *ctx,
 }
 
 void
+iris_resolve_conditional_render(struct iris_context *ice)
+{
+   struct pipe_context *ctx = (void *) ice;
+   struct iris_query *q = ice->condition.query;
+   struct pipe_query *query = (void *) q;
+   union pipe_query_result result;
+
+   if (ice->state.predicate != IRIS_PREDICATE_STATE_USE_BIT)
+      return;
+
+   assert(q);
+
+   iris_get_query_result(ctx, query, true, &result);
+   set_predicate_enable(ice, (q->result != 0) ^ ice->condition.condition);
+}
+
+void
 iris_init_query_functions(struct pipe_context *ctx)
 {
    ctx->create_query = iris_create_query;




More information about the mesa-commit mailing list