[Mesa-dev] [PATCH 1/3] intel: aubinator: print boolean fields to true with colors
Gandikota, Sirisha
sirisha.gandikota at intel.com
Tue Nov 1 21:53:35 UTC 2016
>-----Original Message-----
>From: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] On Behalf Of
>Lionel Landwerlin
>Sent: Monday, October 17, 2016 1:57 PM
>To: mesa-dev at lists.freedesktop.org
>Cc: Landwerlin, Lionel G <lionel.g.landwerlin at intel.com>
>Subject: [Mesa-dev] [PATCH 1/3] intel: aubinator: print boolean fields to true with
>colors
>
>Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
>---
> src/intel/tools/aubinator.c | 6 ++++--
> src/intel/tools/decoder.c | 12 +++++++++---
> src/intel/tools/decoder.h | 5 ++++-
> 3 files changed, 17 insertions(+), 6 deletions(-)
>
>diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c index
>31c1f89..01941b2 100644
>--- a/src/intel/tools/aubinator.c
>+++ b/src/intel/tools/aubinator.c
>@@ -139,7 +139,8 @@ decode_structure(struct gen_spec *spec, struct
>gen_group *strct,
> else
> offset = 0;
>
>- gen_field_iterator_init(&iter, strct, p);
>+ gen_field_iterator_init(&iter, strct, p,
>+ option_color == COLOR_ALWAYS);
> while (gen_field_iterator_next(&iter)) {
> idx = 0;
> print_dword_val(&iter, offset, &dword_num); @@ -755,7 +756,8 @@
>parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
> struct gen_field_iterator iter;
> char *token = NULL;
> int idx = 0, dword_num = 0;
>- gen_field_iterator_init(&iter, inst, p);
>+ gen_field_iterator_init(&iter, inst, p,
>+ option_color == COLOR_ALWAYS);
> while (gen_field_iterator_next(&iter)) {
> idx = 0;
> print_dword_val(&iter, offset, &dword_num); diff --git
>a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c index 267b821..cab5271
>100644
>--- a/src/intel/tools/decoder.c
>+++ b/src/intel/tools/decoder.c
>@@ -594,11 +594,14 @@ gen_group_get_length(struct gen_group *group,
>const uint32_t *p)
>
> void
> gen_field_iterator_init(struct gen_field_iterator *iter,
>- struct gen_group *group, const uint32_t *p)
>+ struct gen_group *group,
>+ const uint32_t *p,
>+ bool print_colors)
> {
> iter->group = group;
> iter->p = p;
> iter->i = 0;
>+ iter->print_colors = print_colors;
> }
>
> bool
>@@ -632,10 +635,13 @@ gen_field_iterator_next(struct gen_field_iterator *iter)
> snprintf(iter->value, sizeof(iter->value),
> "%"PRIu64, field(v.qw, f->start, f->end));
> break;
>- case GEN_TYPE_BOOL:
>+ case GEN_TYPE_BOOL: {
>+ const char *true_string =
>+ iter->print_colors ? "\e[0;35mtrue\e[0m" : "true";
> snprintf(iter->value, sizeof(iter->value),
>- "%s", field(v.qw, f->start, f->end) ? "true" : "false");
>+ "%s", field(v.qw, f->start, f->end) ? true_string :
>+ "false");
> break;
>+ }
> case GEN_TYPE_FLOAT:
> snprintf(iter->value, sizeof(iter->value), "%f", v.f);
> break;
>diff --git a/src/intel/tools/decoder.h b/src/intel/tools/decoder.h index
>bbeaa0a..9a677be 100644
>--- a/src/intel/tools/decoder.h
>+++ b/src/intel/tools/decoder.h
>@@ -55,6 +55,7 @@ struct gen_field_iterator {
> char value[128];
> const uint32_t *p;
> int i;
>+ bool print_colors;
> };
>
> struct gen_group {
>@@ -101,7 +102,9 @@ struct gen_field {
> };
>
> void gen_field_iterator_init(struct gen_field_iterator *iter,
>- struct gen_group *group, const uint32_t *p);
>+ struct gen_group *group,
>+ const uint32_t *p,
>+ bool print_colors);
>
> bool gen_field_iterator_next(struct gen_field_iterator *iter);
>
>--
>2.9.3
>
[SG] Works for me
Reviewed-by: Sirisha Gandikota <sirisha.gandikota at intel.com>
>_______________________________________________
>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