diff options
author | Christoph Bumiller <[email protected]> | 2013-03-30 15:55:20 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2013-04-03 12:54:43 +0200 |
commit | 2a8145d36b0f04d0f26c1628222a8b5c4830f435 (patch) | |
tree | 7d298c6f8afc0071293b58fadc84d890efa0f06d /src/gallium/drivers/nouveau/nouveau_buffer.c | |
parent | 3ed4bbd76904983ca4b19a58afd2187f497b4ab0 (diff) |
nouveau: accelerate buffer copies in resource_copy_region
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_buffer.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_buffer.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index 5c9a44e368a..02bc6f04146 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -2,6 +2,7 @@ #include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_surface.h" #include "nouveau_screen.h" #include "nouveau_context.h" @@ -460,6 +461,39 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe, } +void +nouveau_copy_buffer(struct nouveau_context *nv, + struct nv04_resource *dst, unsigned dstx, + struct nv04_resource *src, unsigned srcx, unsigned size) +{ + assert(dst->base.target == PIPE_BUFFER && src->base.target == PIPE_BUFFER); + + if (likely(dst->domain) && likely(src->domain)) { + nv->copy_data(nv, + dst->bo, dst->offset + dstx, dst->domain, + src->bo, src->offset + srcx, src->domain, size); + + dst->status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING; + nouveau_fence_ref(nv->screen->fence.current, &dst->fence); + nouveau_fence_ref(nv->screen->fence.current, &dst->fence_wr); + + src->status |= NOUVEAU_BUFFER_STATUS_GPU_READING; + nouveau_fence_ref(nv->screen->fence.current, &src->fence); + } else { + struct pipe_box src_box; + src_box.x = srcx; + src_box.y = 0; + src_box.z = 0; + src_box.width = size; + src_box.height = 1; + src_box.depth = 1; + util_resource_copy_region(&nv->pipe, + &dst->base, 0, dstx, 0, 0, + &src->base, 0, &src_box); + } +} + + void * nouveau_resource_map_offset(struct nouveau_context *nv, struct nv04_resource *res, uint32_t offset, |