radeonsi: try to disable dcc if compute_blit is the only option

COMPUTE contexts have no blitter so there are no fallback to
si_can_use_compute_blit failing.

One solution would be to disable DCC globally when a COMPUTE context is
created but I'm not 100% sure it's a good idea.

Until then this commit can fix a number of cases and will also prevent
crashing if si_compute_blit fails.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10296
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27295>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2024-01-22 15:19:20 +01:00
parent f66055a6a6
commit e4f7754977
2 changed files with 31 additions and 6 deletions

View file

@ -962,6 +962,13 @@ void si_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst
src_box, SI_OP_SYNC_BEFORE_AFTER))
return;
/* If the blitter isn't available fail here instead of crashing. */
if (!sctx->blitter) {
fprintf(stderr, "si_resource_copy_region failed src_format: %s dst_format: %s\n",
util_format_name(src->format), util_format_name(dst->format));
return;
}
assert(u_max_sample(dst) == u_max_sample(src));
/* The driver doesn't decompress resources automatically while

View file

@ -659,12 +659,30 @@ bool si_compute_copy_image(struct si_context *sctx, struct pipe_resource *dst, u
*/
if (!util_format_is_compressed(src->format) &&
!util_format_is_compressed(dst->format) &&
!util_format_is_subsampled_422(src->format) &&
(!si_can_use_compute_blit(sctx, dst->format, dst->nr_samples, true,
vi_dcc_enabled(sdst, dst_level)) ||
!si_can_use_compute_blit(sctx, src->format, src->nr_samples, false,
vi_dcc_enabled(ssrc, src_level))))
return false;
!util_format_is_subsampled_422(src->format)) {
bool src_can_use_compute_blit =
si_can_use_compute_blit(sctx, src->format, src->nr_samples, false,
vi_dcc_enabled(ssrc, src_level));
if (!src_can_use_compute_blit)
return false;
bool dst_can_use_compute_blit =
si_can_use_compute_blit(sctx, dst->format, dst->nr_samples, true,
vi_dcc_enabled(sdst, dst_level));
if (!dst_can_use_compute_blit && !sctx->has_graphics &&
si_can_use_compute_blit(sctx, dst->format, dst->nr_samples, false,
vi_dcc_enabled(sdst, dst_level))) {
/* Non-graphics context don't have a blitter, so try harder to do
* a compute blit by disabling dcc on the destination texture.
*/
dst_can_use_compute_blit = si_texture_disable_dcc(sctx, sdst);
}
if (!dst_can_use_compute_blit)
return false;
}
enum pipe_format src_format = util_format_linear(src->format);
enum pipe_format dst_format = util_format_linear(dst->format);