Module: Mesa Branch: master Commit: d71a9b7d9dc65a5cd56a81a816bc05535031d706 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d71a9b7d9dc65a5cd56a81a816bc05535031d706
Author: Eric Anholt <e...@anholt.net> Date: Fri Aug 22 13:47:19 2014 -0700 vc4: Handle a couple of the transfer map flags. This is part of fixing extremely long runtimes on some piglit tests that involve streaming vertex reuploads due to format conversions, and will similarly be important for X performance, which relies on these flags. --- src/gallium/drivers/vc4/vc4_bufmgr.h | 3 +++ src/gallium/drivers/vc4/vc4_resource.c | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.h b/src/gallium/drivers/vc4/vc4_bufmgr.h index 14bfa24..00ea149 100644 --- a/src/gallium/drivers/vc4/vc4_bufmgr.h +++ b/src/gallium/drivers/vc4/vc4_bufmgr.h @@ -70,6 +70,9 @@ vc4_bo_reference(struct vc4_bo *bo) static inline void vc4_bo_unreference(struct vc4_bo **bo) { + if (!*bo) + return; + if (pipe_reference(&(*bo)->reference, NULL)) vc4_bo_free(*bo); *bo = NULL; diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index 98c8f89..a71ae5b 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -73,15 +73,20 @@ vc4_resource_transfer_map(struct pipe_context *pctx, enum pipe_format format = prsc->format; char *buf; - vc4_flush_for_bo(pctx, rsc->bo); + if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) { + uint32_t size = rsc->bo->size; + vc4_bo_unreference(&rsc->bo); + rsc->bo = vc4_bo_alloc(vc4->screen, size, "resource"); + } + + if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) + vc4_flush_for_bo(pctx, rsc->bo); trans = util_slab_alloc(&vc4->transfer_pool); if (!trans) return NULL; - /* XXX: Handle DISCARD_WHOLE_RESOURCE, DONTBLOCK, UNSYNCHRONIZED, - * DISCARD_WHOLE_RESOURCE, PERSISTENT, COHERENT. - */ + /* XXX: Handle DONTBLOCK, DISCARD_RANGE, PERSISTENT, COHERENT. */ /* util_slab_alloc() doesn't zero: */ memset(trans, 0, sizeof(*trans)); _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit