[Mesa-dev] [PATCH 2/6] gallium/hud: add dump directory enviroment variable

Marek Olšák maraeo at gmail.com
Sat Dec 31 22:57:02 UTC 2016


Ignore my comment on patch 1. This patch can be merged with the first one.

Marek

On Wed, Dec 21, 2016 at 10:58 PM, Edmondo Tommasina
<edmondo.tommasina at gmail.com> wrote:
> Set GALLIUM_HUD_DUMP_DIR to dump values to files in this directory.
>
> No values are dumped if the environment variable is not set, the
> directory doesn't exist or the user doesn't have write access.
> ---
>  src/gallium/auxiliary/hud/hud_driver_query.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
> index bfde16a..23fda01 100644
> --- a/src/gallium/auxiliary/hud/hud_driver_query.c
> +++ b/src/gallium/auxiliary/hud/hud_driver_query.c
> @@ -351,6 +351,8 @@ hud_pipe_query_install(struct hud_batch_query_context **pbq,
>  {
>     struct hud_graph *gr;
>     struct query_info *info;
> +   const char *hud_dump_dir = getenv("GALLIUM_HUD_DUMP_DIR");
> +   char *dump_file;
>
>     gr = CALLOC_STRUCT(hud_graph);
>     if (!gr)
> @@ -378,7 +380,15 @@ hud_pipe_query_install(struct hud_batch_query_context **pbq,
>        info->result_index = result_index;
>     }
>
> -   gr->fd = fopen(gr->name, "w+");
> +   if (hud_dump_dir && access(hud_dump_dir, W_OK) == 0) {
> +      dump_file = malloc(strlen(hud_dump_dir) + sizeof(gr->name));
> +      if (dump_file) {
> +         strcpy(dump_file, hud_dump_dir);
> +         strcat(dump_file, gr->name);
> +         gr->fd = fopen(dump_file, "w+");
> +         free(dump_file);
> +      }
> +   }
>
>     hud_pane_add_graph(pane, gr);
>     pane->type = type; /* must be set before updating the max_value */
> --
> 2.10.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list