[Mesa-dev] [PATCH 3/8] st/nine: Queries: Use gallium caps to get if queries are supported. (v2)

Ilia Mirkin imirkin at alum.mit.edu
Tue Dec 2 13:28:38 PST 2014


On Tue, Dec 2, 2014 at 4:12 PM, Axel Davy <axel.davy at ens.fr> wrote:
> Some queries need the driver to advertise a cap to be supported.
> For example r300 doesn't support them.
>
> v2 (David): check also for PIPE_CAP_QUERY_PIPELINE_STATISTICS, fix wine
>             tests on r300g
>
> Reviewed-by: David Heidelberg <david at ixit.cz>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
>  src/gallium/state_trackers/nine/device9.c |  2 +-
>  src/gallium/state_trackers/nine/query9.c  | 45 ++++++++++++++++---------------
>  src/gallium/state_trackers/nine/query9.h  |  2 +-
>  3 files changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index c16f728..e9599b8 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -3359,7 +3359,7 @@ NineDevice9_CreateQuery( struct NineDevice9 *This,
>
>      DBG("This=%p Type=%d ppQuery=%p\n", This, Type, ppQuery);
>
> -    hr = nine_is_query_supported(Type);
> +    hr = nine_is_query_supported(This->screen, Type);
>      if (!ppQuery || hr != D3D_OK)
>          return hr;
>
> diff --git a/src/gallium/state_trackers/nine/query9.c b/src/gallium/state_trackers/nine/query9.c
> index 5e30144..2be9bf4 100644
> --- a/src/gallium/state_trackers/nine/query9.c
> +++ b/src/gallium/state_trackers/nine/query9.c
> @@ -23,34 +23,35 @@
>  #include "device9.h"
>  #include "query9.h"
>  #include "nine_helpers.h"
> +#include "pipe/p_screen.h"
>  #include "pipe/p_context.h"
>  #include "util/u_math.h"
>  #include "nine_dump.h"
>
>  #define DBG_CHANNEL DBG_QUERY
>
> -#define QUERY_TYPE_MAP_CASE(a, b) case D3DQUERYTYPE_##a: return PIPE_QUERY_##b
>  static inline unsigned
> -d3dquerytype_to_pipe_query(D3DQUERYTYPE type)
> +d3dquerytype_to_pipe_query(struct pipe_screen *screen, D3DQUERYTYPE type)
>  {
>      switch (type) {
> -    QUERY_TYPE_MAP_CASE(EVENT, GPU_FINISHED);
> -    QUERY_TYPE_MAP_CASE(OCCLUSION, OCCLUSION_COUNTER);
> -    QUERY_TYPE_MAP_CASE(TIMESTAMP, TIMESTAMP);
> -    QUERY_TYPE_MAP_CASE(TIMESTAMPDISJOINT, TIMESTAMP_DISJOINT);
> -    QUERY_TYPE_MAP_CASE(TIMESTAMPFREQ, TIMESTAMP_DISJOINT);
> -    QUERY_TYPE_MAP_CASE(VERTEXSTATS, PIPELINE_STATISTICS);
> -    case D3DQUERYTYPE_VCACHE:
> -    case D3DQUERYTYPE_RESOURCEMANAGER:
> -    case D3DQUERYTYPE_PIPELINETIMINGS:
> -    case D3DQUERYTYPE_INTERFACETIMINGS:
> -    case D3DQUERYTYPE_VERTEXTIMINGS:
> -    case D3DQUERYTYPE_PIXELTIMINGS:
> -    case D3DQUERYTYPE_BANDWIDTHTIMINGS:
> -    case D3DQUERYTYPE_CACHEUTILIZATION:
> -       return PIPE_QUERY_TYPES;
> -    default:
> -        return ~0;
> +        case D3DQUERYTYPE_EVENT:

The convention throughout mesa is to align 'case' with 'switch'.


More information about the mesa-dev mailing list