diff options
author | Christoph Bumiller <[email protected]> | 2013-01-08 16:13:11 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2013-01-08 16:13:51 +0100 |
commit | 48a45ec24ae74c00d1487552e94d9f824a428f58 (patch) | |
tree | c2a160cb708b7a05f3340d889d6a0e676eb9d727 /src/gallium/drivers/nouveau/nouveau_context.h | |
parent | a75ddfd55d24363046f11b2fd2de25563698fa39 (diff) |
nouveau: improve buffer transfers
Save double memcpy on uploads to VRAM in most cases.
Properly handle FLUSH_EXPLICIT.
Reallocate on DISCARD_WHOLE_RESOURCE to avoid sync.
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_context.h')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_context.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_context.h b/src/gallium/drivers/nouveau/nouveau_context.h index b3fe05b1019..bad5ab7319b 100644 --- a/src/gallium/drivers/nouveau/nouveau_context.h +++ b/src/gallium/drivers/nouveau/nouveau_context.h @@ -28,6 +28,11 @@ struct nouveau_context { unsigned base, unsigned size, unsigned offset, unsigned words, const uint32_t *); + /* @return: @ref reduced by nr of references found in context */ + int (*invalidate_resource_storage)(struct nouveau_context *, + struct pipe_resource *, + int ref); + struct { uint8_t *map; unsigned id; @@ -40,6 +45,11 @@ struct nouveau_context { unsigned nr_runout; unsigned bo_size; } scratch; + + struct { + uint32_t buf_cache_count; + uint32_t buf_cache_frame; + } stats; }; static INLINE struct nouveau_context * @@ -84,4 +94,17 @@ nouveau_context_destroy(struct nouveau_context *ctx) FREE(ctx); } + +static INLINE void +nouveau_context_update_frame_stats(struct nouveau_context *nv) +{ + nv->stats.buf_cache_frame <<= 1; + if (nv->stats.buf_cache_count) { + nv->stats.buf_cache_count = 0; + nv->stats.buf_cache_frame |= 1; + if ((nv->stats.buf_cache_frame & 0xf) == 0xf) + nv->screen->hint_buf_keep_sysmem_copy = TRUE; + } +} + #endif |