It would be better to add this function to u_helpers.c/.h instead of
adding new files.

Marek

On Mon, Mar 9, 2015 at 10:09 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
> This function can be used to get a generic group of driver-specific
> queries when a driver doesn't expose any groups.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
> ---
>  src/gallium/auxiliary/Makefile.sources |  1 +
>  src/gallium/auxiliary/util/u_query.c   | 50 
> ++++++++++++++++++++++++++++++++++
>  src/gallium/auxiliary/util/u_query.h   | 45 ++++++++++++++++++++++++++++++
>  3 files changed, 96 insertions(+)
>  create mode 100644 src/gallium/auxiliary/util/u_query.c
>  create mode 100644 src/gallium/auxiliary/util/u_query.h
>
> diff --git a/src/gallium/auxiliary/Makefile.sources 
> b/src/gallium/auxiliary/Makefile.sources
> index b7174d6..8af3c34 100644
> --- a/src/gallium/auxiliary/Makefile.sources
> +++ b/src/gallium/auxiliary/Makefile.sources
> @@ -265,6 +265,7 @@ C_SOURCES := \
>         util/u_prim.h \
>         util/u_pstipple.c \
>         util/u_pstipple.h \
> +       util/u_query.c \
>         util/u_range.h \
>         util/u_rect.h \
>         util/u_resource.c \
> diff --git a/src/gallium/auxiliary/util/u_query.c 
> b/src/gallium/auxiliary/util/u_query.c
> new file mode 100644
> index 0000000..bb27ca0
> --- /dev/null
> +++ b/src/gallium/auxiliary/util/u_query.c
> @@ -0,0 +1,50 @@
> +/**************************************************************************
> + *
> + * Copyright 2015 Samuel Pitoiset <samuel.pitoi...@gmail.com>
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
> + * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR
> + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + **************************************************************************/
> +
> +#include "util/u_memory.h"
> +#include "util/u_query.h"
> +
> +/**
> + * This function is used to get a generic group of driver-specific queries.
> + */
> +int
> +util_get_driver_query_group_info(unsigned index, unsigned num_queries,
> +                                 struct pipe_driver_query_group_info *info)
> +{
> +   struct pipe_driver_query_group_info list[] = {
> +      {"Driver queries", num_queries, num_queries}
> +   };
> +
> +   if (!info)
> +      return ARRAY_SIZE(list);
> +
> +   if (index >= ARRAY_SIZE(list))
> +      return 0;
> +
> +   *info = list[index];
> +   return 1;
> +}
> diff --git a/src/gallium/auxiliary/util/u_query.h 
> b/src/gallium/auxiliary/util/u_query.h
> new file mode 100644
> index 0000000..05b9be9
> --- /dev/null
> +++ b/src/gallium/auxiliary/util/u_query.h
> @@ -0,0 +1,45 @@
> +/**************************************************************************
> + *
> + * Copyright 2015 Samuel Pitoiset <samuel.pitoi...@gmail.com>
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
> + * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR
> + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + **************************************************************************/
> +
> +#ifndef U_QUERY_H
> +#define U_QUERY_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "pipe/p_state.h"
> +
> +int
> +util_get_driver_query_group_info(unsigned index, unsigned num_queries,
> +                                 struct pipe_driver_query_group_info *info);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> --
> 2.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to