iris: ...and SO prims emitted queries
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 28 Sep 2018 10:39:10 +0000 (12:39 +0200)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:08 +0000 (10:26 -0800)
looks like we have queries

some fails still due to races between snapshots_written and start/end
not being garbage...not sure what that's about

src/gallium/drivers/iris/iris_query.c

index 4d6fda816b706a0ec5b8ca4959f6b0f4e769a64a..46006d493c787094d122691a60e93dae037481ad 100644 (file)
@@ -172,6 +172,12 @@ write_value(struct iris_context *ice, struct iris_query *q, unsigned offset)
    struct iris_batch *batch = &ice->render_batch;
    const struct gen_device_info *devinfo = &batch->screen->devinfo;
 
+   if (!iris_is_query_pipelined(q)) {
+      iris_emit_pipe_control_flush(batch,
+                                   PIPE_CONTROL_CS_STALL |
+                                   PIPE_CONTROL_STALL_AT_SCOREBOARD);
+   }
+
    switch (q->type) {
    case PIPE_QUERY_OCCLUSION_COUNTER:
    case PIPE_QUERY_OCCLUSION_PREDICATE:
@@ -196,14 +202,16 @@ write_value(struct iris_context *ice, struct iris_query *q, unsigned offset)
                            offset);
       break;
    case PIPE_QUERY_PRIMITIVES_GENERATED:
-      iris_emit_pipe_control_flush(batch,
-                                   PIPE_CONTROL_CS_STALL |
-                                   PIPE_CONTROL_STALL_AT_SCOREBOARD);
       ice->vtbl.store_register_mem64(batch,
                                      q->index == 0 ? CL_INVOCATION_COUNT :
                                      SO_PRIM_STORAGE_NEEDED(q->index),
                                      q->bo, offset, false);
       break;
+   case PIPE_QUERY_PRIMITIVES_EMITTED:
+      ice->vtbl.store_register_mem64(batch,
+                                     SO_NUM_PRIMS_WRITTEN(q->index),
+                                     q->bo, offset, false);
+      break;
    case PIPE_QUERY_PIPELINE_STATISTICS: {
       static const uint32_t index_to_reg[] = {
          IA_VERTICES_COUNT,
@@ -220,10 +228,6 @@ write_value(struct iris_context *ice, struct iris_query *q, unsigned offset)
       };
       const uint32_t reg = index_to_reg[q->index];
 
-      iris_emit_pipe_control_flush(batch,
-                                   PIPE_CONTROL_CS_STALL |
-                                   PIPE_CONTROL_STALL_AT_SCOREBOARD);
-
       ice->vtbl.store_register_mem64(batch, reg, q->bo, offset, false);
       break;
    }