diff options
author | Christoph Bumiller <[email protected]> | 2013-03-29 16:30:58 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2013-04-03 12:54:43 +0200 |
commit | 198f514aa6f08bc43a3002519843b0fe94f340bd (patch) | |
tree | 1f9a3038e554dceadcd27ddc1b829815206f7432 /src/gallium/drivers/nouveau/nouveau_buffer.c | |
parent | 7628cc247feecfb31aff97f47f039ebe476f0ca8 (diff) |
nvc0: add some driver statistics queries
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_buffer.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_buffer.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index e3cbaf60a25..5c9a44e368a 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -51,12 +51,14 @@ nouveau_buffer_allocate(struct nouveau_screen *screen, &buf->bo, &buf->offset); if (!buf->bo) return nouveau_buffer_allocate(screen, buf, NOUVEAU_BO_GART); + NOUVEAU_DRV_STAT(screen, buf_obj_current_bytes_vid, buf->base.width0); } else if (domain == NOUVEAU_BO_GART) { buf->mm = nouveau_mm_allocate(screen->mm_GART, size, &buf->bo, &buf->offset); if (!buf->bo) return FALSE; + NOUVEAU_DRV_STAT(screen, buf_obj_current_bytes_sys, buf->base.width0); } else { assert(domain == 0); if (!nouveau_buffer_malloc(buf)) @@ -85,6 +87,11 @@ nouveau_buffer_release_gpu_storage(struct nv04_resource *buf) if (buf->mm) release_allocation(&buf->mm, buf->fence); + if (buf->domain == NOUVEAU_BO_VRAM) + NOUVEAU_DRV_STAT_RES(buf, buf_obj_current_bytes_vid, -(uint64_t)buf->base.width0); + if (buf->domain == NOUVEAU_BO_GART) + NOUVEAU_DRV_STAT_RES(buf, buf_obj_current_bytes_sys, -(uint64_t)buf->base.width0); + buf->domain = 0; } @@ -117,6 +124,8 @@ nouveau_buffer_destroy(struct pipe_screen *pscreen, nouveau_fence_ref(NULL, &res->fence_wr); FREE(res); + + NOUVEAU_DRV_STAT(nouveau_screen(pscreen), buf_obj_current_count, -1); } static uint8_t * @@ -153,6 +162,8 @@ nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx) const unsigned base = tx->base.box.x; const unsigned size = tx->base.box.width; + NOUVEAU_DRV_STAT(nv->screen, buf_read_bytes_staging_vid, size); + nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART, buf->bo, buf->offset + base, buf->domain, size); @@ -179,6 +190,11 @@ nouveau_transfer_write(struct nouveau_context *nv, struct nouveau_transfer *tx, else buf->status |= NOUVEAU_BUFFER_STATUS_DIRTY; + if (buf->domain == NOUVEAU_BO_VRAM) + NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_vid, size); + if (buf->domain == NOUVEAU_BO_GART) + NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_sys, size); + if (tx->bo) nv->copy_data(nv, buf->bo, buf->offset + base, buf->domain, tx->bo, tx->offset + offset, NOUVEAU_BO_GART, size); @@ -197,11 +213,15 @@ nouveau_buffer_sync(struct nv04_resource *buf, unsigned rw) if (rw == PIPE_TRANSFER_READ) { if (!buf->fence_wr) return TRUE; + NOUVEAU_DRV_STAT_RES(buf, buf_non_kernel_fence_sync_count, + !nouveau_fence_signalled(buf->fence_wr)); if (!nouveau_fence_wait(buf->fence_wr)) return FALSE; } else { if (!buf->fence) return TRUE; + NOUVEAU_DRV_STAT_RES(buf, buf_non_kernel_fence_sync_count, + !nouveau_fence_signalled(buf->fence)); if (!nouveau_fence_wait(buf->fence)) return FALSE; @@ -320,6 +340,11 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, nouveau_buffer_transfer_init(tx, resource, box, usage); *ptransfer = &tx->base; + if (usage & PIPE_TRANSFER_READ) + NOUVEAU_DRV_STAT(nv->screen, buf_transfers_rd, 1); + if (usage & PIPE_TRANSFER_WRITE) + NOUVEAU_DRV_STAT(nv->screen, buf_transfers_wr, 1); + if (buf->domain == NOUVEAU_BO_VRAM) { if (usage & NOUVEAU_TRANSFER_DISCARD) { if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) @@ -427,6 +452,9 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe, } } + if (!tx->bo && (tx->base.usage & PIPE_TRANSFER_WRITE)) + NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, tx->base.box.width); + nouveau_buffer_transfer_del(nv, tx); FREE(tx); } @@ -525,6 +553,8 @@ nouveau_buffer_create(struct pipe_screen *pscreen, if (buffer->domain == NOUVEAU_BO_VRAM && screen->hint_buf_keep_sysmem_copy) nouveau_buffer_cache(NULL, buffer); + NOUVEAU_DRV_STAT(screen, buf_obj_current_count, 1); + return &buffer->base; fail: |