intel/mda: Add MDA_FILTER to select which archives to generate
Matches if names contains the filter value, multiple values separated by commas. Acked-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29146>
This commit is contained in:
parent
34198545aa
commit
f00fca998e
4 changed files with 46 additions and 3 deletions
|
|
@ -896,6 +896,11 @@ Intel driver environment variables
|
||||||
Prefix added to the mda.tar filenames generated when using INTEL_DEBUG=mda.
|
Prefix added to the mda.tar filenames generated when using INTEL_DEBUG=mda.
|
||||||
If set to ``timestamp`` it will generate the current time/date as prefix.
|
If set to ``timestamp`` it will generate the current time/date as prefix.
|
||||||
|
|
||||||
|
.. envvar:: MDA_FILTER
|
||||||
|
|
||||||
|
When set, will only generate mda.tar files which names contain any of the
|
||||||
|
comma-separated filter values as substrings.
|
||||||
|
|
||||||
Anvil(ANV) driver environment variables
|
Anvil(ANV) driver environment variables
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1858,8 +1858,10 @@ iris_debug_archiver_open(void *tmp_ctx, struct iris_screen *screen,
|
||||||
debug_archiver *debug_archiver =
|
debug_archiver *debug_archiver =
|
||||||
debug_archiver_open(tmp_ctx, name, PACKAGE_VERSION MESA_GIT_SHA1);
|
debug_archiver_open(tmp_ctx, name, PACKAGE_VERSION MESA_GIT_SHA1);
|
||||||
|
|
||||||
debug_archiver_set_prefix(debug_archiver,
|
if (debug_archiver) {
|
||||||
_mesa_shader_stage_to_abbrev(ish->nir->info.stage));
|
debug_archiver_set_prefix(debug_archiver,
|
||||||
|
_mesa_shader_stage_to_abbrev(ish->nir->info.stage));
|
||||||
|
}
|
||||||
return debug_archiver;
|
return debug_archiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "debug_archiver.h"
|
#include "debug_archiver.h"
|
||||||
|
|
||||||
|
#include "slice.h"
|
||||||
#include "tar.h"
|
#include "tar.h"
|
||||||
#include "util/ralloc.h"
|
#include "util/ralloc.h"
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
|
|
@ -26,6 +27,7 @@ struct debug_archiver
|
||||||
|
|
||||||
DEBUG_GET_ONCE_OPTION(mda_output_dir, "MDA_OUTPUT_DIR", ".")
|
DEBUG_GET_ONCE_OPTION(mda_output_dir, "MDA_OUTPUT_DIR", ".")
|
||||||
DEBUG_GET_ONCE_OPTION(mda_prefix, "MDA_PREFIX", NULL)
|
DEBUG_GET_ONCE_OPTION(mda_prefix, "MDA_PREFIX", NULL)
|
||||||
|
DEBUG_GET_ONCE_OPTION(mda_filter, "MDA_FILTER", NULL)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
ensure_output_dir(const char *dir)
|
ensure_output_dir(const char *dir)
|
||||||
|
|
@ -40,9 +42,38 @@ ensure_output_dir(const char *dir)
|
||||||
return mkdir(dir, 0755) == 0;
|
return mkdir(dir, 0755) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
debug_archiver_should_create(const char *name_str)
|
||||||
|
{
|
||||||
|
const char *filter_str = debug_get_option_mda_filter();
|
||||||
|
if (filter_str && *filter_str) {
|
||||||
|
slice filter = slice_from_cstr(filter_str);
|
||||||
|
slice name = slice_from_cstr(name_str);
|
||||||
|
|
||||||
|
while (!slice_is_empty(filter)) {
|
||||||
|
slice_cut_result cut = slice_cut(filter, ',');
|
||||||
|
slice pattern = cut.before;
|
||||||
|
|
||||||
|
if (!slice_is_empty(pattern) &&
|
||||||
|
slice_contains_str(name, pattern))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
filter = cut.after;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MDA_FILTER exist but did not match, don't create. */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
debug_archiver *
|
debug_archiver *
|
||||||
debug_archiver_open(void *mem_ctx, const char *name, const char *info)
|
debug_archiver_open(void *mem_ctx, const char *name, const char *info)
|
||||||
{
|
{
|
||||||
|
if (!debug_archiver_should_create(name))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
debug_archiver *da = rzalloc(mem_ctx, debug_archiver);
|
debug_archiver *da = rzalloc(mem_ctx, debug_archiver);
|
||||||
|
|
||||||
char *filename = ralloc_asprintf(mem_ctx, "%s.mda.tar", name);
|
char *filename = ralloc_asprintf(mem_ctx, "%s.mda.tar", name);
|
||||||
|
|
@ -117,6 +148,9 @@ debug_archiver_open(void *mem_ctx, const char *name, const char *info)
|
||||||
void
|
void
|
||||||
debug_archiver_set_prefix(debug_archiver *da, const char *prefix)
|
debug_archiver_set_prefix(debug_archiver *da, const char *prefix)
|
||||||
{
|
{
|
||||||
|
if (!da)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!prefix || !*prefix) {
|
if (!prefix || !*prefix) {
|
||||||
snprintf(da->prefix, ARRAY_SIZE(da->prefix) - 1, "%s", da->mda_dir_in_archive);
|
snprintf(da->prefix, ARRAY_SIZE(da->prefix) - 1, "%s", da->mda_dir_in_archive);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1690,8 +1690,10 @@ anv_debug_archiver_init(void *mem_ctx, struct anv_shader_data *shaders_data,
|
||||||
shader_data->archiver =
|
shader_data->archiver =
|
||||||
debug_archiver_open(mem_ctx, name, PACKAGE_VERSION MESA_GIT_SHA1);
|
debug_archiver_open(mem_ctx, name, PACKAGE_VERSION MESA_GIT_SHA1);
|
||||||
|
|
||||||
debug_archiver_set_prefix(shader_data->archiver,
|
if (shader_data->archiver) {
|
||||||
|
debug_archiver_set_prefix(shader_data->archiver,
|
||||||
_mesa_shader_stage_to_abbrev(info->stage));
|
_mesa_shader_stage_to_abbrev(info->stage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue