[Mesa-dev] [PATCH v2 6/7] nv50: expose global performance counters to the HUD
Martin Peres
martin.peres at free.fr
Wed Jul 22 15:08:45 PDT 2015
On 01/07/15 01:01, Samuel Pitoiset wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/nouveau/nv50/nv50_query.c | 41 ++++++++++++++++++++++++++
> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_screen.h | 3 ++
> 3 files changed, 45 insertions(+)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> index 7fb6f3a..7dadb77 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> @@ -1532,6 +1532,47 @@ nv50_hw_pm_query_result(struct nv50_context *nv50, struct nv50_query *q,
> return TRUE;
> }
>
> +int
> +nv50_screen_get_driver_query_info(struct pipe_screen *pscreen,
> + unsigned id,
> + struct pipe_driver_query_info *info)
> +{
> + struct nv50_screen *screen = nv50_screen(pscreen);
> + int count = 0;
> +
> + // TODO: Check DRM version when nvif will be merged in libdrm!
> + if (screen->base.perfmon) {
> + nv50_identify_events(screen);
> + count += NV50_HW_PM_QUERY_COUNT;
> + }
> +
> + if (!info)
> + return count;
> +
> + /* Init default values. */
> + info->name = "this_is_not_the_query_you_are_looking_for";
The spirit of calim is still in the code. Must be the ghost in the shell!
The patch is
Reviewed-by: Martin Peres <martin.peres at free.fr>
> + info->query_type = 0xdeadd01d;
> + info->type = PIPE_DRIVER_QUERY_TYPE_UINT64;
> + info->max_value.u64 = 0;
> + info->group_id = -1;
> +
> + if (id < count) {
> + if (screen->base.perfmon) {
> + const struct nv50_hw_pm_query_cfg *cfg =
> + nv50_hw_pm_query_get_cfg(screen, NV50_HW_PM_QUERY(id));
> +
> + info->name = cfg->event->name;
> + info->query_type = NV50_HW_PM_QUERY(id);
> + info->max_value.u64 =
> + (cfg->event->display == NV50_HW_PM_EVENT_DISPLAY_RATIO) ? 100 : 0;
> + return 1;
> + }
> + }
> +
> + /* User asked for info about non-existing query. */
> + return 0;
> +}
> +
> void
> nv50_init_query_functions(struct nv50_context *nv50)
> {
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 335bff1..ac1acd1 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -748,6 +748,7 @@ nv50_screen_create(struct nouveau_device *dev)
> pscreen->get_param = nv50_screen_get_param;
> pscreen->get_shader_param = nv50_screen_get_shader_param;
> pscreen->get_paramf = nv50_screen_get_paramf;
> + pscreen->get_driver_query_info = nv50_screen_get_driver_query_info;
>
> nv50_screen_init_resource_functions(pscreen);
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.h b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
> index 0449659..69127c0 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.h
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
> @@ -143,6 +143,9 @@ nv50_screen(struct pipe_screen *screen)
> #define NV50_HW_PM_QUERY_TEX_CACHE_HIT 22
> #define NV50_HW_PM_QUERY_TEX_WAITS_FOR_FB 23
>
> +int nv50_screen_get_driver_query_info(struct pipe_screen *, unsigned,
> + struct pipe_driver_query_info *);
> +
> boolean nv50_blitter_create(struct nv50_screen *);
> void nv50_blitter_destroy(struct nv50_screen *);
>
More information about the mesa-dev
mailing list