[Mesa-dev] [PATCH v3 02/10] gallium: add new fields to pipe_driver_query_info
Martin Peres
martin.peres at free.fr
Sun Apr 26 13:57:58 PDT 2015
On 02/04/2015 21:41, Samuel Pitoiset wrote:
> According to the spec of GL_AMD_performance_monitor, valid type values
> returned are UNSIGNED_INT, UNSIGNED_INT64_AMD, PERCENTAGE_AMD, FLOAT.
> This also introduces the new field group_id in order to categorize
> queries into groups.
>
> v3: fix incorrect query type for radeon and svga drivers
>
> v2: add PIPE_DRIVER_QUERY_TYPE_BYTES
Weird way of ordering the versions. Usually, we get v2 before v3.
It's your call though :)
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/auxiliary/hud/hud_driver_query.c | 4 +++-
> src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 6 ++----
> src/gallium/drivers/radeon/r600_pipe_common.c | 14 +++++++-------
> src/gallium/drivers/svga/svga_screen.c | 6 +++---
> src/gallium/include/pipe/p_defines.h | 12 +++++++++++-
> 5 files changed, 26 insertions(+), 16 deletions(-)
>
> diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
> index 53771fc..1c8c485 100644
> --- a/src/gallium/auxiliary/hud/hud_driver_query.c
> +++ b/src/gallium/auxiliary/hud/hud_driver_query.c
> @@ -187,6 +187,7 @@ hud_driver_query_install(struct hud_pane *pane, struct pipe_context *pipe,
> struct pipe_screen *screen = pipe->screen;
> struct pipe_driver_query_info query;
> unsigned num_queries, i;
> + boolean uses_byte_units;
> boolean found = FALSE;
>
> if (!screen->get_driver_query_info)
> @@ -205,7 +206,8 @@ hud_driver_query_install(struct hud_pane *pane, struct pipe_context *pipe,
> if (!found)
> return FALSE;
>
> + uses_byte_units = query.type == PIPE_DRIVER_QUERY_TYPE_BYTES;
> hud_pipe_query_install(pane, pipe, query.name, query.query_type, 0,
> - query.max_value, query.uses_byte_units);
> + query.max_value, uses_byte_units);
> return TRUE;
> }
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> index f21deea..5be150e 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> @@ -1419,7 +1419,8 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
> info->name = nvc0_drv_stat_names[id];
> info->query_type = NVC0_QUERY_DRV_STAT(id);
> info->max_value = 0;
> - info->uses_byte_units = !!strstr(info->name, "bytes");
> + if (strstr(info->name, "bytes"))
> + info->type = PIPE_DRIVER_QUERY_TYPE_BYTES;
> return 1;
> } else
> #endif
> @@ -1428,14 +1429,12 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
> info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
> info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> info->max_value = (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
> - info->uses_byte_units = FALSE;
> 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 = 0;
> - info->uses_byte_units = FALSE;
> return 1;
> }
> }
> @@ -1443,7 +1442,6 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
> info->name = "this_is_not_the_query_you_are_looking_for";
> info->query_type = 0xdeadd01d;
> info->max_value = 0;
> - info->uses_byte_units = FALSE;
> return 0;
> }
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 0ef5fc2..238a934 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -656,13 +656,13 @@ static int r600_get_driver_query_info(struct pipe_screen *screen,
> struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
> struct pipe_driver_query_info list[] = {
> {"draw-calls", R600_QUERY_DRAW_CALLS, 0},
> - {"requested-VRAM", R600_QUERY_REQUESTED_VRAM, rscreen->info.vram_size, TRUE},
> - {"requested-GTT", R600_QUERY_REQUESTED_GTT, rscreen->info.gart_size, TRUE},
> - {"buffer-wait-time", R600_QUERY_BUFFER_WAIT_TIME, 0, FALSE},
> - {"num-cs-flushes", R600_QUERY_NUM_CS_FLUSHES, 0, FALSE},
> - {"num-bytes-moved", R600_QUERY_NUM_BYTES_MOVED, 0, TRUE},
> - {"VRAM-usage", R600_QUERY_VRAM_USAGE, rscreen->info.vram_size, TRUE},
> - {"GTT-usage", R600_QUERY_GTT_USAGE, rscreen->info.gart_size, TRUE},
> + {"requested-VRAM", R600_QUERY_REQUESTED_VRAM, rscreen->info.vram_size, PIPE_DRIVER_QUERY_TYPE_BYTES},
> + {"requested-GTT", R600_QUERY_REQUESTED_GTT, rscreen->info.gart_size, PIPE_DRIVER_QUERY_TYPE_BYTES},
> + {"buffer-wait-time", R600_QUERY_BUFFER_WAIT_TIME, 0},
> + {"num-cs-flushes", R600_QUERY_NUM_CS_FLUSHES, 0},
> + {"num-bytes-moved", R600_QUERY_NUM_BYTES_MOVED, 0, PIPE_DRIVER_QUERY_TYPE_BYTES},
> + {"VRAM-usage", R600_QUERY_VRAM_USAGE, rscreen->info.vram_size, PIPE_DRIVER_QUERY_TYPE_BYTES},
> + {"GTT-usage", R600_QUERY_GTT_USAGE, rscreen->info.gart_size, PIPE_DRIVER_QUERY_TYPE_BYTES},
> };
>
> if (!info)
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index ab26413..35e5a11 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -568,9 +568,9 @@ svga_get_driver_query_info(struct pipe_screen *screen,
> struct pipe_driver_query_info *info)
> {
> static const struct pipe_driver_query_info queries[] = {
> - {"draw-calls", SVGA_QUERY_DRAW_CALLS, 0, FALSE},
> - {"fallbacks", SVGA_QUERY_FALLBACKS, 0, FALSE},
> - {"memory-used", SVGA_QUERY_MEMORY_USED, 0, TRUE}
> + {"draw-calls", SVGA_QUERY_DRAW_CALLS, 0},
> + {"fallbacks", SVGA_QUERY_FALLBACKS, 0},
> + {"memory-used", SVGA_QUERY_MEMORY_USED, 0, PIPE_DRIVER_QUERY_TYPE_BYTES}
> };
>
> if (!info)
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index c1e660e..23c3830 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -752,6 +752,15 @@ union pipe_color_union
> unsigned int ui[4];
> };
>
> +enum pipe_driver_query_type
> +{
> + PIPE_DRIVER_QUERY_TYPE_UINT64 = 0,
> + PIPE_DRIVER_QUERY_TYPE_UINT = 1,
> + PIPE_DRIVER_QUERY_TYPE_FLOAT = 2,
> + PIPE_DRIVER_QUERY_TYPE_PERCENTAGE = 3,
> + PIPE_DRIVER_QUERY_TYPE_BYTES = 4,
> +};
> +
> enum pipe_driver_query_group_type
> {
> PIPE_DRIVER_QUERY_GROUP_TYPE_CPU = 0,
> @@ -763,7 +772,8 @@ struct pipe_driver_query_info
> const char *name;
> unsigned query_type; /* PIPE_QUERY_DRIVER_SPECIFIC + i */
> uint64_t max_value; /* max value that can be returned */
> - boolean uses_byte_units; /* whether the result is in bytes */
> + enum pipe_driver_query_type type;
> + unsigned group_id;
The above never get set in svga's and r600's queries. Please do so
explicitly.
> };
>
> struct pipe_driver_query_group_info
More information about the mesa-dev
mailing list