<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 21, 2018, 6:28 PM Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That seems like a reasonable interface to me.<br>
<br>
But, I don't think it's backwards compatible.  Today, don't state<br>
trackers set index = 0 and expect all 11 to be returned?  We could<br>
easily change the in-tree state trackers, but not sure about the<br>
other ones.<br>
<br>
We could always encode the index differently, but at that point, I<br>
wonder if it would be cleaner to just add a new query type like Ilia<br>
suggested.<br>
<br>
Marek, what would you prefer?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Backward compatibility is not required. Gallium is not a stable API. In tree state trackers can be fixed easily. We shouldn't worry too much about closed source state trackers.</div><div dir="auto"><br></div><div dir="auto">Marek</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
--Ken<br>
<br>
On Friday, December 21, 2018 1:24:32 PM PST Marek Olšák wrote:<br>
> The series looks good. Another way to distinguish between return one and<br>
> return all is to use "index". index <= 11 returns one. index == ~0 returns<br>
> all. This is the least intrusive.<br>
> <br>
> st/mesa and gallium/hud always want to get one.<br>
> st/nine and util/u_helpers always want to get all.<br>
> <br>
> Marek<br>
> <br>
> On Sat, Dec 15, 2018 at 4:45 AM Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank" rel="noreferrer">kenneth@whitecape.org</a>><br>
> wrote:<br>
> <br>
> > Gallium handles pipeline statistics queries as a single query<br>
> > (PIPE_QUERY_PIPELINE_STATISTICS) which returns a struct with 11 values.<br>
> > Sometimes it's useful to refer to each of those values individually,<br>
> > rather than as a group.  To avoid hardcoding numbers, we define a new<br>
> > enum for each value.  Here, the name and enum value correspond to the<br>
> > index in the struct pipe_query_data_pipeline_statistics result.<br>
> ><br>
> > Cc: Roland Scheidegger <<a href="mailto:sroland@vmware.com" target="_blank" rel="noreferrer">sroland@vmware.com</a>><br>
> > ---<br>
> >  src/gallium/include/pipe/p_defines.h    | 17 +++++++++++++++++<br>
> >  src/mesa/state_tracker/st_cb_queryobj.c | 22 +++++++++++-----------<br>
> >  2 files changed, 28 insertions(+), 11 deletions(-)<br>
> ><br>
> > diff --git a/src/gallium/include/pipe/p_defines.h<br>
> > b/src/gallium/include/pipe/p_defines.h<br>
> > index 6d96f1ccb5b..21005955a36 100644<br>
> > --- a/src/gallium/include/pipe/p_defines.h<br>
> > +++ b/src/gallium/include/pipe/p_defines.h<br>
> > @@ -568,6 +568,23 @@ enum pipe_query_type {<br>
> >     PIPE_QUERY_DRIVER_SPECIFIC = 256,<br>
> >  };<br>
> ><br>
> > +/**<br>
> > + * Index for PIPE_QUERY_PIPELINE_STATISTICS subqueries.<br>
> > + */<br>
> > +enum pipe_statistics_query_index {<br>
> > +   PIPE_STAT_QUERY_IA_VERTICES,<br>
> > +   PIPE_STAT_QUERY_IA_PRIMITIVES,<br>
> > +   PIPE_STAT_QUERY_VS_INVOCATIONS,<br>
> > +   PIPE_STAT_QUERY_GS_INVOCATIONS,<br>
> > +   PIPE_STAT_QUERY_GS_PRIMITIVES,<br>
> > +   PIPE_STAT_QUERY_C_INVOCATIONS,<br>
> > +   PIPE_STAT_QUERY_C_PRIMITIVES,<br>
> > +   PIPE_STAT_QUERY_PS_INVOCATIONS,<br>
> > +   PIPE_STAT_QUERY_HS_INVOCATIONS,<br>
> > +   PIPE_STAT_QUERY_DS_INVOCATIONS,<br>
> > +   PIPE_STAT_QUERY_CS_INVOCATIONS,<br>
> > +};<br>
> > +<br>
> >  /**<br>
> >   * Conditional rendering modes<br>
> >   */<br>
> > diff --git a/src/mesa/state_tracker/st_cb_queryobj.c<br>
> > b/src/mesa/state_tracker/st_cb_queryobj.c<br>
> > index 69e6004c3f1..82f53243336 100644<br>
> > --- a/src/mesa/state_tracker/st_cb_queryobj.c<br>
> > +++ b/src/mesa/state_tracker/st_cb_queryobj.c<br>
> > @@ -386,37 +386,37 @@ st_StoreQueryResult(struct gl_context *ctx, struct<br>
> > gl_query_object *q,<br>
> >     } else if (stq->type == PIPE_QUERY_PIPELINE_STATISTICS) {<br>
> >        switch (q->Target) {<br>
> >        case GL_VERTICES_SUBMITTED_ARB:<br>
> > -         index = 0;<br>
> > +         index = PIPE_STAT_QUERY_IA_VERTICES;<br>
> >           break;<br>
> >        case GL_PRIMITIVES_SUBMITTED_ARB:<br>
> > -         index = 1;<br>
> > +         index = PIPE_STAT_QUERY_IA_PRIMITIVES;<br>
> >           break;<br>
> >        case GL_VERTEX_SHADER_INVOCATIONS_ARB:<br>
> > -         index = 2;<br>
> > +         index = PIPE_STAT_QUERY_VS_INVOCATIONS;<br>
> >           break;<br>
> >        case GL_GEOMETRY_SHADER_INVOCATIONS:<br>
> > -         index = 3;<br>
> > +         index = PIPE_STAT_QUERY_GS_INVOCATIONS;<br>
> >           break;<br>
> >        case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB:<br>
> > -         index = 4;<br>
> > +         index = PIPE_STAT_QUERY_GS_PRIMITIVES;<br>
> >           break;<br>
> >        case GL_CLIPPING_INPUT_PRIMITIVES_ARB:<br>
> > -         index = 5;<br>
> > +         index = PIPE_STAT_QUERY_C_INVOCATIONS;<br>
> >           break;<br>
> >        case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:<br>
> > -         index = 6;<br>
> > +         index = PIPE_STAT_QUERY_C_PRIMITIVES;<br>
> >           break;<br>
> >        case GL_FRAGMENT_SHADER_INVOCATIONS_ARB:<br>
> > -         index = 7;<br>
> > +         index = PIPE_STAT_QUERY_PS_INVOCATIONS;<br>
> >           break;<br>
> >        case GL_TESS_CONTROL_SHADER_PATCHES_ARB:<br>
> > -         index = 8;<br>
> > +         index = PIPE_STAT_QUERY_HS_INVOCATIONS;<br>
> >           break;<br>
> >        case GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB:<br>
> > -         index = 9;<br>
> > +         index = PIPE_STAT_QUERY_DS_INVOCATIONS;<br>
> >           break;<br>
> >        case GL_COMPUTE_SHADER_INVOCATIONS_ARB:<br>
> > -         index = 10;<br>
> > +         index = PIPE_STAT_QUERY_CS_INVOCATIONS;<br>
> >           break;<br>
> >        default:<br>
> >           unreachable("Unexpected target");<br>
> > --<br>
> > 2.19.1<br>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
> ><br>
> <br>
<br>
</blockquote></div></div></div>