iris: Switch to the new PIPELINE_STATISTICS_QUERY_SINGLE capability
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 11 Jan 2019 21:39:04 +0000 (13:39 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:11 +0000 (10:26 -0800)
I had a hack in place earlier to pass the query type as q->index
for the regular statistics query, but we ended up adjusting the
interface and adding a new query type.  Use that instead, fixing
pipeline statistics queries since the rebase.

src/gallium/drivers/iris/iris_query.c
src/gallium/drivers/iris/iris_screen.c

index 9d854f4bdcd17322b6b42a5270ccec15d48ef967..66169d1db05d0155d0a6c00867eaa336e04205ad 100644 (file)
@@ -235,7 +235,7 @@ write_value(struct iris_context *ice, struct iris_query *q, unsigned offset)
                                      SO_NUM_PRIMS_WRITTEN(q->index),
                                      q->bo, offset, false);
       break;
-   case PIPE_QUERY_PIPELINE_STATISTICS: {
+   case PIPE_QUERY_PIPELINE_STATISTICS_SINGLE: {
       static const uint32_t index_to_reg[] = {
          IA_VERTICES_COUNT,
          IA_PRIMITIVES_COUNT,
@@ -334,7 +334,7 @@ calculate_result_on_cpu(const struct gen_device_info *devinfo,
       for (int i = 0; i < MAX_VERTEX_STREAMS; i++)
          q->result |= stream_overflowed((void *) q->map, i);
       break;
-   case PIPE_QUERY_PIPELINE_STATISTICS:
+   case PIPE_QUERY_PIPELINE_STATISTICS_SINGLE:
       q->result = q->map->end - q->map->start;
 
       /* WaDividePSInvocationCountBy4:HSW,BDW */
@@ -702,7 +702,7 @@ calculate_result_on_gpu(struct iris_context *ice, struct iris_query *q)
 
    /* WaDividePSInvocationCountBy4:HSW,BDW */
    if (devinfo->gen == 8 &&
-       q->type == PIPE_QUERY_PIPELINE_STATISTICS &&
+       q->type == PIPE_QUERY_PIPELINE_STATISTICS_SINGLE &&
        q->index == PIPE_STAT_QUERY_PS_INVOCATIONS)
       shr_gpr0_by_2_bits(ice);
 
@@ -726,7 +726,7 @@ iris_create_query(struct pipe_context *ctx,
    q->type = query_type;
    q->index = index;
 
-   if (q->type == PIPE_QUERY_PIPELINE_STATISTICS &&
+   if (q->type == PIPE_QUERY_PIPELINE_STATISTICS_SINGLE &&
        q->index == PIPE_STAT_QUERY_CS_INVOCATIONS)
       q->batch_idx = IRIS_BATCH_COMPUTE;
    else
@@ -848,45 +848,7 @@ iris_get_query_result(struct pipe_context *ctx,
 
    assert(q->ready);
 
-   if (q->type == PIPE_QUERY_PIPELINE_STATISTICS) {
-      switch (q->index) {
-      case 0:
-         result->pipeline_statistics.ia_vertices = q->result;
-         break;
-      case 1:
-         result->pipeline_statistics.ia_primitives = q->result;
-         break;
-      case 2:
-         result->pipeline_statistics.vs_invocations = q->result;
-         break;
-      case 3:
-         result->pipeline_statistics.gs_invocations = q->result;
-         break;
-      case 4:
-         result->pipeline_statistics.gs_primitives = q->result;
-         break;
-      case 5:
-         result->pipeline_statistics.c_invocations = q->result;
-         break;
-      case 6:
-         result->pipeline_statistics.c_primitives = q->result;
-         break;
-      case 7:
-         result->pipeline_statistics.ps_invocations = q->result;
-         break;
-      case 8:
-         result->pipeline_statistics.hs_invocations = q->result;
-         break;
-      case 9:
-         result->pipeline_statistics.ds_invocations = q->result;
-         break;
-      case 10:
-         result->pipeline_statistics.cs_invocations = q->result;
-         break;
-      }
-   } else {
-      result->u64 = q->result;
-   }
+   result->u64 = q->result;
 
    return true;
 }
index 1976f6e949ead4bf6ba3baf8390bcc7c707dec82..64514cddbc4013c3501d5ad1964c0b0004705c70 100644 (file)
@@ -127,7 +127,7 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_MULTISAMPLE:
    case PIPE_CAP_CUBE_MAP_ARRAY:
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
-   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
+   case PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_TEXTURE_QUERY_LOD:
    case PIPE_CAP_SAMPLE_SHADING: