diff options
author | Marek Olšák <[email protected]> | 2017-11-30 22:46:39 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-12-14 22:56:45 +0000 |
commit | b6fd93f8dcea7bc7c26fb8be89f2b7004e8a24c9 (patch) | |
tree | 2b1e330390974f0cf2cf115660e15c24c86e3f8a | |
parent | 49a612d1580b3316392273a069d20d93967126a8 (diff) |
radeonsi: flush the context after resource_copy_region for buffer exports
Cc: 17.2 17.3 <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
(cherry picked from commit 5e805cc74bc52f97de8f6308fc06bc96623e7e09)
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index ecf96971d37..74be3a29f73 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -587,6 +587,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, struct radeon_bo_metadata metadata; bool update_metadata = false; unsigned stride, offset, slice_size; + bool flush = false; ctx = threaded_context_unwrap_sync(ctx); rctx = (struct r600_common_context*)(ctx ? ctx : rscreen->aux_context); @@ -606,7 +607,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, assert(!res->b.is_shared); r600_reallocate_texture_inplace(rctx, rtex, PIPE_BIND_SHARED, false); - rctx->b.flush(&rctx->b, NULL, 0); + flush = true; assert(res->b.b.bind & PIPE_BIND_SHARED); assert(res->flags & RADEON_FLAG_NO_SUBALLOC); assert(!(res->flags & RADEON_FLAG_NO_INTERPROCESS_SHARING)); @@ -618,14 +619,19 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, * access. */ if (usage & PIPE_HANDLE_USAGE_WRITE && rtex->dcc_offset) { - if (si_texture_disable_dcc(rctx, rtex)) + if (si_texture_disable_dcc(rctx, rtex)) { update_metadata = true; + /* si_texture_disable_dcc flushes the context */ + flush = false; + } } if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) && (rtex->cmask.size || rtex->dcc_offset)) { /* Eliminate fast clear (both CMASK and DCC) */ r600_eliminate_fast_color_clear(rctx, rtex); + /* eliminate_fast_color_clear flushes the context */ + flush = false; /* Disable CMASK if flush_resource isn't going * to be called. @@ -674,6 +680,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, u_box_1d(0, newb->width0, &box); rctx->b.resource_copy_region(&rctx->b, newb, 0, 0, 0, 0, &res->b.b, 0, &box); + flush = true; /* Move the new buffer storage to the old pipe_resource. */ si_replace_buffer_storage(&rctx->b, &res->b.b, newb); pipe_resource_reference(&newb, NULL); @@ -688,6 +695,9 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, slice_size = 0; } + if (flush) + rctx->b.flush(&rctx->b, NULL, 0); + if (res->b.is_shared) { /* USAGE_EXPLICIT_FLUSH must be cleared if at least one user * doesn't set it. |