summaryrefslogtreecommitdiff
path: root/overlay/overlay.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-20 11:08:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-20 11:08:13 +0100
commitc888507b68c665e15d02defae9d341245c87b1c2 (patch)
treed6569ca2b755599f75326fab5baf8385bdaa96e4 /overlay/overlay.c
parentcf62d52eb414db54c7dd8c78e3052fbad30f94fb (diff)
overlay: use rc6_enable to drop useless information
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/overlay.c')
-rw-r--r--overlay/overlay.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/overlay/overlay.c b/overlay/overlay.c
index bf508fd9..0968fd71 100644
--- a/overlay/overlay.c
+++ b/overlay/overlay.c
@@ -20,6 +20,8 @@
#include "power.h"
#include "rc6.h"
+#define is_power_of_two(x) (((x) & ((x)-1)) == 0)
+
const cairo_user_data_key_t overlay_key;
static void overlay_show(cairo_surface_t *surface)
@@ -417,7 +419,6 @@ static void init_gpu_freq(struct overlay_context *ctx,
}
rc6_init(&gf->rc6);
-
}
static void show_gpu_freq(struct overlay_context *ctx, struct overlay_gpu_freq *gf)
@@ -454,9 +455,25 @@ static void show_gpu_freq(struct overlay_context *ctx, struct overlay_gpu_freq *
sprintf(buf, "RC6: %d%%", gf->rc6.rc6_combined);
cairo_move_to(ctx->cr, 12, y);
cairo_show_text(ctx->cr, buf);
- if (gf->rc6.rc6_combined) {
- sprintf(buf, " [rc6=%d%%, rc6p=%d%%, rc6pp=%d%%]",
- gf->rc6.rc6, gf->rc6.rc6p, gf->rc6.rc6pp);
+ if (gf->rc6.rc6_combined && !is_power_of_two(gf->rc6.enabled)) {
+ len = 0;
+ sprintf(buf, " (");
+ if (gf->rc6.enabled & 1) {
+ if (len)
+ len += sprintf(buf + 3 + len, ", ");
+ len += sprintf(buf + 3 + len, "rc6=%d%%", gf->rc6.rc6);
+ }
+ if (gf->rc6.enabled & 2) {
+ if (len)
+ len += sprintf(buf + 3 + len, ", ");
+ len += sprintf(buf + 3 + len, "rc6p=%d%%", gf->rc6.rc6p);
+ }
+ if (gf->rc6.enabled & 4) {
+ if (len)
+ len += sprintf(buf + 3 + len, ", ");
+ len += sprintf(buf + 3 + len, "rc6pp=%d%%", gf->rc6.rc6pp);
+ }
+ sprintf(buf + 3 + len, ")");
cairo_show_text(ctx->cr, buf);
}
y += 14;