From: Dave Airlie Date: Thu, 23 Jan 2020 05:48:46 +0000 (+1000) Subject: llvmpipe/query: add support for indexed queries X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d70002744ca121bff51dd40bfa76b633320652c;p=mesa.git llvmpipe/query: add support for indexed queries This adds support for the queries needed for gpu_shader5 vertex streams Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 0e029f59122..b9bdfa10978 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -96,7 +96,7 @@ struct llvmpipe_context { struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS]; int num_so_targets; - struct pipe_query_data_so_statistics so_stats; + struct pipe_query_data_so_statistics so_stats[PIPE_MAX_VERTEX_STREAMS]; struct pipe_query_data_pipeline_statistics pipeline_statistics; unsigned active_statistics_queries; diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 276fd3bab78..75e3b47bfdb 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -61,6 +61,7 @@ llvmpipe_create_query(struct pipe_context *pipe, if (pq) { pq->type = type; + pq->index = index; } return (struct pipe_query *) pq; @@ -357,20 +358,20 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) switch (pq->type) { case PIPE_QUERY_PRIMITIVES_EMITTED: - pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; + pq->num_primitives_written = llvmpipe->so_stats[pq->index].num_primitives_written; break; case PIPE_QUERY_PRIMITIVES_GENERATED: - pq->num_primitives_generated = llvmpipe->so_stats.primitives_storage_needed; + pq->num_primitives_generated = llvmpipe->so_stats[pq->index].primitives_storage_needed; llvmpipe->active_primgen_queries++; break; case PIPE_QUERY_SO_STATISTICS: - pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; - pq->num_primitives_generated = llvmpipe->so_stats.primitives_storage_needed; + pq->num_primitives_written = llvmpipe->so_stats[pq->index].num_primitives_written; + pq->num_primitives_generated = llvmpipe->so_stats[pq->index].primitives_storage_needed; break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: - pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; - pq->num_primitives_generated = llvmpipe->so_stats.primitives_storage_needed; + pq->num_primitives_written = llvmpipe->so_stats[pq->index].num_primitives_written; + pq->num_primitives_generated = llvmpipe->so_stats[pq->index].primitives_storage_needed; break; case PIPE_QUERY_PIPELINE_STATISTICS: /* reset our cache */ @@ -406,26 +407,26 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) case PIPE_QUERY_PRIMITIVES_EMITTED: pq->num_primitives_written = - llvmpipe->so_stats.num_primitives_written - pq->num_primitives_written; + llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written; break; case PIPE_QUERY_PRIMITIVES_GENERATED: assert(llvmpipe->active_primgen_queries); llvmpipe->active_primgen_queries--; pq->num_primitives_generated = - llvmpipe->so_stats.primitives_storage_needed - pq->num_primitives_generated; + llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated; break; case PIPE_QUERY_SO_STATISTICS: pq->num_primitives_written = - llvmpipe->so_stats.num_primitives_written - pq->num_primitives_written; + llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written; pq->num_primitives_generated = - llvmpipe->so_stats.primitives_storage_needed - pq->num_primitives_generated; + llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated; break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: pq->num_primitives_written = - llvmpipe->so_stats.num_primitives_written - pq->num_primitives_written; + llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written; pq->num_primitives_generated = - llvmpipe->so_stats.primitives_storage_needed - pq->num_primitives_generated; + llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated; break; case PIPE_QUERY_PIPELINE_STATISTICS: pq->stats.ia_vertices = diff --git a/src/gallium/drivers/llvmpipe/lp_query.h b/src/gallium/drivers/llvmpipe/lp_query.h index 797375c8843..aa6707ce661 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.h +++ b/src/gallium/drivers/llvmpipe/lp_query.h @@ -46,6 +46,7 @@ struct llvmpipe_query { uint64_t end[LP_MAX_THREADS]; /* end count value for each thread */ struct lp_fence *fence; /* fence from last scene this was binned in */ unsigned type; /* PIPE_QUERY_* */ + unsigned index; unsigned num_primitives_generated; unsigned num_primitives_written; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c index 5dd318329e0..a400d79fb87 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c @@ -549,8 +549,8 @@ lp_setup_so_info(struct vbuf_render *vbr, uint stream, uint primitives, uint pri struct lp_setup_context *setup = lp_setup_context(vbr); struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); - lp->so_stats.num_primitives_written += primitives; - lp->so_stats.primitives_storage_needed += prim_generated; + lp->so_stats[stream].num_primitives_written += primitives; + lp->so_stats[stream].primitives_storage_needed += prim_generated; } static void