intel/tools/aubinator_error_decode: Move definition of option_color to header

Xe parser will also need to use the option_color parameter.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28722>
This commit is contained in:
José Roberto de Souza 2024-04-12 11:40:08 -07:00 committed by Marge Bot
parent 7e5628749c
commit 94deb24e2b
2 changed files with 14 additions and 8 deletions

View file

@ -57,7 +57,7 @@ static bool option_full_decode = true;
static bool option_print_all_bb = false;
static bool option_print_offsets = true;
static bool option_dump_kernels = false;
static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } option_color;
static enum decode_color option_color;
static char *xml_path = NULL;
static uint32_t
@ -75,7 +75,7 @@ print_register(struct intel_spec *spec, const char *name, uint32_t reg)
if (reg_spec) {
intel_print_group(stdout, reg_spec, 0, &reg, 0,
option_color == COLOR_ALWAYS);
option_color == DECODE_COLOR_ALWAYS);
}
}
@ -862,11 +862,11 @@ main(int argc, char *argv[])
switch (c) {
case 'c':
if (optarg == NULL || strcmp(optarg, "always") == 0)
option_color = COLOR_ALWAYS;
option_color = DECODE_COLOR_ALWAYS;
else if (strcmp(optarg, "never") == 0)
option_color = COLOR_NEVER;
option_color = DECODE_COLOR_NEVER;
else if (strcmp(optarg, "auto") == 0)
option_color = COLOR_AUTO;
option_color = DECODE_COLOR_AUTO;
else {
fprintf(stderr, "invalid value for --color: %s", optarg);
exit(EXIT_FAILURE);
@ -925,13 +925,13 @@ main(int argc, char *argv[])
}
}
if (option_color == COLOR_AUTO)
option_color = isatty(1) ? COLOR_ALWAYS : COLOR_NEVER;
if (option_color == DECODE_COLOR_AUTO)
option_color = isatty(1) ? DECODE_COLOR_ALWAYS : DECODE_COLOR_NEVER;
if (isatty(1) && pager)
setup_pager();
if (option_color == COLOR_ALWAYS)
if (option_color == DECODE_COLOR_ALWAYS)
batch_flags |= INTEL_BATCH_DECODE_IN_COLOR;
if (option_full_decode)
batch_flags |= INTEL_BATCH_DECODE_FULL;

View file

@ -7,6 +7,12 @@
#include "intel/common/intel_engine.h"
enum decode_color {
DECODE_COLOR_AUTO,
DECODE_COLOR_ALWAYS,
DECODE_COLOR_NEVER
};
int ring_name_to_class(const char *ring_name, enum intel_engine_class *class);
void