Mesa (master): Revert "gallium/hud: automatically print % if max_value == 100"
Marek Olšák
mareko at kemper.freedesktop.org
Fri Sep 30 20:13:21 UTC 2016
Module: Mesa
Branch: master
Commit: 7b87190d2b778952713a02a075fb05f8b5803ca9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b87190d2b778952713a02a075fb05f8b5803ca9
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Sep 30 12:55:08 2016 +0200
Revert "gallium/hud: automatically print % if max_value == 100"
This reverts commit dbfeb0ec12d6550e68de1bcd164e422e79bccf2d.
With max_value being rounded to 100, it's often wrong.
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/gallium/auxiliary/hud/hud_context.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 3445488..31e81f0 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -245,8 +245,8 @@ hud_draw_string(struct hud_context *hud, unsigned x, unsigned y,
}
static void
-number_to_human_readable(uint64_t num, uint64_t max_value,
- enum pipe_driver_query_type type, char *out)
+number_to_human_readable(uint64_t num, enum pipe_driver_query_type type,
+ char *out)
{
static const char *byte_units[] =
{" B", " KB", " MB", " GB", " TB", " PB", " EB"};
@@ -307,13 +307,8 @@ number_to_human_readable(uint64_t num, uint64_t max_value,
units = watt_units;
break;
default:
- if (max_value == 100) {
- max_unit = ARRAY_SIZE(percent_units)-1;
- units = percent_units;
- } else {
- max_unit = ARRAY_SIZE(metric_units)-1;
- units = metric_units;
- }
+ max_unit = ARRAY_SIZE(metric_units)-1;
+ units = metric_units;
}
while (d > divisor && unit < max_unit) {
@@ -383,7 +378,7 @@ hud_pane_accumulate_vertices(struct hud_context *hud,
pane->inner_height * (last_line - i) / last_line -
hud->font.glyph_height / 2;
- number_to_human_readable(pane->max_value * i / last_line, pane->max_value,
+ number_to_human_readable(pane->max_value * i / last_line,
pane->type, str);
hud_draw_string(hud, x, y, "%s", str);
}
@@ -394,8 +389,7 @@ hud_pane_accumulate_vertices(struct hud_context *hud,
unsigned x = pane->x1 + 2;
unsigned y = pane->y2 + 2 + i*hud->font.glyph_height;
- number_to_human_readable(gr->current_value, pane->max_value,
- pane->type, str);
+ number_to_human_readable(gr->current_value, pane->type, str);
hud_draw_string(hud, x, y, " %s: %s", gr->name, str);
i++;
}
More information about the mesa-commit
mailing list