summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-03-02 01:27:53 +0100
committerMarek Olšák <[email protected]>2017-05-15 13:01:33 +0200
commite11f7e1d5996532228c6494ff9e93431c5506ef5 (patch)
tree3dddbd3a61211046a4b0a4cd0d6ce9bd2787f5d2 /src/gallium/drivers/radeon
parent8b5485957e19287f7e694e7e87eed784c44bb1e2 (diff)
gallium/radeon: handle TC_TRANSFER_MAP_THREADED_UNSYNC
Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Dieter Nützel <[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.c2
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h1
3 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index 6a4846add78..4132858b1fc 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -27,6 +27,7 @@
#include "r600_cs.h"
#include "util/u_memory.h"
#include "util/u_upload_mgr.h"
+#include "util/u_threaded_context.h"
#include <inttypes.h>
#include <stdio.h>
@@ -292,7 +293,12 @@ static void *r600_buffer_get_transfer(struct pipe_context *ctx,
unsigned offset)
{
struct r600_common_context *rctx = (struct r600_common_context*)ctx;
- struct r600_transfer *transfer = slab_alloc(&rctx->pool_transfers);
+ struct r600_transfer *transfer;
+
+ if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC)
+ transfer = slab_alloc(&rctx->pool_transfers_unsync);
+ else
+ transfer = slab_alloc(&rctx->pool_transfers);
transfer->transfer.resource = NULL;
pipe_resource_reference(&transfer->transfer.resource, resource);
@@ -418,6 +424,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
(rbuffer->flags & RADEON_FLAG_SPARSE)) {
struct r600_resource *staging;
+ assert(!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC));
staging = (struct r600_resource*) pipe_buffer_create(
ctx->screen, 0, PIPE_USAGE_STAGING,
box->width + (box->x % R600_MAP_BUFFER_ALIGNMENT));
@@ -507,6 +514,9 @@ static void r600_buffer_transfer_unmap(struct pipe_context *ctx,
r600_resource_reference(&rtransfer->staging, NULL);
pipe_resource_reference(&transfer->resource, NULL);
+
+ /* Don't use pool_transfers_unsync. We are always in the driver
+ * thread. */
slab_free(&rctx->pool_transfers, transfer);
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 48f0bf9a8e9..ccf90bc3a6c 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -610,6 +610,7 @@ bool r600_common_context_init(struct r600_common_context *rctx,
unsigned context_flags)
{
slab_create_child(&rctx->pool_transfers, &rscreen->pool_transfers);
+ slab_create_child(&rctx->pool_transfers_unsync, &rscreen->pool_transfers);
rctx->screen = rscreen;
rctx->ws = rscreen->ws;
@@ -713,6 +714,7 @@ void r600_common_context_cleanup(struct r600_common_context *rctx)
u_upload_destroy(rctx->b.const_uploader);
slab_destroy_child(&rctx->pool_transfers);
+ slab_destroy_child(&rctx->pool_transfers_unsync);
if (rctx->allocator_zeroed_memory) {
u_suballocator_destroy(rctx->allocator_zeroed_memory);
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 3e83d371b6e..51d797a03a7 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -555,6 +555,7 @@ struct r600_common_context {
struct u_suballocator *allocator_zeroed_memory;
struct slab_child_pool pool_transfers;
+ struct slab_child_pool pool_transfers_unsync; /* for threaded_context */
/* Current unaccounted memory usage. */
uint64_t vram;