summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_buffer_common.c
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-01-14 09:41:04 -0500
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-01-14 09:41:04 -0500
commit321140d563730b210e6390c5b73c09fdcf9649af (patch)
tree498797f0f2f7983eb2489dd81016b9e8e9e85e3f /src/gallium/drivers/radeon/r600_buffer_common.c
parent08c71740ad609b26477b4062bb1794bb322e8b43 (diff)
downloadexternal_mesa3d-321140d563730b210e6390c5b73c09fdcf9649af.zip
external_mesa3d-321140d563730b210e6390c5b73c09fdcf9649af.tar.gz
external_mesa3d-321140d563730b210e6390c5b73c09fdcf9649af.tar.bz2
gallium/radeon: implement PIPE_CAP_INVALIDATE_BUFFER
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_buffer_common.c')
-rw-r--r--src/gallium/drivers/radeon/r600_buffer_common.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index aeb9a20..09755e0 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -209,6 +209,21 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
FREE(rbuffer);
}
+void r600_invalidate_resource(struct pipe_context *ctx,
+ struct pipe_resource *resource)
+{
+ struct r600_common_context *rctx = (struct r600_common_context*)ctx;
+ struct r600_resource *rbuffer = r600_resource(resource);
+
+ /* Check if mapping this buffer would cause waiting for the GPU. */
+ if (r600_rings_is_buffer_referenced(rctx, rbuffer->buf, RADEON_USAGE_READWRITE) ||
+ !rctx->ws->buffer_wait(rbuffer->buf, 0, RADEON_USAGE_READWRITE)) {
+ rctx->invalidate_buffer(&rctx->b, &rbuffer->b.b);
+ } else {
+ util_range_set_empty(&rbuffer->valid_buffer_range);
+ }
+}
+
static void *r600_buffer_get_transfer(struct pipe_context *ctx,
struct pipe_resource *resource,
unsigned level,
@@ -276,13 +291,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
assert(usage & PIPE_TRANSFER_WRITE);
- /* Check if mapping this buffer would cause waiting for the GPU. */
- if (r600_rings_is_buffer_referenced(rctx, rbuffer->buf, RADEON_USAGE_READWRITE) ||
- !rctx->ws->buffer_wait(rbuffer->buf, 0, RADEON_USAGE_READWRITE)) {
- rctx->invalidate_buffer(&rctx->b, &rbuffer->b.b);
- } else {
- util_range_set_empty(&rbuffer->valid_buffer_range);
- }
+ r600_invalidate_resource(ctx, resource);
/* At this point, the buffer is always idle. */
usage |= PIPE_TRANSFER_UNSYNCHRONIZED;