[Mesa-dev] [PATCH 09/16] st/nine: Fix D3DQUERYTYPE_TIMESTAMPFREQ query

Ilia Mirkin imirkin at alum.mit.edu
Fri Apr 24 14:26:49 PDT 2015


>From https://msdn.microsoft.com/en-us/library/windows/desktop/bb172594%28v=vs.85%29.aspx

D3DQUERYTYPE_TIMESTAMPFREQ
This query result is TRUE if the values from D3DQUERYTYPE_TIMESTAMP
queries cannot be guaranteed to be continuous throughout the duration
of the D3DQUERYTYPE_TIMESTAMPDISJOINT query. Otherwise, the query
result is FALSE.

Seems like you should be returning 0 here? Seems like contrary to the
name, it has nothing to do with frequency...


On Fri, Apr 24, 2015 at 4:09 PM, Axel Davy <axel.davy at ens.fr> wrote:
> From: Xavier Bouchoux <xavierb at gmail.com>
>
> D3DQUERYTYPE_TIMESTAMPFREQ is supposed to give the frequency
> at which the clock of D3DQUERYTYPE_TIMESTAMP runs.
>
> PIPE_QUERY_TIMESTAMP returns a value in ns, thus the corresponding
> frequency is 1000000000.
> PIPE_QUERY_TIMESTAMP_DISJOINT returns the frequency at which
> PIPE_QUERY_TIMESTAMP value is updated. It isn't always
> 1000000000.
>
> Reviewed-by: Axel Davy <axel.davy at ens.fr>
> Signed-off-by: Xavier Bouchoux <xavierb at gmail.com>
> ---
>  src/gallium/state_trackers/nine/query9.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/nine/query9.c b/src/gallium/state_trackers/nine/query9.c
> index 466b4ba..df49340 100644
> --- a/src/gallium/state_trackers/nine/query9.c
> +++ b/src/gallium/state_trackers/nine/query9.c
> @@ -254,7 +254,15 @@ NineQuery9_GetData( struct NineQuery9 *This,
>          nresult.b = presult.timestamp_disjoint.disjoint;
>          break;
>      case D3DQUERYTYPE_TIMESTAMPFREQ:
> -        nresult.u64 = presult.timestamp_disjoint.frequency;
> +        /* Applications use it to convert the TIMESTAMP value to time.
> +           AMD drivers on win seem to return the actual hardware clock
> +           resolution and corresponding values in TIMESTAMP.
> +           However, this behaviour is not easy to replicate here.
> +           So instead we do what wine and opengl do, and use
> +           nanoseconds TIMESTAMPs.
> +           (Which is also the unit used by PIPE_QUERY_TIMESTAMP.)
> +        */
> +        nresult.u64 = 1000000000;
>          break;
>      case D3DQUERYTYPE_VERTEXSTATS:
>          nresult.vertexstats.NumRenderedTriangles =
> --
> 2.1.0
>
> _______________________________________________
> 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