[Mesa-dev] [PATCH 4/7] softpipe: add support for indexed queries.
Roland Scheidegger
sroland at vmware.com
Wed May 27 18:58:01 PDT 2015
Am 27.05.2015 um 09:45 schrieb Dave Airlie:
> We need indexed queries to retrieve the geom shader info.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/drivers/softpipe/sp_context.h | 2 +-
> src/gallium/drivers/softpipe/sp_prim_vbuf.c | 4 ++--
> src/gallium/drivers/softpipe/sp_query.c | 23 ++++++++++++-----------
> src/gallium/include/pipe/p_state.h | 2 +-
> 4 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
> index 50a7336..fa91854 100644
> --- a/src/gallium/drivers/softpipe/sp_context.h
> +++ b/src/gallium/drivers/softpipe/sp_context.h
> @@ -91,7 +91,7 @@ struct softpipe_context {
> struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS];
> unsigned 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/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
> index 5809fd5..6c16d9c 100644
> --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
> +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
> @@ -602,8 +602,8 @@ sp_vbuf_so_info(struct vbuf_render *vbr, uint stream, uint primitives, uint prim
> struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
> struct softpipe_context *softpipe = cvbr->softpipe;
>
> - softpipe->so_stats.num_primitives_written += primitives;
> - softpipe->so_stats.primitives_storage_needed += prim_generated;
> + softpipe->so_stats[stream].num_primitives_written += primitives;
> + softpipe->so_stats[stream].primitives_storage_needed += prim_generated;
> }
>
> static void
> diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
> index e773870..0707219 100644
> --- a/src/gallium/drivers/softpipe/sp_query.c
> +++ b/src/gallium/drivers/softpipe/sp_query.c
> @@ -39,6 +39,7 @@
>
> struct softpipe_query {
> unsigned type;
> + unsigned index;
> uint64_t start;
> uint64_t end;
> struct pipe_query_data_so_statistics so;
> @@ -71,7 +72,7 @@ softpipe_create_query(struct pipe_context *pipe,
> type == PIPE_QUERY_TIMESTAMP_DISJOINT);
> sq = CALLOC_STRUCT( softpipe_query );
> sq->type = type;
> -
> + sq->index = index;
> return (struct pipe_query *)sq;
> }
>
> @@ -98,17 +99,17 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
> sq->start = os_time_get_nano();
> break;
> case PIPE_QUERY_SO_STATISTICS:
> - sq->so.num_primitives_written = softpipe->so_stats.num_primitives_written;
> - sq->so.primitives_storage_needed = softpipe->so_stats.primitives_storage_needed;
> + sq->so.num_primitives_written = softpipe->so_stats[0].num_primitives_written;
> + sq->so.primitives_storage_needed = softpipe->so_stats[0].primitives_storage_needed;
> break;
> case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
> sq->end = FALSE;
> break;
> case PIPE_QUERY_PRIMITIVES_EMITTED:
> - sq->so.num_primitives_written = softpipe->so_stats.num_primitives_written;
> + sq->so.num_primitives_written = softpipe->so_stats[sq->index].num_primitives_written;
> break;
> case PIPE_QUERY_PRIMITIVES_GENERATED:
> - sq->so.primitives_storage_needed = softpipe->so_stats.primitives_storage_needed;
> + sq->so.primitives_storage_needed = softpipe->so_stats[sq->index].primitives_storage_needed;
> break;
> case PIPE_QUERY_TIMESTAMP:
> case PIPE_QUERY_GPU_FINISHED:
> @@ -154,24 +155,24 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
> break;
> case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
> sq->so.num_primitives_written =
> - softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
> + softpipe->so_stats[0].num_primitives_written - sq->so.num_primitives_written;
> sq->so.primitives_storage_needed =
> - softpipe->so_stats.primitives_storage_needed - sq->so.primitives_storage_needed;
> + softpipe->so_stats[0].primitives_storage_needed - sq->so.primitives_storage_needed;
> sq->end = sq->so.primitives_storage_needed > sq->so.num_primitives_written;
> break;
> case PIPE_QUERY_SO_STATISTICS:
> sq->so.num_primitives_written =
> - softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
> + softpipe->so_stats[sq->index].num_primitives_written - sq->so.num_primitives_written;
> sq->so.primitives_storage_needed =
> - softpipe->so_stats.primitives_storage_needed - sq->so.primitives_storage_needed;
> + softpipe->so_stats[sq->index].primitives_storage_needed - sq->so.primitives_storage_needed;
> break;
> case PIPE_QUERY_PRIMITIVES_EMITTED:
> sq->so.num_primitives_written =
> - softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
> + softpipe->so_stats[sq->index].num_primitives_written - sq->so.num_primitives_written;
> break;
> case PIPE_QUERY_PRIMITIVES_GENERATED:
> sq->so.primitives_storage_needed =
> - softpipe->so_stats.primitives_storage_needed - sq->so.primitives_storage_needed;
> + softpipe->so_stats[sq->index].primitives_storage_needed - sq->so.primitives_storage_needed;
> break;
> case PIPE_QUERY_GPU_FINISHED:
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index e01c62c..b979730 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -68,7 +68,7 @@ extern "C" {
> #define PIPE_MAX_VIEWPORTS 16
> #define PIPE_MAX_CLIP_OR_CULL_DISTANCE_COUNT 8
> #define PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT 2
> -
> +#define PIPE_MAX_VERTEX_STREAMS 4
>
> struct pipe_reference
> {
>
I think this last hunk probably deserves its own commit as it is meant
to indicate a general gallium limit.
Roland
More information about the mesa-dev
mailing list