unsigned max_num_vertices;
unsigned num_vertices;
} text, bg, whitelines;
+
+ struct {
+ boolean query_pipeline_statistics;
+ } cap;
};
else if (sscanf(name, "cpu%u%s", &i, s) == 1) {
hud_cpu_graph_install(pane, i);
}
- else if (strcmp(name, "pixels-rendered") == 0 &&
+ else if (strcmp(name, "samples-passed") == 0 &&
has_occlusion_query(hud->pipe->screen)) {
- hud_pipe_query_install(pane, hud->pipe, "pixels-rendered",
- PIPE_QUERY_OCCLUSION_COUNTER, 0, FALSE);
+ hud_pipe_query_install(pane, hud->pipe, "samples-passed",
+ PIPE_QUERY_OCCLUSION_COUNTER, 0, 0, FALSE);
}
else if (strcmp(name, "primitives-generated") == 0 &&
has_streamout(hud->pipe->screen)) {
hud_pipe_query_install(pane, hud->pipe, "primitives-generated",
- PIPE_QUERY_PRIMITIVES_GENERATED, 0, FALSE);
+ PIPE_QUERY_PRIMITIVES_GENERATED, 0, 0, FALSE);
+ }
+ else if (strncmp(name, "pipeline-statistics-", 20) == 0) {
+ if (hud->cap.query_pipeline_statistics) {
+ static const char *pipeline_statistics_names[] =
+ {
+ "ia-vertices",
+ "ia-primitives",
+ "vs-invocations",
+ "gs-invocations",
+ "gs-primitives",
+ "clipper-invocations",
+ "clipper-primitives-generated",
+ "ps-invocations",
+ "hs-invocations",
+ "ds-invocations",
+ "cs-invocations"
+ };
+ for (i = 0; i < Elements(pipeline_statistics_names); ++i)
+ if (strcmp(&name[20], pipeline_statistics_names[i]) == 0)
+ break;
+ if (i < Elements(pipeline_statistics_names))
+ hud_pipe_query_install(pane, hud->pipe, &name[20],
+ PIPE_QUERY_PIPELINE_STATISTICS, i,
+ 0, FALSE);
+ else
+ fprintf(stderr, "gallium_hud: invalid pipeline-statistics-*\n");
+ } else {
+ fprintf(stderr, "gallium_hud: PIPE_QUERY_PIPELINE_STATISTICS "
+ "not supported by the driver\n");
+ }
}
else {
if (!hud_driver_query_install(pane, hud->pipe, name)){
LIST_INITHEAD(&hud->pane_list);
+ hud->cap.query_pipeline_statistics =
+ pipe->screen->get_param(pipe->screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS);
+
hud_parse_env_var(hud, env);
return hud;
}
#include "os/os_time.h"
#include "util/u_memory.h"
#include <stdio.h>
+#include <inttypes.h>
static boolean
get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time)
int i, num;
num = sscanf(line,
- "%s %llu %llu %llu %llu %llu %llu %llu %llu %llu "
- "%llu %llu %llu",
+ "%s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64
+ " %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64
+ " %"PRIu64" %"PRIu64"",
cpuname, &v[0], &v[1], &v[2], &v[3], &v[4], &v[5],
&v[6], &v[7], &v[8], &v[9], &v[10], &v[11]);
if (num < 5) {
struct query_info {
struct pipe_context *pipe;
unsigned query_type;
+ unsigned result_index; /* unit depends on query_type */
/* Ring of queries. If a query is busy, we use another slot. */
struct pipe_query *query[NUM_QUERIES];
while (1) {
struct pipe_query *query = info->query[info->tail];
union pipe_query_result result;
- result.u64 = 0;
+ uint64_t *res64 = (uint64_t *)&result;
if (pipe->get_query_result(pipe, query, FALSE, &result)) {
- info->results_cumulative += result.u64;
+ info->results_cumulative += res64[info->result_index];
info->num_results++;
if (info->tail == info->head)
void
hud_pipe_query_install(struct hud_pane *pane, struct pipe_context *pipe,
const char *name, unsigned query_type,
+ unsigned result_index,
uint64_t max_value, boolean uses_byte_units)
{
struct hud_graph *gr;
info = gr->query_data;
info->pipe = pipe;
info->query_type = query_type;
+ info->result_index = result_index;
hud_pane_add_graph(pane, gr);
if (pane->max_value < max_value)
if (!found)
return FALSE;
- hud_pipe_query_install(pane, pipe, query.name, query.query_type,
+ hud_pipe_query_install(pane, pipe, query.name, query.query_type, 0,
query.max_value, query.uses_byte_units);
return TRUE;
}