summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_query.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-09-28 12:07:54 +0200
committerKenneth Graunke <[email protected]>2019-02-21 10:26:08 -0800
commitd8875fe406afef3fe4aa945f266e1dcfd1900c37 (patch)
tree2a60fa0e316a8266b6c0c7366c4363c456c8a86e /src/gallium/drivers/iris/iris_query.c
parentffae6e310586022e5d0c9fd39baf827daff67a6c (diff)
iris: primitives generated query support
Diffstat (limited to 'src/gallium/drivers/iris/iris_query.c')
-rw-r--r--src/gallium/drivers/iris/iris_query.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c
index 374e9bf2065..5383c1f81df 100644
--- a/src/gallium/drivers/iris/iris_query.c
+++ b/src/gallium/drivers/iris/iris_query.c
@@ -38,24 +38,22 @@
#include "iris_resource.h"
#include "iris_screen.h"
-#define IA_VERTICES_COUNT 0x2310
-#define IA_PRIMITIVES_COUNT 0x2318
-#define VS_INVOCATION_COUNT 0x2320
-#define HS_INVOCATION_COUNT 0x2300
-#define DS_INVOCATION_COUNT 0x2308
-#define GS_INVOCATION_COUNT 0x2328
-#define GS_PRIMITIVES_COUNT 0x2330
-#define CL_INVOCATION_COUNT 0x2338
-#define CL_PRIMITIVES_COUNT 0x2340
-#define PS_INVOCATION_COUNT 0x2348
-#define CS_INVOCATION_COUNT 0x2290
-#define PS_DEPTH_COUNT 0x2350
-
-#define GEN6_SO_PRIM_STORAGE_NEEDED 0x2280
-#define GEN7_SO_PRIM_STORAGE_NEEDED(n) (0x5240 + (n) * 8)
-
-#define GEN6_SO_NUM_PRIMS_WRITTEN 0x2288
-#define GEN7_SO_NUM_PRIMS_WRITTEN(n) (0x5200 + (n) * 8)
+#define IA_VERTICES_COUNT 0x2310
+#define IA_PRIMITIVES_COUNT 0x2318
+#define VS_INVOCATION_COUNT 0x2320
+#define HS_INVOCATION_COUNT 0x2300
+#define DS_INVOCATION_COUNT 0x2308
+#define GS_INVOCATION_COUNT 0x2328
+#define GS_PRIMITIVES_COUNT 0x2330
+#define CL_INVOCATION_COUNT 0x2338
+#define CL_PRIMITIVES_COUNT 0x2340
+#define PS_INVOCATION_COUNT 0x2348
+#define CS_INVOCATION_COUNT 0x2290
+#define PS_DEPTH_COUNT 0x2350
+
+#define SO_PRIM_STORAGE_NEEDED(n) (0x5240 + (n) * 8)
+
+#define SO_NUM_PRIMS_WRITTEN(n) (0x5200 + (n) * 8)
#define CS_GPR(n) (0x2600 + (n) * 8)
@@ -198,6 +196,15 @@ write_value(struct iris_context *ice, struct iris_query *q, unsigned offset)
PIPE_CONTROL_WRITE_TIMESTAMP,
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_PIPELINE_STATISTICS: {
static const uint32_t index_to_reg[] = {
IA_VERTICES_COUNT,
@@ -340,6 +347,11 @@ iris_begin_query(struct pipe_context *ctx, struct pipe_query *query)
q->result = 0ull;
q->ready = false;
+ if (q->type == PIPE_QUERY_PRIMITIVES_GENERATED && q->index == 0) {
+ ice->state.prims_generated_query_active = true;
+ ice->state.dirty |= IRIS_DIRTY_STREAMOUT;
+ }
+
write_availability(ice, q, false);
write_value(ice, q, offsetof(struct iris_query_snapshots, start));
@@ -352,6 +364,11 @@ iris_end_query(struct pipe_context *ctx, struct pipe_query *query)
struct iris_context *ice = (void *) ctx;
struct iris_query *q = (void *) query;
+ if (q->type == PIPE_QUERY_PRIMITIVES_GENERATED && q->index == 0) {
+ ice->state.prims_generated_query_active = true;
+ ice->state.dirty |= IRIS_DIRTY_STREAMOUT;
+ }
+
write_value(ice, q, offsetof(struct iris_query_snapshots, end));
write_availability(ice, q, true);