[Mesa-dev] GL_AMD_performance_monitor for Nouveau

Hi, As part of my Google Summer of Code 2014, I implemented GL_AMD_performance_monitor for Nouveau using the state tracker of Gallium. Currently, only MP counters for NVC0+ (fermi) are exposed through this extension. At the end of my project, graphics counters for NV50 (tesla) will be available from GL_AMD_performance_monitor (I'm still working on the kernel interface). This set of patches has been tested on NVC1 and NVE7. Comments and reviews are welcome. Thanks in advance for your feedbacks! src/gallium/auxiliary/hud/hud_driver_query.c | 2 +- src/gallium/drivers/freedreno/freedreno_query.c | 4 +- src/gallium/drivers/freedreno/freedreno_query.h | 2 +- src/gallium/drivers/freedreno/freedreno_query_hw.c | 3 +- src/gallium/drivers/freedreno/freedreno_query_sw.c | 3 +- src/gallium/drivers/galahad/glhd_context.c | 6 +- src/gallium/drivers/i915/i915_query.c | 3 +- src/gallium/drivers/identity/id_context.c | 6 +- src/gallium/drivers/ilo/ilo_query.c | 3 +- src/gallium/drivers/llvmpipe/lp_query.c | 3 +- src/gallium/drivers/noop/noop_pipe.c | 3 +- src/gallium/drivers/nouveau/nv30/nv30_query.c | 5 +- src/gallium/drivers/nouveau/nv50/nv50_query.c | 3 +- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 99 +++++++++++++++--- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 8 ++ src/gallium/drivers/r300/r300_query.c | 9 +- src/gallium/drivers/radeon/r600_query.c | 16 +-- src/gallium/drivers/rbug/rbug_context.c | 8 +- src/gallium/drivers/softpipe/sp_query.c | 3 +- src/gallium/drivers/svga/svga_pipe_query.c | 3 +- src/gallium/drivers/trace/tr_context.c | 6 +- src/gallium/include/pipe/p_context.h | 2 +- src/gallium/include/pipe/p_defines.h | 23 ++++- src/gallium/include/pipe/p_screen.h | 11 ++ src/mesa/Makefile.sources | 1 + src/mesa/state_tracker/st_cb_perfmon.c | 361 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/state_tracker/st_cb_perfmon.h | 63 ++++++++++++ src/mesa/state_tracker/st_context.c | 3 + src/mesa/state_tracker/st_extensions.c | 1 + 30 files changed, 610 insertions(+), 54 deletions(-)