summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-04-01 14:06:06 -0400
committerMarek Olšák <[email protected]>2018-04-05 15:34:58 -0400
commit9d7f809c03dc8a7ef564ad535bc3f4255b51e95c (patch)
treeead4cc08296b8923df3e4c4d063b81ddcfab5500 /src/gallium/drivers/radeon
parent898500c440785fba408ecdcf9c260cca6c2c6bcd (diff)
radeonsi: remove r600_pipe_common::invalidate_buffer
Acked-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r--src/gallium/drivers/radeon/r600_buffer_common.c12
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h4
2 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index d215c9dfe80..bc7e14beca4 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -254,6 +254,12 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
FREE(rbuffer);
}
+/* Reallocate the buffer a update all resource bindings where the buffer is
+ * bound.
+ *
+ * This is used to avoid CPU-GPU synchronizations, because it makes the buffer
+ * idle by discarding its contents.
+ */
static bool
r600_invalidate_buffer(struct r600_common_context *rctx,
struct r600_resource *rbuffer)
@@ -275,7 +281,11 @@ r600_invalidate_buffer(struct r600_common_context *rctx,
/* Check if mapping this buffer would cause waiting for the GPU. */
if (si_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);
+ uint64_t old_va = rbuffer->gpu_address;
+
+ /* Reallocate the buffer in the same pipe_resource. */
+ si_alloc_resource(rctx->screen, rbuffer);
+ si_rebind_buffer(&rctx->b, &rbuffer->b.b, old_va);
} else {
util_range_set_empty(&rbuffer->valid_buffer_range);
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 9dbe18d0855..288562bfdf3 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -495,10 +495,6 @@ struct r600_common_context {
void (*decompress_dcc)(struct pipe_context *ctx,
struct r600_texture *rtex);
-
- /* Reallocate the buffer and update all resource bindings where
- * the buffer is bound, including all resource descriptors. */
- void (*invalidate_buffer)(struct pipe_context *ctx, struct pipe_resource *buf);
};
/* r600_buffer_common.c */