summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/hud/hud_context.c
diff options
context:
space:
mode:
authorEdmondo Tommasina <[email protected]>2016-12-21 22:58:11 +0100
committerMarek Olšák <[email protected]>2017-01-01 00:03:38 +0100
commit57f86fb3a8bde60e8c99a46fdccd0dc12377ffd2 (patch)
tree55f119f87910eccdd626173b0e2f4d7f55330c76 /src/gallium/auxiliary/hud/hud_context.c
parent22cd9040da75cac6e1c61b821e1ac6906ac4a8ac (diff)
gallium/hud: move file initialization to a function
The function will be used later to create the filedescriptor for other metrics. Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/hud/hud_context.c')
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index edd831a7f7b..779c11693c8 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -865,6 +865,23 @@ hud_graph_destroy(struct hud_graph *graph)
FREE(graph);
}
+void
+hud_graph_set_dump_file(struct hud_graph *gr)
+{
+ const char *hud_dump_dir = getenv("GALLIUM_HUD_DUMP_DIR");
+ char *dump_file;
+
+ 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);
+ }
+ }
+}
+
/**
* Read a string from the environment variable.
* The separators "+", ",", ":", and ";" terminate the string.