summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2015-11-10 01:27:15 +0100
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2015-11-14 23:42:42 +0100
commit6a9c151dbb87a10b6d51c451a5a277d646d08857 (patch)
tree6436fb41a82e3b0cdfd837b5bfaffcaf08409afd /src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
parentff72440b40211326eda118232fabd53965410afd (diff)
downloadexternal_mesa3d-6a9c151dbb87a10b6d51c451a5a277d646d08857.zip
external_mesa3d-6a9c151dbb87a10b6d51c451a5a277d646d08857.tar.gz
external_mesa3d-6a9c151dbb87a10b6d51c451a5a277d646d08857.tar.bz2
nv50: add compute-related MP perf counters on G84+
These compute-related MP performance counters have been reverse engineered using CUPTI which is part of NVIDIA CUDA. As for nvc0, we use a compute kernel to read out those performance counters, and the command stream to configure them. Note that Tesla only exposes 4 MP performance counters, while Fermi has 8. Only G84+ is supported because G80 is an old and weird card. Tested on G84, G96, G200, MCP79 and GT218 with glxgears, glxspheres64, xonotic-glx, heaven and valley. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Tested-by: Pierre Moreau <pierre.morrow@free.fr> Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_query_hw.c')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_query_hw.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
index 945ce7ab..23108ac 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
@@ -25,6 +25,7 @@
#include "nv50/nv50_context.h"
#include "nv50/nv50_query_hw.h"
+#include "nv50/nv50_query_hw_sm.h"
#include "nv_object.xml.h"
#define NV50_HW_QUERY_STATE_READY 0
@@ -41,7 +42,7 @@
#define NV50_HW_QUERY_ALLOC_SPACE 256
-static bool
+bool
nv50_hw_query_allocate(struct nv50_context *nv50, struct nv50_query *q,
int size)
{
@@ -122,6 +123,9 @@ nv50_hw_begin_query(struct nv50_context *nv50, struct nv50_query *q)
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct nv50_hw_query *hq = nv50_hw_query(q);
+ if (hq->funcs && hq->funcs->begin_query)
+ return hq->funcs->begin_query(nv50, hq);
+
/* For occlusion queries we have to change the storage, because a previous
* query might set the initial render condition to false even *after* we re-
* initialized it to true.
@@ -193,6 +197,11 @@ nv50_hw_end_query(struct nv50_context *nv50, struct nv50_query *q)
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct nv50_hw_query *hq = nv50_hw_query(q);
+ if (hq->funcs && hq->funcs->end_query) {
+ hq->funcs->end_query(nv50, hq);
+ return;
+ }
+
hq->state = NV50_HW_QUERY_STATE_ENDED;
switch (q->type) {
@@ -261,6 +270,9 @@ nv50_hw_get_query_result(struct nv50_context *nv50, struct nv50_query *q,
uint64_t *data64 = (uint64_t *)hq->data;
int i;
+ if (hq->funcs && hq->funcs->get_query_result)
+ return hq->funcs->get_query_result(nv50, hq, wait, result);
+
if (hq->state != NV50_HW_QUERY_STATE_READY)
nv50_hw_query_update(q);
@@ -331,6 +343,12 @@ nv50_hw_create_query(struct nv50_context *nv50, unsigned type, unsigned index)
struct nv50_hw_query *hq;
struct nv50_query *q;
+ hq = nv50_hw_sm_create_query(nv50, type);
+ if (hq) {
+ hq->base.funcs = &hw_query_funcs;
+ return (struct nv50_query *)hq;
+ }
+
hq = CALLOC_STRUCT(nv50_hw_query);
if (!hq)
return NULL;
@@ -375,6 +393,20 @@ nv50_hw_create_query(struct nv50_context *nv50, unsigned type, unsigned index)
return q;
}
+int
+nv50_hw_get_driver_query_info(struct nv50_screen *screen, unsigned id,
+ struct pipe_driver_query_info *info)
+{
+ int num_hw_sm_queries = 0;
+
+ num_hw_sm_queries = nv50_hw_sm_get_driver_query_info(screen, 0, NULL);
+
+ if (!info)
+ return num_hw_sm_queries;
+
+ return nv50_hw_sm_get_driver_query_info(screen, id, info);
+}
+
void
nv50_hw_query_pushbuf_submit(struct nouveau_pushbuf *push, uint16_t method,
struct nv50_query *q, unsigned result_offset)