diff options
author | Ilia Mirkin <[email protected]> | 2015-02-18 03:35:23 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-02-19 23:12:35 -0500 |
commit | 5000a5f67b556096b6ba1e9bdac3a6e5cd5a1f68 (patch) | |
tree | 64e105fc603bc24a02a503264c89dc86d5ef059f /src/gallium/drivers/nouveau | |
parent | f883df74e0f1824607435eb43456263fc48085b8 (diff) |
nv50: add PIPELINE_STATISTICS query support, based on nvc0
Signed-off-by: Ilia Mirkin <[email protected]>
Tested-by: Nick Tenney <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_query.c | 27 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_screen.c | 2 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c index b9c7d1e1dca..e81ac5a6d42 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c @@ -48,7 +48,7 @@ struct nv50_query { struct nouveau_mm_allocation *mm; }; -#define NV50_QUERY_ALLOC_SPACE 128 +#define NV50_QUERY_ALLOC_SPACE 256 static INLINE struct nv50_query * nv50_query(struct pipe_query *pipe) @@ -184,6 +184,16 @@ nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq) nv50_query_get(push, q, 0x20, 0x05805002); nv50_query_get(push, q, 0x30, 0x06805002); break; + case PIPE_QUERY_PIPELINE_STATISTICS: + nv50_query_get(push, q, 0x80, 0x00801002); /* VFETCH, VERTICES */ + nv50_query_get(push, q, 0x90, 0x01801002); /* VFETCH, PRIMS */ + nv50_query_get(push, q, 0xa0, 0x02802002); /* VP, LAUNCHES */ + nv50_query_get(push, q, 0xb0, 0x03806002); /* GP, LAUNCHES */ + nv50_query_get(push, q, 0xc0, 0x04806002); /* GP, PRIMS_OUT */ + nv50_query_get(push, q, 0xd0, 0x07804002); /* RAST, PRIMS_IN */ + nv50_query_get(push, q, 0xe0, 0x08804002); /* RAST, PRIMS_OUT */ + nv50_query_get(push, q, 0xf0, 0x0980a002); /* ROP, PIXELS */ + break; case PIPE_QUERY_TIME_ELAPSED: nv50_query_get(push, q, 0x10, 0x00005002); break; @@ -217,6 +227,16 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq) nv50_query_get(push, q, 0x00, 0x05805002); nv50_query_get(push, q, 0x10, 0x06805002); break; + case PIPE_QUERY_PIPELINE_STATISTICS: + nv50_query_get(push, q, 0x00, 0x00801002); /* VFETCH, VERTICES */ + nv50_query_get(push, q, 0x10, 0x01801002); /* VFETCH, PRIMS */ + nv50_query_get(push, q, 0x20, 0x02802002); /* VP, LAUNCHES */ + nv50_query_get(push, q, 0x30, 0x03806002); /* GP, LAUNCHES */ + nv50_query_get(push, q, 0x40, 0x04806002); /* GP, PRIMS_OUT */ + nv50_query_get(push, q, 0x50, 0x07804002); /* RAST, PRIMS_IN */ + nv50_query_get(push, q, 0x60, 0x08804002); /* RAST, PRIMS_OUT */ + nv50_query_get(push, q, 0x70, 0x0980a002); /* ROP, PIXELS */ + break; case PIPE_QUERY_TIMESTAMP: q->sequence++; /* fall through */ @@ -257,6 +277,7 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, uint32_t *res32 = (uint32_t *)result; boolean *res8 = (boolean *)result; uint64_t *data64 = (uint64_t *)q->data; + int i; if (!q->ready) /* update ? */ q->ready = nv50_query_ready(q); @@ -289,6 +310,10 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, res64[0] = data64[0] - data64[4]; res64[1] = data64[2] - data64[6]; break; + case PIPE_QUERY_PIPELINE_STATISTICS: + for (i = 0; i < 8; ++i) + res64[i] = data64[i * 2] - data64[16 + i * 2]; + break; case PIPE_QUERY_TIMESTAMP: res64[0] = data64[1]; break; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 6c1de08ddca..95d1e6c32b4 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -175,6 +175,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_CLIP_HALFZ: case PIPE_CAP_POLYGON_OFFSET_CLAMP: + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: return 1; case PIPE_CAP_SEAMLESS_CUBE_MAP: return 1; /* class_3d >= NVA0_3D_CLASS; */ @@ -198,7 +199,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_TGSI_TEXCOORD: - case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT: case PIPE_CAP_TEXTURE_GATHER_SM5: case PIPE_CAP_FAKE_SW_MSAA: |