radv: fix fast clearing DCC if one level can't be compressed on GFX10+

Fallback to a slow clear, this could be improved by splitting the
clear into two parts (one fast and one slow) but that's complicated.

Cc: 21.1 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10516>
(cherry picked from commit e98c61e9f3)
This commit is contained in:
Samuel Pitoiset 2021-04-29 11:51:14 +02:00 committed by Eric Engestrom
parent 284299176e
commit 90c441eceb
2 changed files with 19 additions and 12 deletions

View file

@ -301,7 +301,7 @@
"description": "radv: fix fast clearing DCC if one level can't be compressed on GFX10+",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -1521,18 +1521,25 @@ radv_can_fast_clear_color(struct radv_cmd_buffer *cmd_buffer, const struct radv_
return false;
}
if (iview->image->info.levels > 1 &&
cmd_buffer->device->physical_device->rad_info.chip_class == GFX8) {
for (uint32_t l = 0; l < iview->level_count; l++) {
uint32_t level = iview->base_mip + l;
struct legacy_surf_dcc_level *dcc_level =
&iview->image->planes[0].surface.u.legacy.color.dcc_level[level];
/* Do not fast clears if one level can't be
* fast cleared.
*/
if (!dcc_level->dcc_fast_clear_size)
if (iview->image->info.levels > 1) {
if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) {
uint32_t last_level = iview->base_mip + iview->level_count - 1;
if (last_level >= iview->image->planes[0].surface.num_meta_levels) {
/* Do not fast clears if one level can't be fast cleard. */
return false;
}
} else {
for (uint32_t l = 0; l < iview->level_count; l++) {
uint32_t level = iview->base_mip + l;
struct legacy_surf_dcc_level *dcc_level =
&iview->image->planes[0].surface.u.legacy.color.dcc_level[level];
/* Do not fast clears if one level can't be
* fast cleared.
*/
if (!dcc_level->dcc_fast_clear_size)
return false;
}
}
}
}