[Mesa-dev] [PATCH v2 13/15] nvc0: expose more driver-specific query groups
Ilia Mirkin
imirkin at alum.mit.edu
Fri Mar 27 11:40:37 PDT 2015
It's really confusing to have MP_COUNTER_GROUP being 0 or 1 depending
on the setting of DEBUG. Please make them the same.
On Sun, Mar 22, 2015 at 11:35 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> This patch exposes "Driver statistics" and "MP counters" groups.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 61 ++++++++++++++++++++++++--
> src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 11 +++++
> 2 files changed, 69 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> index 52f6d6c..a63a740 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> @@ -24,8 +24,6 @@
>
> #define NVC0_PUSH_EXPLICIT_SPACE_CHECKING
>
> -#include "util/u_query.h"
> -
> #include "nvc0/nvc0_context.h"
> #include "nv_object.xml.h"
> #include "nvc0/nve4_compute.xml.h"
> @@ -1424,6 +1422,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
> info->max_value.u64 = 0;
> if (strstr(info->name, "bytes"))
> info->type = PIPE_DRIVER_QUERY_TYPE_BYTES;
> + info->group_id = NVC0_QUERY_DRV_STAT_GROUP;
> return 1;
> } else
> #endif
> @@ -1433,18 +1432,21 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
> info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> info->max_value.u64 =
> (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
> + info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
> return 1;
> } else
> if (screen->compute) {
> info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
> info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> info->max_value.u64 = 0;
> + info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
> return 1;
> }
> }
> /* user asked for info about non-existing query */
> info->name = "this_is_not_the_query_you_are_looking_for";
> info->query_type = 0xdeadd01d;
> + info->group_id = 0;
> info->max_value.u64 = 0;
> return 0;
> }
> @@ -1454,7 +1456,60 @@ nvc0_screen_get_driver_query_group_info(struct pipe_screen *pscreen,
> unsigned id,
> struct pipe_driver_query_group_info *info)
> {
> - return util_get_driver_query_group_info(id, NVC0_QUERY_DRV_STAT_COUNT, info);
> + struct nvc0_screen *screen = nvc0_screen(pscreen);
> + int count = 0;
> +
> +#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
> + count++;
> +#endif
> + if (screen->base.device->drm_version >= 0x01000101) {
> + if (screen->base.class_3d >= NVE4_3D_CLASS) {
> + count++;
> + } else
> + if (screen->compute) {
> + count++; /* NVC0_COMPUTE is not always enabled */
> + }
> + }
> +
> + if (!info)
> + return count;
> +
> +#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
> + if (id == NVC0_QUERY_DRV_STAT_GROUP) {
> + info->name = "Driver statistics";
> + info->max_active_queries = NVC0_QUERY_DRV_STAT_COUNT;
> + info->num_queries = NVC0_QUERY_DRV_STAT_COUNT;
> + return 1;
> + } else
> +#endif
> + if (id == NVC0_QUERY_MP_COUNTER_GROUP) {
> + info->name = "MP counters";
> +
> + if (screen->base.class_3d >= NVE4_3D_CLASS) {
> + info->num_queries = NVE4_PM_QUERY_COUNT;
> +
> + /* On NVE4+, each multiprocessor have 8 hardware counters separated
> + * in two distinct domains, but we allow only one active query
> + * simultaneously because some of them use more than one hardware
> + * counter and this will result in an undefined behaviour. */
> + info->max_active_queries = 1; /* TODO: handle multiple hw counters */
> + return 1;
> + } else
> + if (screen->compute) {
> + info->num_queries = NVC0_PM_QUERY_COUNT;
> +
> + /* On NVC0:NVE4, each multiprocessor have 8 hardware counters
> + * in a single domain. */
> + info->max_active_queries = 8;
> + return 1;
> + }
> + }
> +
> + /* user asked for info about non-existing query group */
> + info->name = "this_is_not_the_query_group_you_are_looking_for";
> + info->max_active_queries = 0;
> + info->num_queries = 0;
> + return 0;
> }
>
> void
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> index 6bf43d9..b7c53c6 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> @@ -234,10 +234,21 @@ nvc0_screen(struct pipe_screen *screen)
> #define NVC0_QUERY_DRV_STAT_PUSHBUF_COUNT 27
> #define NVC0_QUERY_DRV_STAT_RESOURCE_VALIDATE_COUNT 28
>
> +/*
> + * Query groups:
> + */
> +#define NVC0_QUERY_DRV_STAT_GROUP 0
> +#define NVC0_QUERY_MP_COUNTER_GROUP 1
> +
> #else
>
> #define NVC0_QUERY_DRV_STAT_COUNT 0
>
> +/*
> + * Query groups:
> + */
> +#define NVC0_QUERY_MP_COUNTER_GROUP 0
> +
> #endif
>
> int nvc0_screen_get_driver_query_info(struct pipe_screen *, unsigned,
> --
> 2.3.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