tu/a750: Workaround GPU fault when fast-clearing R8G8 formats

Clearing VK_FORMAT_R8G8_* with fast-clear value and certain
dimensions (e.g. 960x540), and having GMEM renderpass afterwards
may lead to a GPU fault on A7XX.

Prop driver directly clears UBWC layers for R8G8_UNORM, and
doesn't use UBWC for R8G8_UINT. It uses generic clear for R8G8 only
for renderpass, where doesn't cause issues in Turnip.

Fixes GPU fault in Limbo game running via Zink.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31258>
This commit is contained in:
Danylo Piliaiev 2024-09-18 18:32:21 +02:00 committed by Marge Bot
parent 96530a391d
commit b31a4037de
3 changed files with 12 additions and 2 deletions

View file

@ -276,6 +276,9 @@ struct fd_dev_info {
/* Whether a single clear blit could be used for both sysmem and gmem.*/
bool has_generic_clear;
/* Whether r8g8 UBWC fast-clear work correctly. */
bool r8g8_faulty_fast_clear_quirk;
/* a750 has a bug where writing and then reading a UBWC-compressed IBO
* requires flushing UCHE. This is reproducible in many CTS tests, for
* example dEQP-VK.image.load_store.with_format.2d.*.

View file

@ -897,6 +897,7 @@ a7xx_750 = A7XXProps(
ubwc_unorm_snorm_int_compatible = True,
supports_ibo_ubwc = True,
has_generic_clear = True,
r8g8_faulty_fast_clear_quirk = True,
gs_vpc_adjacency_quirk = True,
storage_8bit = True,
ubwc_all_formats_compatible = True,

View file

@ -3274,12 +3274,18 @@ static bool
use_generic_clear_for_image_clear(struct tu_cmd_buffer *cmd,
struct tu_image *image)
{
return cmd->device->physical_device->info->a7xx.has_generic_clear &&
const struct fd_dev_info *info = cmd->device->physical_device->info;
return info->a7xx.has_generic_clear &&
/* A7XX supports R9G9B9E5_FLOAT as color attachment and supports
* generic clears for it. A7XX TODO: allow R9G9B9E5_FLOAT
* attachments.
*/
image->vk.format != VK_FORMAT_E5B9G9R9_UFLOAT_PACK32;
image->vk.format != VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 &&
/* Clearing VK_FORMAT_R8G8_* with fast-clear value, certain
* dimensions (e.g. 960x540), and having GMEM renderpass afterwards
* may lead to a GPU fault on A7XX.
*/
!(info->a7xx.r8g8_faulty_fast_clear_quirk && image_is_r8g8(image));
}
template <chip CHIP>