overlay: Fill the blank charts with error messages

Instead of showing nothing, show a "space left intentionally blank"
message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-08-22 10:59:58 +00:00
parent b20a6b8279
commit 184786988e
3 changed files with 30 additions and 5 deletions

View File

@ -301,8 +301,10 @@ void gpu_perf_init(struct gpu_perf *gp, unsigned flags)
perf_tracepoint_open(gp, "i915", "i915_gem_request_wait_end", wait_end);
perf_tracepoint_open(gp, "i915", "i915_flip_complete", flip_complete);
if (gp->nr_events == 0)
if (gp->nr_events == 0) {
gp->error = "i915.ko tracepoints not available";
return;
}
if (perf_mmap(gp))
return;

View File

@ -30,6 +30,7 @@
#define MAX_RINGS 4
struct gpu_perf {
const char *error;
int page_size;
int nr_cpus;
int nr_events;

View File

@ -289,15 +289,26 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
cairo_pattern_t *linear;
int x, y, y1, y2, n;
cairo_rectangle(ctx->cr, ctx->width/2+6-.5, 12-.5, ctx->width/2-18+1, ctx->height/2-18+1);
cairo_set_source_rgb(ctx->cr, .15, .15, .15);
cairo_set_line_width(ctx->cr, 1);
cairo_stroke(ctx->cr);
if (gp->gpu_perf.error) {
cairo_text_extents_t extents;
cairo_text_extents(ctx->cr, gp->gpu_perf.error, &extents);
cairo_move_to(ctx->cr,
ctx->width/2+6 + (ctx->width/2-18 - extents.width)/2.,
12 + (ctx->height/2-18 + extents.height)/2.);
cairo_show_text(ctx->cr, gp->gpu_perf.error);
return;
}
gpu_perf_update(&gp->gpu_perf);
y = 12 + 12 - 2;
x = ctx->width/2 + 6;
cairo_rectangle(ctx->cr, ctx->width/2+6-.5, 12-.5, ctx->width/2-18+1, ctx->height/2-18+1);
cairo_set_source_rgb(ctx->cr, .15, .15, .15);
cairo_set_line_width(ctx->cr, 1);
cairo_stroke(ctx->cr);
for (comm = gp->gpu_perf.comm; comm; comm = comm->next) {
int total;
@ -495,6 +506,17 @@ static void show_gpu_freq(struct overlay_context *ctx, struct overlay_gpu_freq *
cairo_set_line_width(ctx->cr, 1);
cairo_stroke(ctx->cr);
if (gf->gpu_freq.error) {
const char *txt = "GPU frequency not found in debugfs";
cairo_text_extents_t extents;
cairo_text_extents(ctx->cr, txt, &extents);
cairo_move_to(ctx->cr,
12 + (ctx->width/2-18 - extents.width)/2.,
ctx->height/2+6 + (ctx->height/2-18 + extents.height)/2.);
cairo_show_text(ctx->cr, txt);
return;
}
if (has_freq) {
if (gf->gpu_freq.current)
chart_add_sample(&gf->current, gf->gpu_freq.current);