[Mesa-dev] [PATCH 2/6] radeon: add streamout status 1-3 queries.

Marek Olšák maraeo at gmail.com
Tue Jul 28 10:57:15 PDT 2015


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, Jul 27, 2015 at 3:49 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This adds support for queries against the non-0 vertex streams.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/gallium/drivers/radeon/r600_query.c   | 18 ++++++++++++++++--
>  src/gallium/drivers/radeon/r600d_common.h |  3 +++
>  2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
> index a1d8241..f8072ea 100644
> --- a/src/gallium/drivers/radeon/r600_query.c
> +++ b/src/gallium/drivers/radeon/r600_query.c
> @@ -54,6 +54,8 @@ struct r600_query {
>         uint64_t end_result;
>         /* Fence for GPU_FINISHED. */
>         struct pipe_fence_handle *fence;
> +       /* For transform feedback: which stream the query is for */
> +       unsigned stream;
>  };
>
>
> @@ -155,6 +157,17 @@ static void r600_update_occlusion_query_state(struct r600_common_context *rctx,
>         }
>  }
>
> +static unsigned event_type_for_stream(struct r600_query *query)
> +{
> +       switch (query->stream) {
> +       default:
> +       case 0: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS;
> +       case 1: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS1;
> +       case 2: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS2;
> +       case 3: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS3;
> +       }
> +}
> +
>  static void r600_emit_query_begin(struct r600_common_context *ctx, struct r600_query *query)
>  {
>         struct radeon_winsys_cs *cs = ctx->rings.gfx.cs;
> @@ -189,7 +202,7 @@ static void r600_emit_query_begin(struct r600_common_context *ctx, struct r600_q
>         case PIPE_QUERY_SO_STATISTICS:
>         case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
>                 radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 2, 0));
> -               radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_SAMPLE_STREAMOUTSTATS) | EVENT_INDEX(3));
> +               radeon_emit(cs, EVENT_TYPE(event_type_for_stream(query)) | EVENT_INDEX(3));
>                 radeon_emit(cs, va);
>                 radeon_emit(cs, (va >> 32UL) & 0xFF);
>                 break;
> @@ -246,7 +259,7 @@ static void r600_emit_query_end(struct r600_common_context *ctx, struct r600_que
>         case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
>                 va += query->buffer.results_end + query->result_size/2;
>                 radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 2, 0));
> -               radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_SAMPLE_STREAMOUTSTATS) | EVENT_INDEX(3));
> +               radeon_emit(cs, EVENT_TYPE(event_type_for_stream(query)) | EVENT_INDEX(3));
>                 radeon_emit(cs, va);
>                 radeon_emit(cs, (va >> 32UL) & 0xFF);
>                 break;
> @@ -367,6 +380,7 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
>                 /* NumPrimitivesWritten, PrimitiveStorageNeeded. */
>                 query->result_size = 32;
>                 query->num_cs_dw = 6;
> +               query->stream = index;
>                 break;
>         case PIPE_QUERY_PIPELINE_STATISTICS:
>                 /* 11 values on EG, 8 on R600. */
> diff --git a/src/gallium/drivers/radeon/r600d_common.h b/src/gallium/drivers/radeon/r600d_common.h
> index 74c8d87..5a56a54 100644
> --- a/src/gallium/drivers/radeon/r600d_common.h
> +++ b/src/gallium/drivers/radeon/r600d_common.h
> @@ -66,6 +66,9 @@
>  #define PKT3_SET_SH_REG                        0x76 /* SI and later */
>  #define PKT3_SET_UCONFIG_REG                   0x79 /* CIK and later */
>
> +#define EVENT_TYPE_SAMPLE_STREAMOUTSTATS1      0x1 /* EG and later */
> +#define EVENT_TYPE_SAMPLE_STREAMOUTSTATS2      0x2 /* EG and later */
> +#define EVENT_TYPE_SAMPLE_STREAMOUTSTATS3      0x3 /* EG and later */
>  #define EVENT_TYPE_PS_PARTIAL_FLUSH            0x10
>  #define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14
>  #define EVENT_TYPE_ZPASS_DONE                  0x15
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list