mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
radeonsi: flush the context after resource_copy_region for buffer exports
Cc: 17.2 17.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 5e805cc74b)
[Emil Velikov: s/si_texture_disable_dcc/r600_texture_disable_dcc/]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/gallium/drivers/radeon/r600_texture.c
This commit is contained in:
parent
b50154eff7
commit
4d0ec672cb
1 changed files with 12 additions and 2 deletions
|
|
@ -554,6 +554,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
|
||||||
struct radeon_bo_metadata metadata;
|
struct radeon_bo_metadata metadata;
|
||||||
bool update_metadata = false;
|
bool update_metadata = false;
|
||||||
unsigned stride, offset, slice_size;
|
unsigned stride, offset, slice_size;
|
||||||
|
bool flush = false;
|
||||||
|
|
||||||
ctx = threaded_context_unwrap_sync(ctx);
|
ctx = threaded_context_unwrap_sync(ctx);
|
||||||
rctx = (struct r600_common_context*)(ctx ? ctx : rscreen->aux_context);
|
rctx = (struct r600_common_context*)(ctx ? ctx : rscreen->aux_context);
|
||||||
|
|
@ -570,7 +571,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
|
||||||
assert(!res->b.is_shared);
|
assert(!res->b.is_shared);
|
||||||
r600_reallocate_texture_inplace(rctx, rtex,
|
r600_reallocate_texture_inplace(rctx, rtex,
|
||||||
PIPE_BIND_SHARED, false);
|
PIPE_BIND_SHARED, false);
|
||||||
rctx->b.flush(&rctx->b, NULL, 0);
|
flush = true;
|
||||||
assert(res->b.b.bind & PIPE_BIND_SHARED);
|
assert(res->b.b.bind & PIPE_BIND_SHARED);
|
||||||
assert(res->flags & RADEON_FLAG_NO_SUBALLOC);
|
assert(res->flags & RADEON_FLAG_NO_SUBALLOC);
|
||||||
}
|
}
|
||||||
|
|
@ -580,14 +581,19 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
|
||||||
* access.
|
* access.
|
||||||
*/
|
*/
|
||||||
if (usage & PIPE_HANDLE_USAGE_WRITE && rtex->dcc_offset) {
|
if (usage & PIPE_HANDLE_USAGE_WRITE && rtex->dcc_offset) {
|
||||||
if (r600_texture_disable_dcc(rctx, rtex))
|
if (r600_texture_disable_dcc(rctx, rtex)) {
|
||||||
update_metadata = true;
|
update_metadata = true;
|
||||||
|
/* si_texture_disable_dcc flushes the context */
|
||||||
|
flush = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) &&
|
if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) &&
|
||||||
(rtex->cmask.size || rtex->dcc_offset)) {
|
(rtex->cmask.size || rtex->dcc_offset)) {
|
||||||
/* Eliminate fast clear (both CMASK and DCC) */
|
/* Eliminate fast clear (both CMASK and DCC) */
|
||||||
r600_eliminate_fast_color_clear(rctx, rtex);
|
r600_eliminate_fast_color_clear(rctx, rtex);
|
||||||
|
/* eliminate_fast_color_clear flushes the context */
|
||||||
|
flush = false;
|
||||||
|
|
||||||
/* Disable CMASK if flush_resource isn't going
|
/* Disable CMASK if flush_resource isn't going
|
||||||
* to be called.
|
* to be called.
|
||||||
|
|
@ -636,6 +642,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
|
||||||
u_box_1d(0, newb->width0, &box);
|
u_box_1d(0, newb->width0, &box);
|
||||||
rctx->b.resource_copy_region(&rctx->b, newb, 0, 0, 0, 0,
|
rctx->b.resource_copy_region(&rctx->b, newb, 0, 0, 0, 0,
|
||||||
&res->b.b, 0, &box);
|
&res->b.b, 0, &box);
|
||||||
|
flush = true;
|
||||||
/* Move the new buffer storage to the old pipe_resource. */
|
/* Move the new buffer storage to the old pipe_resource. */
|
||||||
r600_replace_buffer_storage(&rctx->b, &res->b.b, newb);
|
r600_replace_buffer_storage(&rctx->b, &res->b.b, newb);
|
||||||
pipe_resource_reference(&newb, NULL);
|
pipe_resource_reference(&newb, NULL);
|
||||||
|
|
@ -650,6 +657,9 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
|
||||||
slice_size = 0;
|
slice_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flush)
|
||||||
|
rctx->b.flush(&rctx->b, NULL, 0);
|
||||||
|
|
||||||
if (res->b.is_shared) {
|
if (res->b.is_shared) {
|
||||||
/* USAGE_EXPLICIT_FLUSH must be cleared if at least one user
|
/* USAGE_EXPLICIT_FLUSH must be cleared if at least one user
|
||||||
* doesn't set it.
|
* doesn't set it.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue